lua-users home
lua-l archive

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


I'll tell you of what I'm doing (a sort of game engine too), hope it helps.

I'm developing a game networking library (http://zige.sourceforge.net).
I wanted to integrate scripting with net code, so you could make a
client-server game where the C++ part of the client just knows how to
download and run a script, and this script contains functions that
can actually talk with the server (the up-to-date version of the game
protocol).

I build the library as a C static library. The library contains my code,
and all the code for the Lua system and it's default libraries (lua and
lualib). I've just taken Lua's sourcecode and told the compiler to eat it
together with the net code I actually wrote. I was planning to add
some sort of "layer" on top of the Lua VM to provide some facilities
and "integrate" the scripting with the net code, but I haven't done
this yet.
because it turns out that I could take Lua as-is and already
accomplish a lot of stuff.

so my recommendation is, get Lua, integrate it into your engine's
souce code, and start using it. Use it into your engine code and
into your game code. After, you may look into some Lua wrappers
(Glua, tolua, etc. -- see http://www.lua-users.org) and see if they
help you. OR go on and write your own "layer" on top of Lua -- but
don't expect to come up with something useful before writing
some Lua code and using the Lua C API for a while...

just my two cents! hope I haven't drifted (too much) from the
question!

[]'s
Fabio

On 26 Jan 2003, at 21:32, James Turk wrote:

>     Hey, sorry if this gets asked a lot (I imagine it might)  if it gets 
> asked a lot just point me somewhere it's been asked before and I wont 
> bother the list with my question.  I'm making a general purpose game 
> engine in C++ and I'd like to have a way for users to run scripts. 
> Since I'm having a hard time putting the full idea into words I'll show 
> you an example in psuedocode.
> 
> --test.cpp--
> int x,y;
> ...
> /*perhaps something is needed like engine->ExposeVariable(x);*/
> engine->RunScript("test.lua");
> ...
> 
> --test.lua--
> if(x > 0)
>      y = 1;
> else
>      y = y*2;
> 
> I apologize for the lack of detail in my question, but as I said I'm 
> trying to make a general purpose engine, I started to look into lua a 
> long time ago but never went far, and I'm under the impression Lua would 
> be a good choice to integrate with the engine.
> 
> If anyone can tell me if this is even possible I'd be glad to hear it, 
> and suggestions on resources are more than welcome.
> 
> 
>     Thanks,
>        James Turk
> 
> --
> http://conceptofzero.net/
> 
> 


--
[]'s
Fábio R. Cecin
frcecin@terra.com.br