lua-users home
lua-l archive

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


Hello Thomas,
A few ideas,

If its only a physics engine you need, then I would wrapper the engine as a Lua library and then just.

require "box"
box.do_something(....)

The simplest way to do that is to let SWIG (swig.org) auto generate the bindings for it (but then I'm biased, since I maintain SWIG). Other tools are ToLua, ToLua++ or LuaBind, or handroll it yourself (if its not too big).

If you are working within a bigger engine (which you seem to be doing), its still the same kind of idea. You need some kind of wrapper around the parts of the engine you want Lua to access.

Then what you do is within your game engine you would create an interpreter, load the libraries you need (including your physics engine), load your game logic script and call some functions in that script at the applicable moments (like every cycle).

Hope this gives you some food for thought.

Regards,
Mark

> Hello again.
> 
> [insert subject]
> The physics engine is Box2d. ( box2d.org )
> 
> This is my current idea for doing this:
> 
>     1. Bind a lot of functions/simple classes into Lua. 
>     2. Build the rest of the physics engine in Lua.
> 
> But this is a somewhat large physics engine, so I'm not
> sure of I would be able to do all of this within a
> reasonable time-span.
> 
> Would something like ToLua or LuaPlus be able to port the
> whole engine without me having to type an extra 5,000 lines
> of code? ( I can type pretty fast, but I don't want to
> spend long nights debugging and such. )
> If so, could someone please direct me on how to do this?
> 
> Thanks,
> --Sgt. Sparky
> 
> P.S.
>  If I could get a few people who know how to script in Lua,
> that would be nice. I need a few testers by Dec. 25th to
> test out my game engine.
> So far, I've had 6 different people come to me and ask
> if they could test it out. I've said yes, but none of
> them know how to program in Lua yet.
> So if a couple of people (At least 2) could test it out,
> that would be nice. :D :D :D
> 
> I hope to have the documentation created by the first
> release. :)
>