• Our software update is now concluded. You will need to reset your password to log in. In order to do this, you will have to click "Log in" in the top right corner and then "Forgot your password?".
  • Forum moderator applications are now open! Click here for details.
  • Welcome to PokéCommunity! Register now and join one of the best fan communities on the 'net to talk Pokémon and more! We are not affiliated with The Pokémon Company or Nintendo.

Development: The Secret Sauce: Triple-Layer Blocks

Sierraffinity

Desperately trying to retire from ROM hacking
1,069
Posts
16
Years

Triple-Layer Blocks

What are triple-layer blocks, exactly, and why should I care?

If you've ever used a mapping tool (which almost everyone has), then you've come to notice that you can only "stack" a maximum of two layers on top of each other:

eMPgFCW.png

The problem at hand.

But what if you need to stack three things on top of each other? What do you do then besides squeezing two layers into one palette and make new tiles? Well, this is where triple-layer tiles come in handy!

Installation guide

FireRed/Emerald

First, download the pack that corresponds to your game:

FireRed (BPRE): http://www.mediafire.com/download/s6295xtbupeof5r/Triple-Layer_Blocks_(FireRed).zip
Emerald (BPEE): http://www.mediafire.com/download/i0efj9dxywl2pqj/Triple-Layer_Blocks_(Emerald).zip
For those interested, the source code is included within each pack.

Open the first binary file and your ROM in a hex editor of your choice (I prefer HxD). Copy the contents of the binary file and paste it at either address 0x5A9BC (FireRed) or 0x89F80 (Emerald). Find a chunk of free space (200 bytes is a good size to search for), round it up to the nearest multiple of 4 (0, 4, 8, or C), then replace the '00 00 00 08' from the end of the pasted chunk with a pointer to the free space you found, plus 1 (this is the only time you're adding 1 to an address in this tutorial, be careful!). Example: You found free space at 0xF45167. Round it up to 0xF45168, add 1, then reverse it to get 69 51 F4 08.

In the ROM, navigate to the rounded free space address (remember, don't add 1!). Open the second binary file, then copy and paste it into the ROM. Replace the '00 00 00 08' from the end of the pasted chunk with a pointer to the free space just after the pasted section. In that space, paste this code:

FireRed: 6C AA 05 08 CE A9 05 08 0C AA 05 08 00 00 00 08
Emerald: 30 A0 08 08 D0 9F 08 08 92 9F 08 08 00 00 00 08

Again, replace the '00 00 00 08' from the end of the pasted chunk with a pointer to the free space just after the pasted section. In that space, paste the contents of the third binary file.

FireRed specific instruction: Change 0x60 to 0x70 at 0x352F0B and 0x1D to 0x1C at 0x352F16. Also, change 0x01 to 0x02 at 0x9B868 and "02 DC" to "2F D0" at 0x9B86E.

Ruby

First, download this pack:
http://www.mediafire.com/download/05bnvk9bk1j2oab/Triple-Layer_Blocks_(Ruby).zip
For those interested, the source code is included within each pack.

Open the first binary file and your ROM in a hex editor of your choice (I prefer HxD). Copy the contents of the binary file and paste it at address 0x57E96. Find a chunk of free space (200 bytes is a good size to search for), round it up to the nearest multiple of 4 (0, 4, 8, or C), then replace the '00 00 00 08' from the end of the pasted chunk with a pointer to the free space you found. Example: You found free space at 0xF45167. Round it up to 0xF45168, then reverse it to get 68 51 F4 08.

In the ROM, navigate to the rounded free space address. In that space, paste this code:

A0 7F 05 08 28 7F 05 08 AC 7E 05 08 00 00 00 08

Replace the '00 00 00 08' from the end of the pasted chunk with a pointer to the free space just after the pasted section. In that space, paste the contents of the second binary file.

How to use your new powers

Congratulations! You now have the ability to use three layers at once! But how do you use this, you ask? It's pretty simple.

Set your first block to have the bottom two layers and a background byte of 30:
UX2YiXX.png


Setthe block immediately after it to be the top layer (this is your burner block):
L4458Kn.png


What do I mean by a "burner block"? Well, it's a block that you wasted the bottom layer on and can't use it for much else. However, if you're creative, then you can find another use for it (such as a one-layer block).

The result

oMJh59Y.png

Looks ugly in Advance-Map, but...

rtgZro6.png

Looks great in-game!

How do overworld sprites interact with these blocks? How would they look?

mulxisz.png

Another in-game example.
When the player or any other sprite goes on the triple-layer block, they'll always appear above the bottom two layers and below the top layer. This is due to how the block system works: a background byte of 00 uses the top two layers (sandwiching sprites between) and a background byte of 10 or 20 (depending on your game) uses the bottom two layers (putting sprites on top). The triple-layer block hack enables you to use all three of these block layers at once.

But what if I want all three below the player?

There's a way around it, but it's kind of "hacky" (heh). You have to set the "height" of the block (using movement permissions) to be higher than C. The caveat to this is, sprites at that height will appear above ALL blocks, even ones that the player would usually be under, so it's not the most convenient thing to use. If you REALLY need all three underneath the player for some reason, try and see if you can merge two of the layers together and use the normal system instead before attempting this.

Questions? Comments? Suggestions? Leave them below!
 
Last edited:

BlackStorm20x

Content Creator
325
Posts
9
Years
OMG FINALLY. I been trying to find a thread on triple-layer blocks, and when I found Shinyquagsire's, I guess I needed ASM. :| :/ >:( LOL. But thank you Deigo, thank you. :D
 
3,830
Posts
14
Years
  • Age 26
  • OH
  • Seen Feb 26, 2024
This is very nice. And you do a great job of explaining it! :) It seems easier to use than Shiny Quagsire's version too.
Quick question, though. Do the tiles work on both the primary and secondary tilesets?
 

Sierraffinity

Desperately trying to retire from ROM hacking
1,069
Posts
16
Years
Really its looking good in game!! I like it!
Thank you!
OMG FINALLY. I been trying to find a thread on triple-layer blocks, and when I found Shinyquagsire's, I guess I needed ASM. :| :/ >:( LOL. But thank you Deigo, thank you. :D
No problem!
This is very nice. And you do a great job of explaining it! :) It seems easier to use than Shiny Quagsire's version too.
Quick question, though. Do the tiles work on both the primary and secondary tilesets?
Thanks!
These triple-layer blocks work on both primary and secondary tilesets.
 

Jaizu

Average rom hacker
261
Posts
14
Years
First of all thanks, I'm happy that you finally got it, and for all the Rom Bases (:
Just one question, on wich layer will the PLAYER be? I mean, in vanilla rom is
LAYER 1 PLAYER LAYER 2 or
LAYER 1 LAYER 2 PLAYER if we have block-type 10/20 depending on the ROM Base.
 
5,256
Posts
16
Years
First of all thanks, I'm happy that you finally got it, and for all the Rom Bases (:
Just one question, on wich layer will the PLAYER be? I mean, in vanilla rom is
LAYER 1 PLAYER LAYER 2 or
LAYER 1 LAYER 2 PLAYER if we have block-type 10/20 depending on the ROM Base.

From my testing, it's:

LAYER 1 LAYER 2 PLAYER LAYER 3

This happens regardless of whether the tile for the third layer (the "burner block") has background byte 10/20 or not.
 

Le pug

Creator of Pokémon: Discovery / Fat Kid
870
Posts
10
Years
Great resource and good tutorial, thanks for this.

I recommend in your tutorial section (even though you said it in parathesis) that you state for each of them that you no longer add the +1 to each offset for this text:

"In the ROM, navigate to the rounded free space address (don't add 1 this time!). Open the second binary file, then copy and paste it into the ROM. Replace the '00 00 00 08' from the end of the pasted chunk with a pointer to the free space just after the pasted section. In that space, paste this code:"

What I personally interpreted it as was navigate to the free space address and don't add 1 that time but for the rest of them to add +1 like the first time. Reiteration will prevent others from breaking their game and wondering why it doesn't work lol. Thanks again for this resource though, I have way too many three-layered blocks in my game lol.

Also for a support question: Is there any way to have the hero over both blocks? Currently the player covers the first block but the block used to be above it will show above the player's OW in-game. I tried setting the second block to background byte 10 so the player is above it while having the first block as 30 but it's still showing the hero below the block. Any idea how to fix?
 
Last edited:

Sierraffinity

Desperately trying to retire from ROM hacking
1,069
Posts
16
Years
First of all thanks, I'm happy that you finally got it, and for all the Rom Bases (:
Just one question, on wich layer will the PLAYER be? I mean, in vanilla rom is
LAYER 1 PLAYER LAYER 2 or
LAYER 1 LAYER 2 PLAYER if we have block-type 10/20 depending on the ROM Base.

From my testing, it's:

LAYER 1 LAYER 2 PLAYER LAYER 3

This happens regardless of whether the tile for the third layer (the "burner block") has background byte 10/20 or not.
Yeah, that's correct. I'll add that into the tutorial.
I have a question, would it be possible to make "Triple-layered block"block over hero? Like byte 20 in adv. map?
Kind of, but it's a little hacky (no pun intended). You have to set the "height" of the block (using movement permissions) to be higher than C, but this could mess with other blocks you have, so it's not the easiest thing to use.
I'll add this into the tutorial too.
Great resource and good tutorial, thanks for this.

I recommend in your tutorial section (even though you said it in parathesis) that you state for each of them that you no longer add the +1 to each offset for this text:

"In the ROM, navigate to the rounded free space address (don't add 1 this time!). Open the second binary file, then copy and paste it into the ROM. Replace the '00 00 00 08' from the end of the pasted chunk with a pointer to the free space just after the pasted section. In that space, paste this code:"

What I personally interpreted it as was navigate to the free space address and don't add 1 that time but for the rest of them to add +1 like the first time. Reiteration will prevent others from breaking their game and wondering why it doesn't work lol. Thanks again for this resource though, I have way too many three-layered blocks in my game lol.

Also for a support question: Is there any way to have the hero over both blocks? Currently the player covers the first block but the block used to be above it will show above the player's OW in-game. I tried setting the second block to background byte 10 so the player is above it while having the first block as 30 but it's still showing the hero below the block. Any idea how to fix?
Fixed it, is it less ambiguous now? Thanks!
 
Just used it, and it works and looks great! It really gives some of my maps a lot more freedom.

However, after using it, that burner block usually ends up as such a waste as only the top layer. Wouldn't it be better if the bottommost layer was the burner block? Then, at least, it could be easily used elsewhere on its own.
 

Sierraffinity

Desperately trying to retire from ROM hacking
1,069
Posts
16
Years
Just used it, and it works and looks great! It really gives some of my maps a lot more freedom.

However, after using it, that burner block usually ends up as such a waste as only the top layer. Wouldn't it be better if the bottommost layer was the burner block? Then, at least, it could be easily used elsewhere on its own.
Do you mean, the triple-tile's top section should be the top of the next block instead of the bottom?
 
Do you mean, the triple-tile's top section should be the top of the next block instead of the bottom?

Behold my MSPaint skills! (The blank portion of the top layer of a tile has been omitted, because lazy.)

qGmDe6h.png


In this case, you probably couldn't save yourself the tile regardless, but in other cases, the bottommost layer of this triple-layer tile could be used on its own and possibly save an otherwise wasted tile. Like, if I had a floor tile as the bottom layer (on its own tile), a table on the middle layer, and something overlapping on the third (with the table and the something overlapping it on one tile), I could use that floor tile as a normal tile elsewhere, while still having a triple layer tile. You'd have to make it so you choose the tile that is "up and more up" and it uses the tile before it as the bottommost layer instead of using the current system of choosing the "down and up" tile and burning the "more up" tile (which almost always becomes useless). Basically, instead of almost always wasting two tiles to make up a triple-layer tile in the tileset, you would only have to waste one some of the time, with the bottom layer being reusable.

I don't know if I explained this well. Sorry if I'm unclear.

EDIT: In fact, even with the current system, doing it so you choose the "more up" layer tile and the routine pulls the "down" and "up" layers from the tile before it is a better implementation than what we have now, because it potentially saves the bottom and middle layer (which is one tile in the current system and is also the most usable as-is out of the two tiles involved).

EDIT2: Either way, the right tile should activate the routine and pull from the tile before it, but maybe behavior byte 30 could continue to use the "what it is" method, where the bottom and middle layer are on one tile, and the top on another, while behavior byte 31 uses the "what it should be" method, where the bottom layer is on one tile, and the middle and top are on another. This would give the hacker the maximum possible chance of not wasting their tile space, as they can decide what configuration yields an easy-to-reuse tile. Depending on what behavior byte I choose, and using the above image as an example, I could choose to reuse the water with land border tile elsewhere, OR I could choose to reuse the only water tile elsewhere.
 
Last edited:
26
Posts
8
Years
I did everything in the tutorial (fire red), everything looks fine until i play the rom and the tile is completely buggy, except for the bottommost tile. I tried with both a-map 1.9.5 and 1.9.2, so i'm kind of dumbfounded. Does anyone have an idea of what could be wrong?

Nevermind, the problem was the tile, not triple layer. Great tutorial!
 
Last edited:
232
Posts
12
Years
  • Seen Sep 10, 2019
Initially didn't understand what you've meant by 'immediately set the block after it' . Didn't realize all I had to do was click on it after saving the previous tile. Very grateful for this, thank you!
 
12
Posts
9
Years
Well, I followed all the steps but the game shows black screen after introduction, I tried with a clean rom and expanded rom with same results. Anyone can provide a video tutorial o something?, cause I don't know what I did wrong during the process.
 
160
Posts
8
Years
I cant get it to work. I have done all the byte changes and routine insertions and if I put the third layer over the first and second than it is covering them completely. Can someone help me with this?
 
10
Posts
6
Years
  • Age 23
  • Seen Jun 14, 2019
i do everything it says and i get to this part Change 0x60 to 0x70 at 0x352F0B and 0x1D to 0x1C at 0x352F16. Also, change 0x01 to 0x02 at 0x9B868 and "02 DC" to "2F D0" at 0x9B86E. and i cant find any of this stuff wether its an edited rom or a fresh rom could someone perhaps try doing it on their own with my rom to see if its my rom messing up or me. thanks in advanced i really hope itll work triple layers will look great with some of my maps
 

Sierraffinity

Desperately trying to retire from ROM hacking
1,069
Posts
16
Years
i do everything it says and i get to this part Change 0x60 to 0x70 at 0x352F0B and 0x1D to 0x1C at 0x352F16. Also, change 0x01 to 0x02 at 0x9B868 and "02 DC" to "2F D0" at 0x9B86E. and i cant find any of this stuff wether its an edited rom or a fresh rom could someone perhaps try doing it on their own with my rom to see if its my rom messing up or me. thanks in advanced i really hope itll work triple layers will look great with some of my maps
What's your problem here exactly? If you go to that address, do you not find the values I wrote?
 
Back
Top