How should i structure save data for metroidvania upgrades and map state?
#1
I'm trying to implement a proper save system for my metroidvania prototype, but I keep getting stuck on how to handle the player's collected upgrades and map state between sessions. My current method of just dumping everything into a single JSON file feels messy and is starting to cause bugs when loading.
Reply
#2
I finally split the save into small pieces. Player data in player.json, upgrades in upgrades.json, and map state in map.json. It was messy at first because I tried to keep a lot of cross references in memory, and loading would fail when some pieces were missing. Having a tiny header with a version number helped me spot mismatches, and I kept IDs for upgrades so the map only stores unlocked upgrade IDs instead of full objects.
Reply
#3
Yeah, one big dump started as convenient until loading started breaking when the shape changed. I started saving different parts at different times: upgrades on pickup, map exploration when you enter a new area, stats on exit. It cut down the bugs, though you still chase edge cases like what happens if you load mid-transition.
Reply
#4
Are you sure the problem isn’t the data shape? I moved to storing upgrades as a list of IDs and map state as a separate explored set. It felt slower at first, but the saves loaded more reliably and didn’t carry stale object data.
Reply
#5
Sometimes I drifted off and saved a whole scene snapshot that I never needed, then realized the save path didn’t cover it anymore. It makes me wonder if the real issue isn’t the save file itself but how and when you serialize during transitions.
Reply


[-]
Quick Reply
Message
Type your reply to this message here.

Image Verification
Please enter the text contained within the image into the text box below it. This process is used to prevent automated spam bots.
Image Verification
(case insensitive)

Forum Jump: