Development The Secret Sauce: Triple-Layer Blocks

Started by Sierraffinity July 22nd, 2015 10:08 PM
  • 16438 views
  • 22 replies

Sierraffinity

Oh god the bees

Age 23
Female
Somewhere the rains of Africa can be blessed
Seen 6 Days Ago
Posted April 20th, 2020
1,061 posts
12.4 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:


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_%28FireRed%29.zip
Emerald (BPEE): http://www.mediafire.com/download/i0efj9dxywl2pqj/Triple-Layer_Blocks_%28Emerald%29.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_%28Ruby%29.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:


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


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



Looks ugly in Advance-Map, but...


Looks great in-game!

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



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!

Sierraffinity

Oh god the bees

Age 23
Female
Somewhere the rains of Africa can be blessed
Seen 6 Days Ago
Posted April 20th, 2020
1,061 posts
12.4 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.

Spherical Ice

Age 22
Bristol, UK
Seen 5 Hours Ago
Posted March 11th, 2020
5,259 posts
12.5 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.

Lance32497

LanceKoijer of Pokemon_Addicts

Male
Criscanto town-Ginoa Region xD
Seen August 13th, 2017
Posted January 1st, 2017
793 posts
5.8 Years
I have a question, would it be possible to make "Triple-layered block"block over hero? Like byte 20 in adv. map?
This signature has been disabled.
Scrollbar appears
Please review and fix the issues by reading the signature rules.

You must edit it to meet the limits set by the rules before you may remove the [sig-reason] code from your signature. Removing this tag will re-enable it.

Do not remove the tag until you fix the issues in your signature. You may be infracted for removing this tag if you do not fix the specified issues. Do not use this tag for decoration purposes.

Le pug

Creator of Pokémon: Discovery / Fat Kid

Age 27
Male
Le bed
Seen February 12th, 2020
Posted June 6th, 2019
871 posts
6.8 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?
Retired. Thank you guys for a wonderful five years.

Sierraffinity

Oh god the bees

Age 23
Female
Somewhere the rains of Africa can be blessed
Seen 6 Days Ago
Posted April 20th, 2020
1,061 posts
12.4 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!

Deokishisu

Mr. Magius

Male
If I'm online, it's a safe bet I'm at a computer.
Seen March 15th, 2020
Posted March 4th, 2018
859 posts
14.3 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.
For ROMHackers, PokeCommunity is dead after the scandal. If you enjoy the ROMHacking scene, come with the rest of us to Silph Co. It is a forum by ROMHackers, for ROMHackers. None of the bloat of PC, and staff that knows what our subset of the community needs.

Sierraffinity

Oh god the bees

Age 23
Female
Somewhere the rains of Africa can be blessed
Seen 6 Days Ago
Posted April 20th, 2020
1,061 posts
12.4 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?

Deokishisu

Mr. Magius

Male
If I'm online, it's a safe bet I'm at a computer.
Seen March 15th, 2020
Posted March 4th, 2018
859 posts
14.3 Years
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.)



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.
Male
Norway
Seen November 13th, 2018
Posted April 20th, 2016
27 posts
5 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!

Sierraffinity

Oh god the bees

Age 23
Female
Somewhere the rains of Africa can be blessed
Seen 6 Days Ago
Posted April 20th, 2020
1,061 posts
12.4 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?
Not sure what you mean by this, could you elaborate?

Hotice03

Seen June 14th, 2019
Posted March 4th, 2018
10 posts
3.1 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

Sierraffinity

Oh god the bees

Age 23
Female
Somewhere the rains of Africa can be blessed
Seen 6 Days Ago
Posted April 20th, 2020
1,061 posts
12.4 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?

Hotice03

Seen June 14th, 2019
Posted March 4th, 2018
10 posts
3.1 Years
One thing, and this may just overall be an error i made, but it seems like since i diid this to my rom, obtaining the running shoes no longer work, my script for the running shoes are correct it works in other fresh roms and stuff the only rom it dont work on is the roms ive done trilayers too any reason why and has anyone else had this issue?