BTW, snapshot of a lua project in progress

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

BTW, snapshot of a lua project in progress

David Jeske-2
I've started to put up snapshots of my game-in-progress. It uses lua for
sprite definition, object physics, object AI, keyboard handling, lots of
things. It isn't done yet, so right now it's alot more cool object stuff
than it is a game.

Right now the Lua cost is a little messy because I'm again changing some
of the Lua/C boundaries. Most of the relevant stuff is in "obj_tnk.lua".

You can enter lua commands directly at the game console by preceeding them
with a single quote ('). Just do a ('printGlobalVariables()) and scroll up
using PageUp, and take a look for the (C_xxx) functions. I apologize for
the lack of framerate display in the most recent snapshot, it'll be back
soon and I assure you it's quite fast. :) Please read the readme file
before downloading, it'll tell you what the keys are, etc.

http://www.chat.net/~jeske/Projects/HZ/

The most impressive lua stuff is:

- sprite definition takes advantage of Lua's powerful table initialization
  syntax. Thus you can specify images for arbitrary layers, arbitrary
  states, arbitrary directions for a sprite to face, and the C engine
  dosn't know anything about any of the specifics (except layers, which it
  must know how to render) 

- framerate independent object physics is all in lua, in the object's
  doTick

- it uses a prototype based inheritence for objects using parent slots

- built in game console with access to lua. Just precede commands with
  a single quote:
   'C_setmapsquare(0,0,15); -- x,y,tile type
   'C_addsprite("heli",10,10,0.08,0.09); -- type,x,y,vx,vy
   'printTable(srvobjs);
   'printTables(srvobjs[0]);
   'printGlobalVariables();
   'srvobj_types.flag.frame_time = 2; -- speed up the flag waving
   'srvobj_types.flag.frame_time = 300; -- slow down the flag waving

   "printTable()" prints a table but does not recurse
   "printTables()" prints a table and does recurse

- key events for controlling units is completely in Lua. The sprites just
  get subscribed to my C++ side event handler chain, and when you hit a
  key it is pushed all the way down to Lua, where the main object 
  see the key and adjusts it's movement appropriately.

- object properties all in lua, the engine knows nothing about such things
  as 'damage', 'speed', 'weapons', etc. Right now your mainship has
  a 'bullet_type' which specifies what type of object you fire as bullets
  it comes up as 'heli', so when you press a fire button, the lua key 
  handler for your object uses it's own 'bullet_type' variable to decide
  what kind of object to place in the world, and it uses it's own internal
  'imgdir' variable to determine what direction you are facing, and thus
  what velocity/direction to shoot the bullet (heli) out at.

-- 
David Jeske (N9LCA) + http://www.chat.net/~jeske/ + [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: BTW, snapshot of a lua project in progress

Steve Dekorte-2
>I've started to put up snapshots of my game-in-progress.

This doesn't use my archiving code does it?

Steve