All Pages Now In LUA

Been a busy few days, but I can report all the title and game menus from the standalone game are now re-coded as LUA scripts. That’s the title, options, load game, loading, in-game menu, graphics menu, sounds menu, save game, win, lose and next level.  All chains together as before, and tested with a single and multi-level standalone game.  The only missing bit now is the save functionality and the subsequent reload step, which will take a little more thinking.


Initially I was tempted to do a LUA dump, but since found this was my imagination and completely not possible without a heck of a hack, so plan be was do it like before and create a custom file with everything the game needs to restore its progress, and then I had the benefit of writing save and load routines for the graphics and sound settings (which need to retain things like which graphic quality setting, music volume and sound volume).


In writing this, I discovered the wonderful world of LUA file commands.  The current system actually saves its in-game settings in two files, and manages those files when the settings are changed, and uses them when a new game session is launched.  It got me thinking the same commands could be used for the entire GameGuru game progress storage system.  Naturally there is a LOT that is currently hidden from my current LUA system, and from bitter experience resurrecting a game ‘mid-play’ can be treacherous but I have a sneaky suspicion that using the LUA commands as an abstraction layer could produce some very clean code (and more commands for scripters).

Back in the day you just needed to store the players level, position, health and weapon, and you were done. This time, I need to consider things like enemy positions, dynamic entity locations, AI states, LUA globals and a large pot of additional player statistics you probably didn’t even know existed.  I also need a few thoughts on whether I should save the exact body position of ragdolls, mid-animation frame values and transitionary elements.  I know some AAA games don’t, and some even force you back to checkpoint style locations, but I don’t want to rule anything out at this stage.  I was going to add a system which allowed the user to select a slot and give the save position a name, but I am now leaning towards taking a screenshot, and creating an autogenerated name such as ‘Game Save XXX : level ZZZ : Time YYY’ where ZZZ is the name given to the level when it was created and YYY is the internal game time.  This way there are no prolonged typing mid-game and the feature can be coded quicker. I am thinking the screenshot (much like games like Thief and Assassins Creed) will reveal more about the game progress than any text might.  This is the last bit of design work before I get stuck into mining the engine for all the game statistics worth storing.

As my evening is pretty packed, it’s now time to walk the dog, get something to eat, pack and set off for one of the last few meetings of the month which takes place Wednesday.  I have moved my Twitch broadcast to Thursday 4PM GMT if you want to tune in and discover new depths about GameGuru.

  • Nocturnic

    The “graphics settings” menu should also be in the main menu.

    • Lee Bamber

      See Glenn Evans reply as above ;)

      • Nocturnic

        Saw, and sounds awesome.

  • danni

    its wonderful but you need to support utf-8 languages. because of the LUA files of game-guru not support UTF-8 format.

    • Lee Bamber

      See Glenn Evans reply above ;)

  • Glenn Evans

    Many games will ask you to select a save slot at the start of a game. This way you could use your auto save feature saving the date and time details you mentioned onto the end of the save game name. They also have both a quick save and a slower type a new save name style option. I would look at something like that for the basic mechanics.

    I wonder about user scripted settings here. Would you be thinking of a way to add those into the standard save as well? Or are you going to leave it for the user to save that sort of extra data? Not a problem for me, but I reckon a few peeps will discover their custom scripts need a save option to continue to work properly.

    • Lee Bamber

      My plan is to convert the existing title system functionality into LUA script, and add the extra pages for Save and Load. I had the choice of hacking in a save/load page but decided the LUA approach was the correct long-term way. My objective is to add basic save and load functionality via more LUA commands, and from these you can create any variant of the save game concept as you like. This way I can move onto the next feature on the list while the community can modify the template I have set out to their own unique requirements. Things such as Quick Save and Graphics Settings added to the title page will be possible through changes to the script, no worries. UTF-8 support has not been considered, and sounds a little scary, so we might add that to the voting board and see if it gets some community traction (maybe described better though) :)

  • T-Rex

    wow lee this is great :D