Back to Roots: Savegames, Monsters, and LUA
In the first of three recent posts, Fearyourself announced that he’d made some improvements to the save game system for his game engine project, Back to Roots. In that same post, he also gave details about a new system that he had finished crafting for the engine: automatic monster generation during area map loads.
This allows us for example to have west brittany filled with monsters that are randomly spaced. The thing I would like to do however, is allow a Npc to request the addition of those monsters in a given map. This will allow a Npc to say :
“Oh no, you must go to West Brittany and clear up the monsters!” and then the monsters will appear there, which for me is the first step to getting a full scripting system for the Npcs.
Shortly thereafter, he began to experiment with the use of LUA scripting to see if it would be useful in creating different scenarios, such as NPCs who will only speak to you if you are wealthy enough or if you’ve killed enough monsters. Within a day, he was reporting success with both of those conditions.
He is also transitioning his version control system from SVN to Git, for those who are interested in such details.
Good work. My only suggestion is to create a framework within your own app, of your own routines and try to make them as logical and reusable as possible. Not too many, not too few, and things will start to have a natural balance.
I haven’t messed around with LUA (didn’t Far Cry use that?), but definitely don’t let it lead you astray if it starts demanding too much complexity. Nothing quite like getting bogged down with a bunch of tedious shit when you’re just trying to get some work done.
Looking forward to further progress, so keep kicking butt!
CUO uses Squirrel scripting, which supports classes and looks almost identical to C++. I’d definitely consider it as well while you’re trying out LUA. http://squirrel-lang.org/
My preference, as with many things in life, is to roll my own, though Squirrel sounds good from the web site and has a cool name.
Nuvie uses Lua quite extensively (for combat, magic, worktypes). It’s a great lightweight embeddable scripting system.
I’m also planning to do the cut-sequences in lua scripts too.
Eric
Thank you all for the comments and support!
Yeap, I actually have already created my skeleton of interface between both LUA and C++ and I quite like how I’ve done it. It gives the view of the engine that I want and nothing more, keeping what a script can do to just that: a script.
For the moment, I’ve got two characters sending the player out and about and I think it will show the advantages of how I’ve done things.
I had thought of using SWIG or luabind but never Squirrel, I’ll have to look into that as an alternative.
Anyway, I should be getting a video out in the next couple of days once I’ve finished polishing out certain details 🙂
Jc