itch.io is community of indie game creators and players

Devlogs

Save/Load Functionality

ECO-Keeper
A browser game made in HTML5

The following is part of a bi-weekly update we would be required to do as we worked on our final projects. Some things may require context that is not included or some original post content may be excluded.


Last week I worked on the ability to save the game. I had something set up initially for when I did eventually implement it, but when it actually came to testing it, it didn't work like how I wanted it.

This meant I had to go figure out a different way to save the game. After a bit of searching online, I came across this tutorial by a YouTube channel called Godotneers that explained ways to save a game in Godot.

I watched the video on Thursday with the remaining of my time, and then actually worked on reworking my save system based on the video on Friday. I thought it was going to be difficult as I had developed the project for a while without preparing it for the kind of save system the video showed, but to my surprise, it was easier to implement than I expected.

The save system worked pretty well when I first tested it, with a few minor issues. Some of those was just more properties I had to save or some semantic/syntax issue.

The biggest issue I came across was reloading into save files. When I saved a game and returned to it, changed something, left and then returned to it again, it would load the save before it. I was wondering why this was the case as the results that showed up when researching this kind of issue was that the ResourceSaver should be overwriting the previous file.

It turned out the fault was with the ResourceLoader. When loading a file, by default, the ResourceLoader will keep that file in a cache and derive from it when the resource is asked to be loaded again. So what I did to resolve this was to set the cache flags in the load function to ignore caching the loaded file.

This fixed the issue with reloading files and now the game will always load with the newest version of the save file.

What I want to work on going forward is to finish up the save system and then add the background music my friend made for the game.

Download ECO-Keeper