itch.io is community of indie game creators and players

Devlogs

Savegame Manager: Today is the Day

Xenodochium
A browser game made in HTML5

The Plan

Is it time? Yeah, I think it's time. I don't wanna! I'm feeling anxiety at the thought of digging into the savegame manager. I'm sure it'll be fine, but I worry about the complexity. I guess that's why I'm typing this out though, so I can look at this complex beast and break it down into smaller chunks. First, I need to look over the existing functionality to make sure I have a good understanding of how it works. And while I'm looking through everything, I might as well make some notes for later!

I started a conversation with Gemini to try to remind myself of the specifics. It actually remembered something I forgot, the player death counter. I went ahead and added that really quick to my playerstats manager and realized I don't even need to change my savegame manager to add new data from existing systems.

What Happened

I was looking over everything as I was adding the death counter and I realized that my playerstats manager just sends a dictionary to, and receives a dictionary from, the savegame manager. All I need to do is update the playerstats manager to deal with additional entries in the data passed back and forth! So that's what I did, I updated the dictionary definition when it's sent to the savegame manager and updated the function that extracts the relevant data out of what's loaded.

The player death counter was easy, but figuring out how to approach the player skin data was a little tougher. Well, I expected it would be tougher, but just like the death count, I copied existing code and modified it to suit my needs. After a little bit of testing I was able to determine that my changes worked without issue. Next up was actually adding the save version to the data. That ended up being really easy to, I just added a single line defining a new key in my save data dictionary.

I'm not sure what happened, but I managed all this time without actually adding my quest data into my savegame manager? I swear it was working before! I don't have a clue why I thought that though, it's obvious it was never set up. I had noticed this before, but at the time I wrote it off as related to other issues I was working on. So, I again copied existing code and modified it. 

I did run into an issue with my HUD not updating the quest objectives after loading them though. That was a decently quick fix though, I just iterate through all the active quests immediately after loading the data and emit a signal for each. This entire session was a lot quicker than I expected, although at this point I wasn't quite done yet.

The last piece was the city state data. I had been mulling over some ideas on how to handle this one, it's a semi-special case. See, the city scene isn't always going to be loaded, but I need the building state data when I save the game. After a short discussion with Gemini, I decided I needed to move my state data out of the city scene and into my savegame manager. Then, change the city scene to call a couple of new functions in the savegame manager to get and set that data.

It took a little bit of work but I think I got it all done. I have middle-man functions and signals in my city scene now to deal with build states but the actual data and control is in my savegame manager. This way, even if the city isn't loaded, the data will be maintained in the save.  With that, I think I've completed what I wanted to today.

What's Next?

I'm not sure exactly. I really need to get to work on polishing a lot of the stuff I've already built, add more to the game itself, and implement some new systems that still don't exist. I think maybe I should work on tackling a basic inventory system next. At the very least it will be nice to be able to push a button to look at what the player has without having to dig around in the editor to find the right variable.

I need to do more work on the UI, like adding icons for active effects, maybe even adding a display somewhere on the character menu. Man, there's so much to do. But today's session was a huge success and it wasn't nearly as bad as I was expecting. 

Leave a comment