lua-users home
lua-l archive

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


> From: "Nick Davies" <goodbytes@binarysurge.com>
> > Greetings! I'm using Lua in a game project, so, naturally, I'm worried
> about
> > speed of execution.
>
> I'm dealing with the same sort of issues in my project.  What you need to
do
> for any interpreted language is to have the scripts set up the room, set
up
> what triggers are in the room, and which Lua script to call for each
trigger
> event.  C/C++ should run everything until a trigger occurs (C/C++ does all
> the trigger checking), then calls Lua only when something actually
happened.

I'm not actually going to have that many triggers in a room. Like... one
would be above average. Two would be like... holy cow.

Your suggestions are good. If I run into a problem with efficiency later on,
I'll look into it. I know that if it turns out that your method is
necessary, it will be a lot of work to change everything, but the way that
I'm doing things is already pretty optimized. An entity's update procedure
is essentially going to be responding to messages from other entities, which
are sent through C++. I could automate this somewhat, but I don't think that
will be totally necessary. Animation is handled through C++, as is sound
effect playing by entities and collision detection/message sending by
entities.

Besides, my drawing code is pretty optimized, so I figure I can afford to
spend a few extra cycles on the logic :)

The 'indexing globals as locals' thing was pretty much a quick fix, so I
just thought I'd try it out.

~Nick