Hooray, a great addition to the game has been finished this week!It is... saving and loading the game! With multiple save slots even:
I have to say, I'm still a little surprised that I actually got it all working. And very suspicious, whenever something just works after I've worked on it for hours I can't help but feel like there's some monstrous bug hiding in the depths just waiting to rear its head and tear down everything. I'm keeping an eye on you, game!
So, pretty happy to have this part working. I remember way back when I first looked up a tutorial on how to create save files for games and load the data back in, and I was fairly terrified by how complicated some of it looked back then. Now it wasn't that bad, a lot of little parts that had to be carefully put together, but none of the parts themselves were hard to do.
Of course there's still some stuff that needs to be added to the save as the game becomes more finished and there's more things to save (and the looks of the save slots aren't final of course, they're just filled with text for debugging help), but for now the saving and loading includes:
-Relevant character stats: Levels, excess exp etc.
-Inventory items and their amounts
-Story progress list (keeps track of scenes you've visited, story scenes completed etc.)
-Player position and which direction you were facing
Btw, if you're like me and had never before taken a peek at what save files might actually look like (one that's not encrypted into nonsense, that is) and are curious about it, here's one from the game in its current state:
Pretty neat, huh? All of those pieces have to first be gathered from all around different parts of the game code when saving, arranged into a neat little wrapper, then read back in from the file and carefully put back in where they belong. Got to make sure the team won't accidentally have all their levels switched around!
That's it for this time. I think next time I'll try to finish another important technical part of the game, resolution settings, since it's kind of needed for testing purposes. I really want to start working on the battle system, but I'm trying to do these less exciting major parts first. That way I hopefully won't work myself into a bag where everything ends up breaking and has to be rebuilt once I finally do get around to them.