[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: RE: Game oriented usage of Lua?
- From: "Vincent PENQUERC'H" <vpenquerch@...>
- Date: Mon, 31 May 1999 08:46:37 +0100
David,
> > This table is composed of data and function fields. The only data
> > field known to C++ is set at the object construction, and is the
> > 'owner' field, initialized to the C++ pointer to the object (a Lua
> > userdata). All other data fields are left to the use of Lua scipts.
>
> That sounds similar to how my stuff works...
This does not surprise me, I tried to get my inspiration from C++
classes (as well as the C++ callback system that I had before moving
to Lua) :) An already working conecpt that I am comfortable with
the basics, and which I tried to adapt to Lua (hence the 'owner'
field that acts as the C++ 'this'). I'm glad to see that this is
being thought as a worth idea by someone else :)
> I also have a multiple inheritence scheme I used to construct objects
I did not. In my project, Lua is far from being the bulk of the code.
Its purpose is just to be a scripting language to assemble building
blocks written in C++... I guess (from seeing the example that you
put afterwards) that Lua is a major part of your game logic.
However, I am in the process of making more and more of Lua going
in the game logic. For example, missiles are (or will be :)) entirely
Lua controlled (allowing a 'magic' missile to have a weird trajectory
or things like that (these sort of exceptions I would not want to be
hard coded, only the basic 'standard' behavior being hard coded and
Lua being able to override it))
> out of smaller components I call traits. (The 'traits' term is
> borrowed from the Sun SELF language) For example, below is my
> helicopter object, notice the traits listed in the _parents line and
> the VisualRep pointing to the VisualRep table. The way I handle
> defining Visual Representation is worth an email in itself, so if you
> are interested after what you see below, go check out this URL:
>
> http://www.chat.net/~jeske/Projects/HZ/docs/sprite_definition.html
>
I've not gone to your HZ site yet, lack of time... I'll point at it
asap :)
[big code sample snipped]
I'll have a look at this heli code too. It might give me some ideas,
because I've done almost nothing in Lua scripting yet, all the logic
is ready (C/Lua table handling, event functions, etc), but only a few
dozens lines of Lua scripts are done).
Vincent Penquerc'h