Saving the Game


Hi, I'm back at it again with a feature that is quite necessary for this project, which is saving. The way I have implemented saving is by having a text box you can copy and save to a file and then copy and paste into a text box to load the solar system and player state. The position of all the planets and the ship will be the same as when saved and the planets resource amounts will also be the same. You will spawn in the same position, with the same velocity, fuel, health, items, and money.

This ended up being easier then I expected as I just had to convert my objects into JSON formatted strings and then encapsulate that in another JSON formatted string. For good measure I also did another encapsulation with the raw game data and a cyrb53 hash, so you can't just go in the save file and fudge the numbers.

I also made it so when you shoot chunks off a planet they don't go flying so far.

Leave a comment

Log in with itch.io to leave a comment.