lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


Title: RE: Lua For Game Scripting article (Was: Re: Lua x Python)
Vincent,
 
I completly agree with you that it can be done this way.
 
One of the things I want to avoid is to have mappers (which will script their NPC maps as well) to get lost into scripting.  Truth is Im not
aiming to implement game code in a scripted language, but to give mappers a way to easy put more life into their maps through scripting.
In the final implementation , the scripter should not even care what interpreter the underlieing scripting engine uses, nor make any assumptions
about what are its abilites. He should stick to the interface offered , and if he needs another script command he must ask us to implement it.
Keeping this in mind, I am aiming to implement event handling INSIDE the scripting engine code, and only allow a very narrow set of events
to be processed by a script thread (for example , a "thread" (function, method) whatever  ) to be called on NPC spawning , take pain, hurt 50% , etc). In rest , he should not care about an event such as "finished moving to new vector", he should not even know that such a event is processed inside the scripting engine.
 
Anyway, even such a method as yours can be looked as a a very particular case of a thread dispatcher. We have here "pseudo-threads" (methods to be called ) which are dispatched by scripting engine core on very specific events.
 
 
However, your post made me think that a paper talking about using Lua in games, or in general any other interpretor in a game , should talk
about different scripting engine designs for games as well. In fact I think is much more important to talk about designs and designs caveats
then about calling C++ from scripts.
 
Ciao, Dan
 
----- Original Message -----
Sent: Friday, August 23, 2002 3:48 PM
Subject: RE: Lua For Game Scripting article (Was: Re: Lua x Python)

> given 20 NPC charachetrs in a game map, each acting as a
> "script slave"
> please tell me how
> do you see them drivern by a single script thread ? Not to

By making the script event driven. No "wait until this happens",
just a function called whenever it happens. While I do agree that
it complicates the code substantially, it is still well adapted
to the existing versions of Lua. And, more importantly, it is
easily extendable: just replace some of the event handlers with
other ones, and you have a slightly different behavior, all from
the same base script.
A specific type of event is the "finishing" of a scheduled action
(which can be anything from a basic one (face this direction) to
a complex one (kill this NPC, finding a path and following him if
necessary)), which can be failed or succeeded.

--
Vincent Penquerc'h