Go Back   The PokéCommunity Forums > ROM Hacking > Research & Development
Reload this Page Development The Secret Sauce: Triple-Layer Blocks

Notices
For all updates, view the main page.

Research & Development Got a well-founded knack with ROM hacking? Love reverse-engineering the Pokémon games? Or perhaps you love your assembly language. This is the spot for polling and gathering your ideas, and then implementing them! Share your hypothesis, get ideas from others, and collaborate to create!
Research & Development programs in this forum are subject to moderator approval before they are displayed.



Reply
 
Thread Tools
  #1    
Old July 22nd, 2015 (10:08 PM). Edited August 2nd, 2015 by diegoisawesome.
diegoisawesome's Avatar
diegoisawesome diegoisawesome is offline
Oh god the bees
Silver Tier
 
Join Date: Dec 2007
Location: :noitacoL
Age: 19
Gender: Male
Nature: Naive
Posts: 997

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!

__________________


My other resources:
My Website
diegoisawesome's MEGA-HUGE XSE Scripting Tutorial
diegoisawesome's Miscellaneous Finds
The Ruins of Alph Puzzles
Diego's Miscellaneous Patches
GBA Intro Manager
The Secret Sauce: Triple-Layer Tiles
Reply With Quote

Relevant Advertising!

  #2    
Old July 23rd, 2015 (2:28 AM).
hackstar's Avatar
hackstar hackstar is offline
Check it out!!
 
Join Date: Jan 2013
Location: Dhaka
Gender: Male
Nature: Gentle
Posts: 198

Really its looking good in game!! I like it!

__________________
Always FEEL CONFIDENT!!!
Reply With Quote
  #3    
Old July 23rd, 2015 (6:53 AM).
BlackStorm20x's Avatar
BlackStorm20x BlackStorm20x is offline
Don't trust people.
 
Join Date: Apr 2014
Location: Texas
Gender: Male
Nature: Quiet
Posts: 477

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

__________________
I am a Christian. I believe in Jesus Christ my Savior. If you do too, and aren't scared to admit it, then copy and paste this into your signature.




Reply With Quote
  #4    
Old July 27th, 2015 (12:13 PM).
Lost's Avatar
Lost Lost is offline

On The Road Of Life

Platinum Tier
 
Join Date: Mar 2010
Age: 19
Gender: Male
Nature: Lax
Posts: 3,178

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?

__________________
Reply With Quote
  #5    
Old July 27th, 2015 (10:17 PM).
diegoisawesome's Avatar
diegoisawesome diegoisawesome is offline
Oh god the bees
Silver Tier
 
Join Date: Dec 2007
Location: :noitacoL
Age: 19
Gender: Male
Nature: Naive
Posts: 997

Quote originally posted by hackstar:
Really its looking good in game!! I like it!
Thank you!
Quote originally posted by BlackStorm20x:
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!
Quote originally posted by Lost Heart:
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.

__________________


My other resources:
My Website
diegoisawesome's MEGA-HUGE XSE Scripting Tutorial
diegoisawesome's Miscellaneous Finds
The Ruins of Alph Puzzles
Diego's Miscellaneous Patches
GBA Intro Manager
The Secret Sauce: Triple-Layer Tiles
Reply With Quote
  #6    
Old July 30th, 2015 (4:00 AM).
Jaizu's Avatar
Jaizu Jaizu is offline
Spanish Rom Hacker
 
Join Date: Jan 2010
Location: Spain
Gender: Male
Posts: 75

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.

__________________

RomHack.it! - Website about RomHacking Resources
Reply With Quote
  #7    
Old July 30th, 2015 (5:26 AM).
Spherical Ice's Avatar
Spherical Ice Spherical Ice is offline
Moderator
 
Join Date: Nov 2007
Location: Leicester, UK
Age: 18
Posts: 4,664

Quote originally posted by Jaizu:
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.

__________________
Reply With Quote
  #8    
Old July 31st, 2015 (7:59 AM).
Lance32497's Avatar
Lance32497 Lance32497 is offline
LanceKoijer of Pokemon_Addicts
 
Join Date: Aug 2014
Location: Criscanto town-Ginoa Region xD
Gender: Male
Nature: Adamant
Posts: 707

I have a question, would it be possible to make "Triple-layered block"block over hero? Like byte 20 in adv. map?

__________________
Please take time clicking this link http://pocketmoneyduty.com/?u=15594

My Threads

Reply With Quote
  #9    
Old August 2nd, 2015 (3:55 PM). Edited August 2nd, 2015 by Le pug.
Le pug's Avatar
Le pug Le pug is offline
Creator of Pokémon: Discovery / Fat Kid
Crystal Tier
 
Join Date: Aug 2013
Location: Le bed
Age: 23
Gender: Male
Nature: Bold
Posts: 765

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?

__________________







/// Pokémon: Discovery
/// Pokémon: Fat Kid
/// Tile Insertion Tutorial For AdvanceMap
/// Pokémon Emerald Specials Resource Thread
/// Pokémon Emerald Decapitalization Patch
/// Emerald Titlescreen Cloud Removal Tutorial
/// Tutorial For Fixing Any ROM-related Bug
Reply With Quote
  #10    
Old August 2nd, 2015 (11:30 PM).
diegoisawesome's Avatar
diegoisawesome diegoisawesome is offline
Oh god the bees
Silver Tier
 
Join Date: Dec 2007
Location: :noitacoL
Age: 19
Gender: Male
Nature: Naive
Posts: 997

Quote originally posted by Jaizu:
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.

Quote originally posted by Spherical Ice:
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.
Quote originally posted by Lance32497:
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.
Quote originally posted by Le pug:
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!

__________________


My other resources:
My Website
diegoisawesome's MEGA-HUGE XSE Scripting Tutorial
diegoisawesome's Miscellaneous Finds
The Ruins of Alph Puzzles
Diego's Miscellaneous Patches
GBA Intro Manager
The Secret Sauce: Triple-Layer Tiles
Reply With Quote
  #11    
Old September 4th, 2015 (12:18 PM).
Deokishisu's Avatar
Deokishisu Deokishisu is offline
Mr. Magius
 
Join Date: Feb 2006
Location: If I'm online, it's a safe bet I'm at a computer.
Gender: Male
Nature: Relaxed
Posts: 670

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.

Reply With Quote
  #12    
Old September 8th, 2015 (7:26 PM).
diegoisawesome's Avatar
diegoisawesome diegoisawesome is offline
Oh god the bees
Silver Tier
 
Join Date: Dec 2007
Location: :noitacoL
Age: 19
Gender: Male
Nature: Naive
Posts: 997

Quote originally posted by Deokishisu:
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?

__________________


My other resources:
My Website
diegoisawesome's MEGA-HUGE XSE Scripting Tutorial
diegoisawesome's Miscellaneous Finds
The Ruins of Alph Puzzles
Diego's Miscellaneous Patches
GBA Intro Manager
The Secret Sauce: Triple-Layer Tiles
Reply With Quote
  #13    
Old September 8th, 2015 (8:40 PM). Edited September 8th, 2015 by Deokishisu.
Deokishisu's Avatar
Deokishisu Deokishisu is offline
Mr. Magius
 
Join Date: Feb 2006
Location: If I'm online, it's a safe bet I'm at a computer.
Gender: Male
Nature: Relaxed
Posts: 670

Quote originally posted by diegoisawesome:
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.

Reply With Quote
  #14    
Old November 25th, 2015 (11:55 AM). Edited November 27th, 2015 by dysbber162.
dysbber162's Avatar
dysbber162 dysbber162 is offline
 
Join Date: Jun 2015
Location: Norway
Gender: Male
Nature: Jolly
Posts: 28

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!

Reply With Quote
Reply
Quick Reply

Sponsored Links
Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -8. The time now is 9:28 AM.