Dec 29, 2022

That was an Unfortunate Glitch (Grant vs. Collapsing Walkway)

I don't really know what causes the glitch exactly until I look into the code, but Grant can actually outrun a collapsing walkway, resulting in multiple glitches. Someone surely already encountered it, probably during speedrunning. The issue stems from Grant having a faster walk speed. Trevor, Sypha, and Alucard all walk at 1 pixel per frame. Grant on the other hand walks at 1.25 pixels per frame. The collapsing bridge is programmed to keep pace with a character moving at 1 pixel per frame. 

If you move fast and steadily enough, the rubble that appears over a block just before it automatically drops will wrap around the screen. If you keep moving forward too fast, the collision map pointer will wrap around, even though the tile map pointer will remain intact. This results in the rubble appearing over the wrong blocks without actually deleting them. In other words, you could potentially see one or two tiles still on the screen which are impossible to stand on or grab. If you are standing on or hanging from such tiles when the glitch occurs, you will fall to your demise. 

If you inspect the collision map after walking over the bridge as Trevor, then compare it to walking over the bridge as Grant without hesitancy, you can actually verify the collision mask bug, denoted by bold text. The following is taken from Death's room.

00000000000000000000000000000000
00000000000000000000000000000066
00000000000000000000000066666666
00000000000000000000660000000000
00060000000666000000000000000006    Playing as Trevor/Sypha/Alucard
00006600000000000000000000000000
00000000000000000000000000000000
00000000000000000000000000000000
00000000000000000000000000000000

00000000000000000000000000000000
00000000000000000000000000000000
00000000000000000000000066666666
00000000000000000000660000000000
00060000000666000000000000000006    Playing as Grant
00006600000000000000000000006600
00000000000000660000000000000000
00000066000000000000000000000060
00000000000000000000000000000000

The bolded 6's (solid) at the top of the TSA data are the final two blocks of the collapsing walkway which are normally intact at the end of the sequence. We can see that all the tiles that were intended to be part of the collapsing walkway had been cleared to 0. When we look at the G data, we see the 6's up top are now 0 (not solid), while much of the collapsed walkway at the bottom of the data is still set to 6. Even though two blocks were erroneously "removed", up to seven were erroneously ignored!

My theory as to why the collision map is affected and not the tile map/nametable is that the program directly targets the nametable addresses with a pointer, whereas the collision map is perhaps being calculated based on the position of the view in the room. But again, I would need to delve deeper into the code to figure this out.

In the meantime, you should probably avoid increasing player speed in CV3 hacks if collapsing walkways are going to be included in your game, as anything faster than 1 pixel per frame can easily cause some nasty bugs in CV3.

No comments:

Post a Comment

©TheouAegis Productions™. Powered by Blogger.