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)

> 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