• Hey Guest! Ever feel like entering a Game Jam, but the time limit is always too much pressure? We get it... You lead a hectic life and dedicating 3 whole days to make a game just doesn't work for you! So, why not enter the GMC SLOW JAM? Take your time! Kick back and make your game over 4 months! Interested? Then just click here!

Windows Save/Load game.

Fredrik

Member
First of all I know that using game_save(file); and game_load(file); is a overall bad idea, and I've used ini for previous game projects, but I'm already far into a game project and there's quite alot having to be stored in a ini file and it would take alot of time to create it, so I decided to just give game_save/load a try to se if it actually saved what I wanted to be saved, and it did! It works perfect! I was really worried on how I'd manage to save certain things in my game, and finding out that game_save/load just worked, as simple as that! was really enjoyable. But there is a problem..

I made a simple save/load system just to try it by pressing C to save and V to load.

Code:
/// Save/Load gamefile.
if keyboard_check_pressed(ord("C"))
    {game_save("Save.dat");}
   
if keyboard_check_pressed(ord("V"))
    {game_load("Save.dat");}
and it works well. But if I close the game and then boot it up again, and then press V to load the file being saved before I closed the game it's suddenly all different, instances are out of place, textures are all messed up and so on.

Does anyone have a good explanation for this? or perhaps a good structure for setting up a good ini save system.

*Saving gamefile "C"*


*restarting the game and loading gamefile "V"*
 

Llama_Code

Member
games save does not save/load dynamic resources like surfaces and such.

Anything like that in the game, you will need to check and see if the game has been loaded from a save and re create it.
 
Top