• 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?".
  • 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.

Inserting Battle Backgrounds

Lunos

Random Uruguayan User
3,114
Posts
15
Years
All photos are broken. Without them, everything is much less clear at times. I, like a noob, can't understand what is happening without them.
They're not.
7tcBRNX.png

Some images are pixelated. Is there a way of watching them properly?
Yeah, there's an addon called "Photobucket Embed Fix" available on Firefox and Chromium. Install it, reload the page and you're good to go.
 
788
Posts
17
Years
  • Age 29
  • Seen Apr 25, 2024
I repackaged karatekid552's Battle BG Hack for easy installation with armips, no hex editor required.

It will both insert the hack and repoint the bg table for you. You can also control where things get placed by modifying the .definelabels for bg_hack_code and new_bg_table.

Spoiler:

To use it, save it as bghack.asm. Open a terminal / command prompt to that folder and run armips bghack.asm. It assumes your ROM will be called rom.gba and instead of modifying it, it will create a modified copy in test.gba. You can easily modify the filenames by adjusting the values of inrom and outrom if preferred.

Of course, credits still go to karatekid552 for the original code. It's still basically the same; I only modified it enough to get armips to build it.
 
Last edited:

DrFuji

[I]Heiki Hecchara‌‌[/I]
1,691
Posts
14
Years
God, this tutorial is old. So much wrong with it ;_;

I've rehosted the images away from photobucket, changed the links to karatekid552's source code/ patch and linked to Zeturic's post above. Hopefully this makes it more accessible until everything dies again.
 
148
Posts
17
Years
  • Age 29
  • Seen Nov 21, 2023
God, this tutorial is old. So much wrong with it ;_;

I've rehosted the images away from photobucket, changed the links to karatekid552's source code/ patch and linked to Zeturic's post above. Hopefully this makes it more accessible until everything dies again.

What sort of changes would you make to it if you wanted to do this today? Any different tools or methods you would recommend?
 

DrFuji

[I]Heiki Hecchara‌‌[/I]
1,691
Posts
14
Years
What sort of changes would you make to it if you wanted to do this today? Any different tools or methods you would recommend?

I guess 'wrong' was a being bit dramatic, but there are some changes I would make.

First would be to completely redo the section on how the pallets work and how to properly open them in APE. At the time I didn't know how to properly do it but I'm more knowledgeable about those issues now. Secondly, I'd be advocating for TMC as an alternative to NTME, especially for making the tileset after doing the mock-up screen. Finally, I'd also include a bit about the pre-battle images (e.g the grass that moves to the left at the beginning of the battle) as that is included in karatekid552's patch, but my post says absolutely nothing about it. There are one or two more minor things to clear up, but they wouldn't amount to more than sentence or two. I might update my first post in a few days since this on my mind.
 
148
Posts
17
Years
  • Age 29
  • Seen Nov 21, 2023
I guess 'wrong' was a being bit dramatic, but there are some changes I would make.

First would be to completely redo the section on how the pallets work and how to properly open them in APE. At the time I didn't know how to properly do it but I'm more knowledgeable about those issues now. Secondly, I'd be advocating for TMC as an alternative to NTME, especially for making the tileset after doing the mock-up screen. Finally, I'd also include a bit about the pre-battle images (e.g the grass that moves to the left at the beginning of the battle) as that is included in karatekid552's patch, but my post says absolutely nothing about it. There are one or two more minor things to clear up, but they wouldn't amount to more than sentence or two. I might update my first post in a few days since this on my mind.

After getting my own backgrounds in for the past few days, I think some things that are worth mentioning is how the palette for the indoor background is used differently than the others. I personally copy over the palette that used for the field and modify that to get it to work properly.

Also, maybe talk about how to insert the tilesets and raws without overriding other backgrounds, since so many of them share a background with a different palette. Overriding one changes all the others. I just used unLZ and a hex editor for that, but I'm sure there's better methods out there.
 

trdtrl

clear throat
28
Posts
6
Years
  • Age 28
  • Seen Jan 22, 2024
After changing the background, how can I configure it? For example if you in a dessert map, you want your battle bg be sand right? Is the bg configure itself automatically by recognizing the terrain in the map or you must configure it yourself?
 

ScizorBlade

Sup Dogg
39
Posts
4
Years
Hey everybody, this thread is collaboration between myself and karatekid552 that seeks to help people with the many facets of battle backgrounds in Fire Red. In this section I will walkthrough how to insert new backgrounds over already existing ones. In the next half karatekid552 will go into further detail about how the background table is structured and present a way to allow you to expand the table and change the active background through a single variable. We hope that you can learn a lot from this and will be able to insert and do all sorts of wondrous things with battle backgrounds afterwards.


Tools Needed:
  • Nameless TileMap Editor (NTME)
  • Old version of Paint/ Photoshop/ GIMP/ An image-editing program of some kind that can work with indexed images
  • unLZ.GBA
  • A Hex Editor
  • Free Space Finder
  • An Emulator with a Fire Red ROM


Starting off, make a back up of you ROM, it is very possible that things may not come out as originally intended.

Firstly, we need to create a mock-up of the background we want to insert in Paint. In this instance I've decided to make a background for a generic grass battle. Here's what I want to insert in the ROM:

Spoiler:

The dimensions of this background are 240x112 pixels if you're interested. Some of you keen-eyed people may have noticed that I have more than the standard 15 colours plus a transparent colour as per usual in an indexed image. This is the case because I'll be taking advantage of a second palette that can be used when we are in battle – I will go further into this later.

If you don't know whow to index an image then there are many other tutorials that cover this. For the sake of laziness length I would advise you to find another graphics tutorial that includes indexing.

Anyway, now that we know what we want to insert, we need to make it more compact for the next step. We will need to remove as many 8x8 pixel tiles that have been repeated as possible. If we were to insert something the size of our mock-up above it would take up quite a lot of unnecessary space and possibly overwrite/ be overwritten by other graphics loaded in the RAM. Here's the tileset that I've compacted our background down to:

Spoiler:

While this tileset isn't optimalas there are still a number of repeated tiles it is close enough and has already significantly shrunken the filesize that will be inserted. There also appears to be an anomaly on the right hand side of the tileset, this is to do with the second palette that I mentioned earlier. I've lined up the colours in the tiles so they will directly match their places in the second palette. As this particular picture can only be made with fifteen colours (plus transparency) it has to look out of place for the time being. Nevertheless, this is what we're going to be working with.

Now we're going to need to extract some things via unLZ.GBA (It is possible to insert a background without doing this step, but it makes everything easier). Open your ROM in unLZ and head to picture number 3. There you should see the tileset for the current grass background. Click 'Save As' and put it somewhere on your computer. Click 'Next' to arrive at picture number 4 which just appears to be a big jumble of random lines resembling television static. This is the tilemap for the grass background, it essentially tell our tileset how to arrange itself in-game to give us a full blown battlefield. To save it click 'RAW Dump' and then proceed to open up NTME.

Spoiler:

NTME is a program that allows you to create your own tilemaps to be inserted along with tilesets. For now just open up the two files you saved from unLZ and you should be able to be able to recreate the default grass background. To make it look like it should in-game select the dropdown menu underneath 'Size (Keep Ratio)' and select 32x64.

Spoiler:

But this isn't what we want – We want to aim higher and greater. Now we should open up the combination of our own tileset as well as the default grass tilemap. 99% of the time a message will pop up asking about whether some tiles should be replaced with the first tile in your tileset. Just say yes to this and move on. The result may look random, but that's only because we're working with old data (the default tilemap) so now we need to remake our mock-up from the beginning of the tutorial. Load your tileset and start painting! It is easiest to just follow what has already been done by mirroring the original tilemap which is why it is open now. After some work these are the before and after screenshots:

Spoiler:

But we've only got half the story in this screenshot, there's a lot more that has gone unseen here - NTME's viewing window can only show a fraction of what needs to be done. This actually what we have to make by manipulating the up/ down and right/ left scroll bars:

Spoiler:

Yup, it's just like an iceberg: most of the image's size lies beneath the water. A handy image that briefly covers what each part of the tilemap represents has also been included for your convenience.

Once you've recreated your battle background we need to make sure it is using the correct palette. Select the 'PaletteMap' tab at the bottom of NTME and the viewing window should change to a series of numbers overlaying your background. These numbers indicate which palette the tiles will be loaded from when being played in-game. The only two numbers which we are interested in are two and three as they are what the game uses in its original backgrounds.

This is the point where if you prepared ahead of time you will be able to add more than fifteen colours (plus transparency) to your background. In this background I have a large strip of background that isn't supposed to use the same palette as the majority of the background. There is a catch when it comes to adding a second palette though – It can only have a maximum of seven new colours. You will be able to see why this is the case later on, but for now know that you are restricting in how much you can add. Anyway, this is how my palette map will look, where palette two applies the full fifteen colour palette while palette three will only apply the restricted seven colour palette.

Spoiler:

And with that, we're finished making the tilemap for our background – Now it is time to insert both it and the tileset into the ROM. Reopen unLZ.GBA and head to the background of your choice. Once you're at your background's position select 'Import' and open your tileset. Select 'Write to ROM' and a second smaller window should pop-up; this is where we shall decide where the tileset will be inserted in the ROM. I'm going to be inserting the tileset at 0x720000 in the FR ROM as there is quite a lot of free space from there so I know nothing will be accidentally overwritten.

Spoiler:

Don't try to insert the palette accompanying the tileset at this point. Unlike other compressed images like Pokemon sprites, the proper palette isn't attached to the tileset in unLZ – We need to change it manually later. Now let's enter a battle and see how it's looking.

Spoiler:

Eww. To avoid seeing something Picasso vomited out during a hazy Friday night we have to insert the tilemap. Click 'Next' in unLZ and you should have returned to the tilemap from earlier. Rather than simply importing the tilemap like the tileset there is a slightly different method as it is not an image file (though unLZ is able to translate it into one). Select 'File > Load RAW' and select your custom tilemap. Now we just have to write it to the ROM in the exact same manner we did with the tileset. I've chosen to insert it directly after my tileset which means it will be located at 0x720400 according to HackMew's Free Space Finder.

With both our tileset and tilemap inserted the background should be shaping up far better than before. This is what we get when we enter a battle now:

Spoiler:

Alright, that's looking much better – Our background actually has a recognisable structure now. We are now up to the final part of our insertion method, altering the palette. As you must have noted several times throughout this tutorial I have deferred talking about the background palettes for one reason or another. This was because it would have been quite jarring to interrupt with notes on how the palettes are structured as they differ from ordinary compressed and uncompressed palettes.

The palettes which are assigned to battle backgrounds are made from two palettes, palettes 0x2 and 0x3 in your emulator's background palette viewer. Both of these palettes are highly interlinked as 0x3 borrows most of its data from 0x2 to save some space. This has caused them to appear fractured with a byte jutting out after every fourth word. For example, here's a screenshot of the original grass background palette in a HEX editor with each stray byte indicated:

Spoiler:

Thanks to this interlinking we cannot simply open up palettes in a palette editing program such as APE, even if it is instructed to uncompress the palette.

There is one main way to find your palette. Search for the first string of four words of your background's 0x2 palette (I'll discuss palette 0x3 shortly). You can do this by entering a battle with your chosen background, opening the palette viewer and reversing the colour values (e.g 0x1234 becomes 34 12). In the last screenshot you can see this as the string '00 00 FC 73 D4 3F 90 3F' in front of the first marked byte. At this point you can just calculate the HEX values of your new palette and overwrite the current words but keep in mind the stray bytes - Leave them as they are.

Now when we check our background in-game:

Spoiler:

Awesome, we're almost done. This part of the tutorial is only needed if you have chosen to utilise palette 0x3 in conjunction with 0x2. Since palette 0x3 is interwoven with palette 0x2 it is generally more garbled and difficult to find if you don't know what to do. Once you have found palette 0x2's location, palette 0x3 should be somewhere nearby, but you should only search for the NEW values that are present in 0x3. In my case, when I searched for the grass background's first two new values in palette 0x3 (92 37 4E 37) I found them at 0x24842B. Changes these values (once again looking out for any stray bytes) and save your ROM.

Spoiler:

Let's check out our final result:

Spoiler:

Congratulations, you have just inserted your first battle background!


There are also some lesser know things you have to be aware of when inserting particular backgrounds.
  • The grass background also doubles as the background for when your Pokemon evolves. Be sure to not have an extra-large battle platform that stretches out into the centre of your tilemap in NTME otherwise it will be visible during the cutscene.
  • The Gym battle background is linked to the field and three other backgrounds. Their palettes are incredibly garbled and you would be lucky to get more than 7-8 colours out of them.

Alright, here's some fresh noob questions ready.

You do not have some of tiles in the condensed image, then how can you get them in the final screenshot?
In the hex editing part of the second palette, you said,"Change the bytes". But what to change those bytes into?
How did you actually make the second pallet, and how do you know that the way you lined them up will help it to match its place in the second palette?

These are the questions I have, and I am feeling like a total idiot right now :/
 

ScizorBlade

Sup Dogg
39
Posts
4
Years
I have a little question here. I inserted the battle background, but how can I assign them to an individual map? I tried going to header, and set the 'Type' under map options to other available options, but in vain. It was set as the first background that I added. So how can I change that?
 
2
Posts
3
Years
  • Age 26
  • Seen Oct 14, 2020
Is it possible to make it so the Battle Background is static upon entering the battle (the platforms don't move) as seen in Pokemon Adventure Red Chapter and (I can't post a link) but if you type in youtube dot com /watch?v=VKLYxx9jCvg you'll be able to see what I'm talking about... the trainer sprites slide into battle but the background and platforms do not go right and left
 

Dr. Seuss

Will finish GS Chronicles, I swear!
523
Posts
10
Years
Is it possible to make it so the Battle Background is static upon entering the battle (the platforms don't move) as seen in Pokemon Adventure Red Chapter and (I can't post a link) but if you type in youtube dot com /watch?v=VKLYxx9jCvg you'll be able to see what I'm talking about... the trainer sprites slide into battle but the background and platforms do not go right and left
First in a hex editor look for these offsets: 1C 00 00 04 01 00 60 A2 01 00 replace the 1C 00 00 04 with D0 70 03 02 and save (Applies for any ROM and any language).

Second look for these offsets. Thanks to Compumax and Derlo for the offsets

Fire Red:
08011D6C write 01
08011DA6 write 10

Ruby:
08010250 write 01
0801028A write 10

Emerald:
080397E4 write 01
0803981E write 10

Just open your game with a Hex editor and overwrite these bytes and this will stop the background animation
 
Last edited:
2
Posts
3
Years
  • Age 26
  • Seen Oct 14, 2020
First in a hex editor look for these offsets: 1C 00 00 04 01 00 60 A2 01 00 replace the 1C 00 00 04 with D0 70 03 02 and save (Applies for any ROM and any language).

Second look for these offsets. Thanks to Compumax and Derlo for the offsets

Fire Red:
08011D6C write 01
08011DA6 write 10

Ruby:
08010250 write 01
0801028A write 10

Emerald:
080397E4 write 01
0803981E write 10

Just open your game with a Hex editor and overwrite these bytes and this will stop the background animation

DUDE -- Thank you sooo much!!!!!
 
4
Posts
2
Years
  • Age 26
  • Seen Mar 19, 2024
Hi,

Thanks for sharing, I've applied these edits to my rom but was wondering, is there away to stop the player & front graphic from reversing left across the screen when I get into a battle?

It just looks a little strange with the animation.
 
Back
Top