Skip to content

Instantly share code, notes, and snippets.

@helgefmi
Last active October 18, 2017 00:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save helgefmi/6cca5f2a52de663d41b7332b116b0edc to your computer and use it in GitHub Desktop.
Save helgefmi/6cca5f2a52de663d41b7332b116b0edc to your computer and use it in GitHub Desktop.

Plaid World ELI5

Plaid World is what we call the place we get to after doing an underworld fake flute. This can be done by using blue/green YBA from inside a dungeon, house or a cave (collectivly known as "underworld").

It's similar to being in EG in that collision detection seems to be off, and you can move freely and through walls. But unlike with EG, you are stuck in Plaid World until you do something like Mirror or S+Q.

We have been using it to open boss doors in categories like RBO and Swordless, because there didn't seem to be more use for it as sprites didn't load, and chests were not interactable. Another issue is that you seem to have to do a lot of transitions to move just one screen, and sometimes only a very specific combination of transitions can get you to where you wanted to be. It's easy to get lost in Plaid World :(.

But lately there's been some new tech.

Synced/Unsynced ELI5

First, look at https://alttp-wiki.net/images/0/02/Eg-map.png.

This is the main underworld area. As you can see, it's split up into 16 * 16 supertiles, with Ganon being the first one. We call rooms inside a supertile for "quadrant" (meaning it's 1/4 of a supertile). You can see that the supertile with Houlihan in is split up into 4 quadrants, one of them being the room with rupees in it.

The game keeps track of which supertile you are in in several ways. One is a plain memory address that contains the Dungeon Room Index at $040C (0 = Ganon, 1 = Hyrule Castle corridor .. 15 = Ice Palace entrance .. 19 = Sanctuary etc.). Another one is Link's X ($22) and Y ($20) coordinates. Note that Link's coordinates are absolute, so at [100, 100], he will be in the upper left part of Ganon's supertile (each supertile is 512 pixels in both width and height) and [600, 600] will be in the hidden chest room in Hyrule Castle.

With normal gameplay, these two should always point to the same supertile. Once Link moves 512 pixels rightwards from the far left of a screen, a transition should occur (updating the Dungeon Room Index to the next screen on the EG map) and Link is dragged into said room (updating his coordinates to be inside that room).

In fact, the game will be very confused if Link's coordinates starts being in another supertile than the one that's loaded. This is what happens when we use YBA's or Cane of Somaria glitches in transitions. We update the Room Index, but not Link's coordinates (mostly). This creates an unsynced state. By doing normal door transitions in this state, you will jump around, sometimes get stuck and usually you can't interact with any of the sprites.

It can still be useful. For example, we are able to get TRock Big Key from doing a Cane of Somaria glitch from the Mirror Shield room, and then opening up the big chest. Since the game thinks we're in the supertile north of the Big Chest, it will grab the chest rewards of that room, which happens to be the Big Key.

Synced Plaid World

By fake fluting, the game changes Link's X and Y coordinates. It actually uses the X/Y coordinate of the flute destination, as if we were in the overworld. Since it does not also change the Dungeon Room Index, you end up with a very unsynced state.

The new tech which fixes this, is to flute to 1 (Death Mountain) without flippers, and then nudge left and right for a little bit until Link jumps into the water, and the game starts an apparent infinite screen scroll. (Note that if you have flippers, Link will just start to swim.) If you wait while the screen scrolls, you will eventually spawn back in DM, and be able to move around.

What happens during this screen scroll, is that the game corrects any offsets or disagreements between which dungeon room is loaded, Link's X/Y coordinate and the scrolling camera's coordinates as well. At the end of the scroll, all of these will be in sync. This fixese two issues we used to have:

  • Since Link's coordinates are synced up with the rest of the game, when moving around in Plaid World, sprites will both spawn and be interactable! You can kill a boss, open up the watergate in swamp (the lever is now interactable), pick up the lumberjack heart piece, then kill another boss, and pick up the crystal drop. All in the same segment, and while avoiding any collisions with walls.

  • Transitions are a lot more predictable. It's mostly similar to when you're in EG.

The only way to get unsynced, is to take a bad transition in Plaid World. These are pretty easy to avoid; if you see that the camera scrolls past the room's edge, right before you're about to transition, that means that the transition will result in Link and Dungeon Room Index losing sync. For the most part, this only happens upwards or downwards, meaning that moving left or right is usually not an issue. So whenever this happens, go left or right and try in that room instead. What seems to be a consistent method of avoiding this problem is to only move up/down in supertiles that is split up into 4 seperate rooms. So big screens like GTower entrance or most screens in Hera are not good for vertical screen transitions.

Some examples: https://milde.no/public/alttp/clips/flunderworldArmos.mp4 and https://milde.no/public/alttp/clips/flunderworldTrinexxMire.mp4.

Synced Plaid World enables us to kill a lot of bosses in the same segment, but we can still not pick up chests.

Understanding the collision/tilemap of Plaid World

While running around in synced Plaid World, it might seem like you're in a state similar to EG where you can move around completely freely, but this is not really true. Try going down to the bottom 3-4 rows on the EG map, and you will see that Link starts colliding into invisible walls everywhere.

This happens due to an effect of using the fake flute - it sets a certain memory address to the wrong value ($EC is set to $FFF8 instead of $1F8) which in turn messes up the tilemap lookup algorithm of the game. Instead of using the normal tilemap of the screen that is currently loaded, it is using completely different and unintended RAM values when it looks up a room's tile. The tiles literally comes from things like text/diaglogue pointers, the spotlight effect, enemy damage lookup tables, sound settings for overworld areas, graphics related to the bombos explosion etc.

Since the game is bad at detecting this is happening, it gladly uses these values and interprets them as tiles instead.

The Plaid Map actually looks like this: http://helge.monsternett.no/bg2.png

  • The huge white area there is marked as "free ram" in the disassembly :-) The Practice hack uses a lot of this free ram, so you will get a different map vs. the original ROM.
  • Red tiles are chest tiles.
  • Green tiles are rupee tiles. This gives infinite rupees, as they don't disappear after you grab one.
  • Black tiles have collision (works like a wall)
  • Gray tiles have "semi-collision" - you can usually find a way to get through it by trying different diagonals etc.

The huge thing here is the chest tiles. These can be used to open up chests from the currently loaded room. And better yet, they can be reused as much as you want - enabeling things like picking up Sanctuary Heart until you have all 20 containers.

However, as you can see on the map, they are far from common, and most areas with a lot of Plaid chests are blocked in by the black collision tiles. But there are some that you can get to consistently.

The other problem is that if you are in Synced Plaid World, the Plaid chests would have to be the same supertile as the underworld chest. Basically, it's not very useful to open chests from Synced Plaid World outside of grabbing a few compasses, big keys and some rupees.

I will also note that since the game is using unintended RAM, some of the tiles will change during normal gameplay. Especially on the two bottom rows. By playing around with a Lua script I made (https://milde.no/public/alttp/yba.lua press Z or X to toggle the Hud / collision map), you will see the tilemap organically change from frame to frame. Some tiles might only appear when you hold your sword, or are moving in a specific direction etc. It is possible that previous actions like visiting the Mire screen or opening up the map, could potentially change some of the tiles in Plaid World.

Unsynced Plaid best Plaid after all?

In Plaid World, the collision map is completely a function of Link's coordinates, and will have nothing to do with which room is currently loaded.

So, by being unsynced, we can in theory move Link's X/Y coordinates in front of a chest tile, while also manipulating the Dungeon Room Index to one with a chest that we'd like the contents of. This is not an easy task, as it can be quite hard to know which transitions will move Link's X/Y coordinate to the next room, and which will move the Dungeon Room Index to the next room. Usually only one of them will update.

But with some planning, and a lot of trying and failing, it is possible. See https://milde.no/public/alttp/clips/plaidSanctuaryHeartDupe.mp4.

This is the first real-world application of this, and should be reproducable using the original JP 1.0 ROM. The technique can actually be used for any (?) chests you want to open. I will be using the DNG and LNK terms that are present in the lua script to describe how:

  1. Start in a room on the same row as a chest you want on the EG map. (You also need Big Key if opening up a big chest.)
  2. Get into Plaid World with a Blue YBA between the quadrants of your room, and go to Link's House (4).
  3. Transition down once, then up once, then go down until LNK is in the $B0-$BF range.
  4. Transition left or right until DNG points to the room with a chest you want to open.
  5. Use the collision map to find the chest tile, face up and press A.

From here, you can actually keep on grabbing chests by moving < or >, if there are any of interest on the same row.

If you want to change rows (I've only found a way to do it downwards so far):

  1. Transition up once.
  2. Go downwards until DNG is one row past the row you want to have loaded.
  3. Transition down once, then transition up.
  4. Transition down until LNK is at $B0-$BF again.

By using this technique I was able to pick up the following items in order: Sanctuary Heart, Mirror Shield, Moon Pearl, Hookshot.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment