blkerby/MapRandomizer

Map visited/seen information isn't saved properly

Closed this issue · 6 comments

Settings

Generated ROM filename (if available): smmr-v1-1297986910-464593966782127806984477131014152.sfc

Describe the bug

After saving the game and dying/resetting and reloading from the save, parts of the in-game map you had already visited will be randomly lost. (I'd guess this is because the vanilla map routines weren't replaced by the fixed ones in the map patch.)

It also can lose the information when changing areas.
I moved from crateria to tourian and back to crateria, and the map was empty as if I had never been in crateria before.
Then the next time I moved to tourian and back to crateria, it did remember my map exploration.

Thanks for reporting this. We are using a patched save/load routine (https://github.com/blkerby/MapRandomizer/blob/main/patches/src/saveload.asm) but I think there must be something we're missing. I'm suspicious it could have to do with the map view that shows during the loading sequence, because that one seems fairly consistently wrong. During development we've been relying heavily on save states instead of saving/loading the usual way, so it has been easy for us to overlook the extent of the problem.

Earlier on in development we noticed that map data can get corrupted for seemingly unrelated reasons; e.g., it can happen after entering a screen with a red scroll. I think the current issue may be specifically related to saving/loading, although it may not necessarily immediately show up after loading as it may affect a different area than the current one. Will dig in to try to find the cause.

@beauxq I'd be curious if by chance you observed the behavior on a seed where you never loaded from a save before? Crateria becoming empty (or mostly empty, with a few stray pink tiles) does appear to be a common pattern: it happened on Osse's stream both tonight and last night.

There was no loading from a save in this twitch VOD before it happened.

https://www.twitch.tv/videos/1678464276

New game starts at 6:50 in the VOD.
9:25 he goes through a down door into a new area.
13:43 he goes back up that same door, and the map is empty.

@beauxq Thanks, hadn't seen that VOD yet. I've been able to reproduce the problem now by only saving in a new region (without loading) and then returning to Crateria. If I skip saving then the problem doesn't happen, so it looks like the problem happens during the save itself. Getting closer to narrowing this down.

I'm pretty suspicious that the problem is here, where the current area map explored bits ($07F7 - $08F6) are being copied to the area map explored bits for the corresponding area (in $7E:$CD52 - $7E:D551):

SaveMap: LDA $07F7,Y : STA $CD50,X : DEX : DEX : DEY : DEY : BPL SaveMap ;Saves the current map

I think probably the wrong destination area is being used, will just need to dive in a bit deeper to remember how this patch is supposed to be working and figure out how to fix it.

Ok, I tried just skipping that SaveMap loop to see if it would fix the problem. I expected this to stop the current area explored tiles from being saved, but it looks like maybe everything is fine now. It's probably still worth taking a closer look at this patch sometime, but in the meantime I think this is an improvement. Pushed the change in version 3. Feel free to reopen if we see the problem again.