Today I'm doing things a little different. I'm starting my dev log before I actually start any coding. Today's session is being livestreamed on my Twitch channel, and I'd love for you to join me! The way this will work is I'll just keep updating this dev log as I progress, and once I've finished for the day, I will make it clear I'm done.
Today will hopefully be a big day. I'm hoping to get the save (and possibly the load) functionality built and working today. I know, I know, this is going to be a very complex system. First thing I need to do it look over what already exists in relation to the save game functionality. Many of the systems I've build already have some setup put in place for saving and loading game data. But I'm not sure yet if it's quite ready for prime time. The specific systems I'm thinking about are the time handler, inventory manager, the playerstats manager, and the hardest of them all, the data manager. So let's just dig into the specifics of the way the different systems are already setup.
The time handler is probably the simplest of them all. To "load" time data, we just feed a float value to its load_game_data() function. There is currently nothing built to address saving the time currently. Luckily, all of the time data is based on a single float value, and all I really need to do is expose one of my variables (change the name, I guess, to denote it being publicly accessible). So now the savegame manager just needs to grab time_handler.real_world_seconds_elapsed and save that, very simple.
Next up is the inventory manager. Looking at this, there are still some changes that need to be made in regards to item storage. The inventory manager needs to be completely redone prior to dealing with saving data. Right now it's still setup to house two completely separate inventories. So, I'm starting there, I'll feed the current instance of the inventory manager into a Gemini window and direct it to simplify the script and remove the excess stuff.
And that's exactly what I did. I fired up a new chat instance with Gemini, fed it my existing inventory manager, and told it what I wanted. I started out with a simple discussion of the specifics and told it to ask me clarifying questions. Once I was confident the AI understood my goal, I had it output the updated script and everything was ready. So, with the inventory manager simplified and ready to save and load, it was time to move on to the next system.
The playerstats manager is a bit of a beast. Luckily, I think my planning ahead really paid off here. There's already a single function, get_save_data(), that returns all the data that is being managed by the playerstats manager. I was really expecting to have to do a lot more with this one. Makes me feel pretty good about my process.
The last one though, the data manager, that's gonna be a toughie. It was built without the expectation of needing to save any of its data. Right now it has nothing in regards to loading or saving data. That means two functions, one to load and one to save. Now I do the same thing as before. I fed Gemini the script to update (along with the item definition for reference) and told it what I want it to do. Since there is no code yet to define these procedurally generated items yet, I can make design decisions now to both help simplify what I'm doing with the data manager, while also preparing for the future.
As part of this, I decided that I will tag these items as "Unique" and use that as my identifier for which items get saved and loaded. This means, when I actually build out the item creation procedure, I will build in a check to make sure that the item does not exist (at the very least, the ID used needs to be unique). After a brief discussion, Gemini gave me what I asked for. No errors, no corrections needed. Nothing but net!
So that just leaves building the actual savegame manager and it's save/load functionality. I wasn't sure how exactly to proceed. I started by asking my original Gemini chat instance for information about how we planned to build the savegame manager. But, of course, it didn't quite work right. So, I took the output and modified it slightly (updated it for accuracy and added clarification) and fed that into a new chat instance. I feel like starting from a fresh chat will prevent any accidental "spillage" from my planning.
This one took a lot of work because there are a bunch of moving parts here. The initial output was promising. I had to make some modifications to my game manager to actually kick off a save. Some slight modifications to my load save game dialog, to account for the actual inner workings of the save functionality. Then game iterative testing where I'd save and load and work through all the errors introduced by the AI, mostly data type mismatches.
In the end, it was mostly working but there are still some issues to address next time. Specifically, my playerstats manager is consuming hunger during the load process (I think) and I need to update the load save game dialog to account for deleting a save game. Right now, if I delete a save game it doesn't update the visuals to account for this. But this has been a HUGE leap forward in my game. I'm so happy with what's been done today, and it only took two and a half hours!
In case you're reading this after I'm done and missed out on the stream, you can watch the vod here. The last thing I did, after ending the stream, was update my "current" Gemini chat instance with what I accomplished and what still needs to be done. I think I'm actually going to feed this dev log to the chat so it can get a better understanding of what was done.
Did you like this post? Tell us
Leave a comment
Log in with your itch.io account to leave a comment.