zumwalt Posted April 28, 2013 Share Posted April 28, 2013 I would like the ability to use LUA script while the game is running, I am writing all my game code in C++ and I have the need to be able to give the user an in game interface where I will give them a command reference library, they then write tiny code segments that give life to objects and have the ability to save and share their files that are specific to the game. I need four basic things to begin with LUA::Load(FileStream or ByteStream) LUA::Run(Object) LUA::Destroy(Object) LUA::Save(FileStream or ByteStream) All files would go in the game directory, or database like MySQL or SQLLite. Most likely the way I am gearing the game for portability, they would land in MySQL on a hosted server. I will be defining construct shells such as Patrol, Search, Flee, Attack, Defend, Harvest, etc, the user codes these based on modules they enhance their game objects with, such as if they have a Radar attached in the Patrol sequence they check Radar and see if Enemy is present, if so depending on the Radar level, as in Level 1 has basic information about the enemy but maybe not enough to know how powerful they are, they can make the code change the state from Patrol to Attack. Then in the Attack sequence if the enemy is pounding them they can change the state based on current shield or armor percentage left from Attack to Flee, so on and so forth, but they would have to code all this logic themselves based on my script library of commands. Quote Link to comment Share on other sites More sharing options...
Rick Posted April 28, 2013 Share Posted April 28, 2013 You can do this if you bring in LuaJIT library (I think it's like 1 source file). In LE2 I know I mixed my own Lua stuff with LE's just fine. Quote Link to comment Share on other sites More sharing options...
zumwalt Posted April 29, 2013 Author Share Posted April 29, 2013 I need it to be native so that it is portable to Android and Apple devices though, not just Windows. Otherwise I would have to roll my own language, I just don't have enough time to do that. Quote Link to comment Share on other sites More sharing options...
Rick Posted April 29, 2013 Share Posted April 29, 2013 Lua/LuaJIT is just a single (maybe 2) source (normal C) file. As far as I know it runs on Android and iOS as is. I still think you can just bring the source into your LE project and you should be good. Quote Link to comment Share on other sites More sharing options...
zumwalt Posted April 29, 2013 Author Share Posted April 29, 2013 Will look it up tomorrow then and play with LuaJIT and see if that will do what I need to do, at the moment I am concentrating on getting Photon to work with Leadwerks natively, I want to show some demo's of Photon and MMO layout if I can get it to work but the LUA piece is more of a wish to have item with native support, here is to hoping what you are talking about will work. Thanks Rick. Quote Link to comment Share on other sites More sharing options...
Josh Posted April 29, 2013 Share Posted April 29, 2013 See the header file for the Interpreter class. There's a lot going on under the hood that you can access. 1 Quote My job is to make tools you love, with the features you want, and performance you can't live without. Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.