save system for Blitz3d?

Blitz3D Forums/Blitz3D Programming/save system for Blitz3d?

MadJack(Posted 2006) [#1]
I seem to recall someone posted that they were developing a save game system and that it would handle animation states etc...

Does this ring a bell with anyone?


OrcSlayer(Posted 2006) [#2]
Hmmm, seems like save game systems are very project dependant. I've just recently started working on my own and it's so closely tied with how your game works, I'm not sure a generic system would be all that helpful.

Perhaps a tutorial suggesting ways to create a save game system would be the best thing someone could do...

My system is a bit hackish, it basically loads the map the same way it normally would when you first play them, but discards the object data (since objects can be created and deleted often during play, the initial object sets are worthless for loading saved games) and creates the objects as they are stored in the save game file. So, basically the save game file is a reference telling it which map file to load, and then a long list of object information telling it what to create, and what AI state, frame of animation, etc. to apply to them.

When it's done, put player in control of the player entity (or return a big massive killer error if none was created for some reason...dumb file hacker maybe), and off you go...


MadJack(Posted 2006) [#3]
Hmm. I suspect it's a bit more complex than that.

For example, restoring soundfx. If you have looping soundfx/music that had been triggered previously, you'd need to make sure it was 're-triggered' and also set to where it was when you saved.

Particle effects - often 3rd party libs. Again you'd need to make sure any emitters were restored, preferably to the emitter age they were when saved.

You'd also need to save Global variable values etc... If any of your vars are pointers, you'd need to match them up with the new pointer values as you recreated entities, sound channels or images you may have created in-programme.

What a pity Mark didn't include Save_state/restore_state commands...


jfk EO-11110(Posted 2006) [#4]
A savegame function can only be implemented properly if you add this feature from the very beginning on and develop it parallely, step by step.

It would be smart to load only the parts that have chanched, during the game. This seperates games that have unbearable loadin times from decent ones that allow to try it again after a few seconds.


OrcSlayer(Posted 2006) [#5]
Well, if you want to go as far as save the place of a sound effect...wow. That's a little excessive. Saving the state of the entire program is way more complicated than a simple save game system.

When I call up a saved game, it will load all the data needed to get the game back on track, but I won't save stuff that will only matter in the first second of gameplay. It would just be too overwhelming to keep track of it all...


jfk EO-11110(Posted 2006) [#6]
well, in theory you could save a raw image of the allocated ram, vram and audio cache, basicly everything, and then simply restore it, BUT I'm pretty sure there are several reasons why this works only in theory. One of them may be windows won't allow to restore RAM at a fixed adress, but provides RAM in a "Use what you get" way.

Oh, how simple and wonderful where the days of Atari ST or Amiga 500, with one Megabyte ram or so. Simply write the RAM to the harddrive, then write it back on demand. The lack of multitasking had at least one positive aspect.