Saves, bugs, and dialogue (Patreon)
Content
This week I had to track down a game breaking save bug. This would essentially corrupt the entire save file and immediately crash to desktop whenever that save file tried to load -unless the player remembered roughly where they were on the world map or which interior level, started a new game on that same save slot, then loaded the old save from nearly the same location as the one where the save was created. So yeah, it corrupted your save file.
It also took me a while to figure out how to recreate it. Saving and loading on a clean level would work every time. Dropping a bunch of items in the area and then loading the game in that same area works totally fine and most of my smaller test levels are only on level and would load. Some interiors would save and load regardless. But then others would load until I tried to load from a different interior. I have a couple pages of notes of "did this - still crashes" trying to narrow things down.
What was happening was when the game loads it checks for what data layer the player was on or which part of the world partition to load. Then it loads that and loads the item manager actor that keeps track of all of the interactive items on that layer. If the layer wasn't loaded when the game was loaded it would try to grab a reference to the interactive items in the area but wouldn't be able to find them in the package and set things to none. Then when the layer was loaded it would have a broken reference and crash with a really generic world partition error. But the wrinkle was it isn't all items. Any item the player would drop or place would save and load just fine. This is the part that took me forever to figure out why some buildings would crash but others wouldn't. Because any building with the save volume and interactive items I hand place in the editor would cause the crash. It turns out those hand placed items get assigned to the local data layer (or the data manager grid) but anything the player places get assigned to the persistent layer.
So yeah. I pulled out the local actor reference and I'm just saving and loading data to any already existing editor placed items and so far it seems to all be working. I did break growable plants but I just need to reroute a few things and have it look them up when loading instead of having a direct reference. Oh and there's a duplicating bug too on some interiors which I think is caused by me missing a check to see what is already spawned in the local scene and deleting it or not spawning a duplicate. But those are both minor bugs compared to a crash to desktop and a corrupt save file.
Lol, ok hopefully that's the last major save bug for a bit.
And then I also had to head out of town to do some family stuff for a few days so I've got my laptop with me and I'm working on dialogue trees and trying to get the scenes for the monastery together. I should be back home in the next few days and back to testing and scripting.
Thanks for bearing with me for this one! I'll get the new build out as soon as it's relatively stable which hopefully won't take too too much longer!