Zip Destinations - What the game actually does
Guides
/
Zip Destinations - What the game actually does
Updated 3 years ago by Elite_Soba

Gonna try to explain this so anyone can understand regardless of technical background, but needless to say having a computery background probably helps. An understanding of hexadecimal is somewhat crucial.

Everything is Little Endian meaning 0x12345678 gets represented as 78 56 34 12 Every room has a list of doors each 16 bytes in length A First 4 bytes: The destination B Next byte: x tile-level coordinate of door (ex: save room is 1x1, a long hall would be like 4x1. top left of room is (0, 0). -1 is FF) C Next byte: y tile-level coordinate of door D Next 2 bytes: x coordinate offset of where Soma ends up (mostly 0000 or FFF0) E Next 2 bytes: y coordinate offset of where Soma ends up (often, but not always FFD0 when going left/right, 0030 when going up, and 0000 when going down) F Next 2 bytes: x tile-level coordinate of location where Soma ends up (only the first one really matters because no room has that many tiles) G Next 2 bytes: y tile-level coordinate of location where Soma ends up H Next 2 bytes: 0000 padding?

So it becomes: A3 A2 A1 A0 B0 C0 D1 D0 E1 E0 F1 F0 G1 G0 H1 H0

Now when I say a room has a list of doors, what it really has is just the location of the first door and the knowledge of how long the information associated with a door is. When Soma leaves a room, the game looks at his tile coordinates to see which exit he took (for example, leaving out the left of a 1x1 room would end up at (-1, 0) -> FF 00).

Starting at the memory address of the first door, the game adds 4 and 5 to get the x and y coordinates associated with that door and if they match, they recognize that as the door you went through and proceed to take you to that room. If it doesn't match, the game adds 16 to the first door address and then repeats the process for the second door. If that doesn't match, it'll add 16 again and so on and so forth, until it finds the correct door. Put concretely, if the door list starts at 0x00000000, the game will look at addresses 0x00000004 and 0x00000005 to search for an x-y match, and move on to 0x00000014 and 0x00000015, and onto 0x00000024 and 0x00000025, etc. This also means that the locations where the rooms are located on the map have absolutely zero bearing on where an exit will actually take you.

Now this method generally works because each exit you can go through is usually tied to a door in the list. With zips (and 0HP), however, we go through unintended exits, so the game just keeps searching well beyond the limit of its normal door list until it either finds a door from another room's door list that matches, or we run out of data and the game softlocks with a black screen. There's also a chance that some other non-door related data just happens to be in the correct spot, but most of the time the preceding 4 bytes don't correspond to a room anyway so it still probably softlocks.

One further complication is that not every room's door list is aligned the same way modulo 16. In essence this means that if one room starts peeking into the door list of another room, it might be offset slightly so it thinks that what's supposed to be A3 A2 A1 A0 is actually B0 C0 D1 D0. Ultimately rooms can be divided into 4 types: 0-aligned, 4-aligned, 8-aligned, and C-aligned because the door list starts at 0xXXXXXXX0, 0xXXXXXXX4, 0xXXXXXXX8, or 0xXXXXXXXC respectively. A given area only seems to have rooms ending in 0 or 8, or rooms ending in 4 or C. So when you zip out of a 4-aligned room, you're likely to emulate exiting a different 4-aligned room in that same direction.

Now since the game only goes downwards when looking through the door list, that means that you can really only zip from earlier locations to later ones. Areas are organized as follows: Castle Corridor(4/C) > Chapel(4/C) > Study(4/C) > Dance Hall(0/8) > Inner Quarters(0/8) > Floating Garden(0/8) > Clock Tower(0/8) > Underground Reservoir(4/C) > The Arena(0/8) > Top Floor(0/8) > Forbidden Area(0/8) > Chaotic Realm(4/C) > (Unused?) Boss Rush(0/8) > Different Boss Rush(4/C) Each area also has a hierarchy among the rooms but there are over 300 rooms so it isn't really worth going into that much detail.

Example: I'm going to be using the zip we do in Any% to go from Underground Reservoir after getting the Claimh Solais to Chaotic Realm. I'm using LagoLunatic's DSVEdit tool (https://github.com/LagoLunatic/DSVEdit) to help derive room info and reading the game data using HxD. Subtract 0x080000000 from addresses to get where you need to look in HxD.

So the room in question is room 0x0851B81C and its door list starts at 0x0851B7FC. Here we see two door entries: 0C BD 51 08 FF 00 00 00 00 00 10 01 00 04 00 00 90 18 52 08 01 00 00 00 D0 FF 00 00 00 00 00 00 The first is the left exit and the second is the right, but we go up out of this room. Now the tile-level x-y coordinates for the first door land on 0x0851B800 and 0x0851B801. We want to search the rest of the file to see if the digits 00 FF show up later at some unspecified 0xXXXXXXX0 and 0xXXXXXXX1 addresses. I don't know if HxD has a good way to do this so I just manually searched for the hex digits "00FF" until I found a match that happened to be properly aligned. It takes a while, but eventually we find a match at the address 0x08522040 (0x00522040 accounting for the 0x08000000 offset mentioned earlier). The door in question is here: BC 1F 52 08 00 FF F0 FF 00 00 00 00 00 00 00 00 So we see it takes us to room 0x08521FBC, which we can check in DSVEdit to see is the room we end up at in the any% route.

NOTE: With this methodology I can only find an explanation for entering rooms through a direction that normally has an entrance. There's an exception where if a room normally has an exit where you descend into coordinates (1, 1) but you zip to (1, 1) from the left, you can end up in the middle of a room or something, but this doesn't happen often (there's an annoying setup where you zip to the right in the middle of the Gargoyle hall in Arena opposite of the entrance to the Red Minotaur hall that takes you to the middle of the wide clock hall at the bottom of the Top Floor). I don't know if there are any zips you can do that can take you to a tile that normally has no entrances (like the middle of blue crow hallway, for example).

Game stats
Followers
404
Runs
866
Players
179
Recent runs
Level: Julius Boss Rush
Level: Soma Boss Rush
Level: Soma Boss Rush
Latest threads
Posted 3 months ago
2 replies
Posted 3 years ago
0 replies
Posted 3 years ago
0 replies