LUA and C++ in Game Scripting
Hi,
after I've got lua5 working, I played around and tried diffrent stuff. But there're some thing pretty unclear. Maybe someone could help me?
The main problem for me is part of the lua registration process. I havn't found a answer in a tutorial yet, but how can I bend c++ methods/member calls to lua cause the lua functions have to be static and only a lua_state parameter. In which way could lua_bind help me here? What are pros & cons?
One requirement for my scripting interface is a realtime exceution. If a script is called within the game and the running script should make changes to the world while the game runs. I thought about the possiblity to start a script in a new thread. But I havn't much experience in this part. Does someone know a tutorial regarding this issue? What problems will inescapably occur when trying to script "realtime"? I'm asking cause I've simply not much an idea of how to desgin this.
thanxs for your help
[edited by - quasty on February 25, 2004 5:39:44 AM]
quote: Original post by quasty
The main problem for me is part of the lua registration process. I havn't found a answer in a tutorial yet, but how can I bend c++ methods/member calls to lua cause the lua functions have to be static and only a lua_state parameter. In which way could lua_bind help me here? What are pros & cons?
This forum has covered this fairly recently. The easiest way is to pick a technique, generally luabind or tolua and have a shot.
Wait and see what kind of performance you can get out of lua coroutines before you bite off too much. Setting your scripting stuff up is pretty easy - getting it to the point where you're happy with it can be much harder (at least it was for me).
Problems embedding Lua
http://www.gamedev.net/community/forums/topic.asp?topic_id=205677
Differences between luabind projects
http://www.gamedev.net/community/forums/topic.asp?topic_id=206187
How to build luabind
http://www.gamedev.net/community/forums/topic.asp?topic_id=206430
Passing objects to lua via luabind
http://www.gamedev.net/community/forums/topic.asp?topic_id=206285
[edit]typo[/edit]
[edited by - XXX_Andrew_XXX on February 25, 2004 6:24:43 AM]
Thanx - I''ll look into it.
I''ve read a kind of "luabind is for c++" and I''m not pretty sure of the real benefits of luabind.
The only thing I know that I havn''t understood it yet and also that it seems to be kind of fat!? I''ve build a release build of luabind with vs7.1 and its 2.3MB big - and I''ve to use Boost in addition. The Boost Headers are 1800files and 12MB big. Is this really necessary?
I''ve read a kind of "luabind is for c++" and I''m not pretty sure of the real benefits of luabind.
The only thing I know that I havn''t understood it yet and also that it seems to be kind of fat!? I''ve build a release build of luabind with vs7.1 and its 2.3MB big - and I''ve to use Boost in addition. The Boost Headers are 1800files and 12MB big. Is this really necessary?
I''ve got lua and luabind in a current project, it added around 200k to the final release exe (from 135K to 300K) which imo is a small addition for scripting system built in and linked to C++.
luabind is all templates so its going to add some thing to your final build (although i''m not sure where you got the 2.3meg size from?), same goes for boost (well, some parts of boost need lib files or dlls as well), which i''ve also used a fair amount in this project (where did you get the 12meg size from?), and the stl, as you can see, it still come out at sub-200k with boost and stl, infact lua and luabind add the most (but that could be down to my useage of a staticaly linked lua.lib files mostly).
luabind is all templates so its going to add some thing to your final build (although i''m not sure where you got the 2.3meg size from?), same goes for boost (well, some parts of boost need lib files or dlls as well), which i''ve also used a fair amount in this project (where did you get the 12meg size from?), and the stl, as you can see, it still come out at sub-200k with boost and stl, infact lua and luabind add the most (but that could be down to my useage of a staticaly linked lua.lib files mostly).
Hi, the luabind lib I build (release) is 2.3MB big. And it also needs the boost Headers to compile (12MBs and a lot of files). But thats not the real problem
Here comes the real problem: I''ve read a lot in the board on this topic, but I couldn''t get through. My current approach is creating a Class (CLuaInterface). Whichs handles the execution and later (hopfully) the co-routines of lua-scripts. I can register function of the namespace via luabind but I cannot call them cause I have no reference to an instance.
The way I hoped it could work would be creating the class structure of the engine in lua. At the init of lua get a reference of my super-class and on that basis lua/luabind could access through the class structure. But I''m a bit helpless with that cause I''m not reallysure how to begin.
My goal is to script virtually everything the engine can do - but that seems to be a long way to go.
Any further guidance or suggestions? Thanks alot...
Here comes the real problem: I''ve read a lot in the board on this topic, but I couldn''t get through. My current approach is creating a Class (CLuaInterface). Whichs handles the execution and later (hopfully) the co-routines of lua-scripts. I can register function of the namespace via luabind but I cannot call them cause I have no reference to an instance.
The way I hoped it could work would be creating the class structure of the engine in lua. At the init of lua get a reference of my super-class and on that basis lua/luabind could access through the class structure. But I''m a bit helpless with that cause I''m not reallysure how to begin.
My goal is to script virtually everything the engine can do - but that seems to be a long way to go.
Any further guidance or suggestions? Thanks alot...
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement