lua-users home
lua-l archive

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


Hi,

I'm new to Lua, but looking at it as an embedded scripting language 
for a personal game project. Having looked through the docs and this 
list, I'd like to ask how other people structure their game around 
Lua? 

My project is intended to be an evolution of Paradroid (a C64, then 
Amiga/Atari game from 1990 or so) - the basic gist is that there are 
a lot of NPCs (robots) that have different behaviours, which I'd like 
to be able to script. My current plan is to have 'events' within the 
game loop like Collided, SeenOther, NewTerrain, Damaged that give the 
robots a chance to react by manipulating their internal state and 
calling an 'API' to influence the game world (fire their guns, open 
doors, call other robots), along with some standard methods for 
moving, drawing and so on, called once per turn. 

What I'm not sure about is how much write in Lua and how much in C, 
and whether I want a Lua instance per NPC (there could be hundreds), 
or just to pass in some NPC-state to the same instance.

What's the typical impact of a Lua instance in terms of memory, for a 
series of small (<30 line) methods? My platform (Sega Dreamcast) is 
relatively memory constrained, so this could be a deciding factor.

Thanks in advance for any illumination, (and apologies for all the 
basic questions!)

Regards,

Howie