News:

Don't forget to visit the main site! There's lots of helpful docs, patches, and more!

Main Menu

Inserting Tilesets into MZM/MF

Started by FlamingCobra, November 25, 2012, 07:06:42 PM

Previous topic - Next topic

FlamingCobra

Before we begin, you should understand how tilesets work and how they are stored. If you already know all this, too bad.



When you open up DH and look at the tileset widget, you'll see that all the tiles are laid out for you in an easy to understand format. The tiles look exactly like they do in-game, and the way they are laid out makes perfect sense. However, tiles are not stored this way.



If you open up the Tile Block Editor in DH ("Edit TSA" under the menu; I'm assuming this means "Edit Tileset Arrangement") you can see how the tiles are actually stored. At first glance, it might not make a lot of sense. Just a bunch of fragments, scattered like a jigsaw puzzle. But there's actually an order to it all.

Each tile in the tileset is subdivided into four parts. Because a lot of the tiles in a tileset are the same (just flipped over to point in a different direction), tilesets are "reduced" to save storage space. This means the tiles are broken up into their constituent fourths, and all the duplicate (flipped over) pieces are taken out. Then all the pieces are lined up without gaps in between them. That is what you are seeing in the above image. It really cuts down on storage space. Somewhere else in the ROM, there's bunch of pointers that say "this is how you reconstruct the tileset from the jigsaw puzzle."

Ok, I think that covers how tilesets work. Now on to the main part of the tutorial.

First of all, you're going to need this and this. The first one, NLZ-GBA Advance, is what you are going to use to decompress/export and import/compress tilesets from Zero Mission. Or Metroid Fusion. There's stuff other than tilesets in there too, like graphics from cutscenes and the title screen logo thingamajig.

Usenti, found in the second link, is a graphics editor. It is a lot like paint, except it was made for spriting and tile editing. It supports palettes, has this little grid feature which is really awesome, and best of all (for our purposes), it can reduce the tilesets. Oh, and it also has this thing called "requantize," which lets you reduce the number of colors in an image. Great for getting that image down to 16 colors so you can import it as a background in DH. Or is it 32 colors?

Before we go any further, I want to point out something. This should be obvious, but when you import a tileset, it has to be in reduced form. Further, you will be replacing an existing tileset. But most importantly, the (reduced) tileset you are importing has to have the same dimensions as the one you are replacing. Oh, and I should have said this already, but ALWAYS BACK UP YOUR ROMS BEFORE YOU DO ANYTHING! always. ALWAYS BACK UP YOUR ROMS!

Alright, now here's the basic idea of what you're gonna do. If you are making a brand new tileset, you're going to make it in Usenti, reduce it, and then use the rearrange feature to make the reduced tileset the same size as the one you are replacing. Then, you're gonna convert the reduced tileset to 16 colors, import a grayscale palette, save it, and import it using NLZ-GBA Advance.

If you are porting a tileset from one GBAtroid to the other, you'll export the tileset from one game, use Usenti's rearrange feature to make it the right size, and import it into the other game.

In either case, if the tileset you're importing just won't fit, try replacing a different tileset. If you just can't get it to fit, or there's a tileset you don't want to replace, you're going to have to erase some tiles from the tileset you're importing.

If that was confusing, don't worry. I'm going to do walkthrough (with pictures!) of how it's done.

Ok, so here's what I did when I made the Green Brinstar tileset for my Super Metroid Advance hack.



There are three leftover tilesets from Fusion in the Zero Mission ROM. One of these, hex value "A", is from TRO (albeit with strange colors), and I used it as the base of my Green Brinstar tileset. It is shown in the first picture.
I changed the palette of this tileset in DoubleHelix to better suit my needs. The result is shown in the second picture. I then grabbed some tiles that Kenji created for the old First Super Metroid Remake project (third picture), took some vegetation from TRO-heavy tileset (fourth picture), and put it all together in Usenti. The result is image 5. The green pipe came from one of the Zero Mission norfair tilesets but that's kind of insignificant.

Using the super-helpful list I attached to the end of this post, we find that the leftover TRO set corresponds to 620 in NLZ-GBA Advance. I didn't have that luxury when I did it, because that list didn't exist. So I had to go through all those goddamn images in NLZ and figure out which tileset corresponded with what image. And there are like 50 tilesets and thousands of fucking images. And because all those tilesets were reduced, I had to compare them to the reduced tilesets that DoubleHelix gave me. You don't even want to know what kind of hell that was.

Anyway, I checked the "grayscale" box in NLZ because the default palette hurts my eyes, and then I clicked the "Save as bitmap" button. Now I have this:



Alright so I have the reduced version of the tileset I want to replace, and I have my new tileset open in Usenti. The image I got from NLZ is 256 by 184 pixels. So the new reduced tileset also needs to be 256 by 184 pixels.



After I removed the header tiles: In Usenti, I clicked "Image" and selected "Reduce tiles..." from the dropdown menu. I clicked the check box for "flip" since that needs to be checked for this to work. I leave everything else alone. After clicking "OK" I get a really column of tile pieces. That's not what I want. I need these pieces to be laid out in rows that are 32 fragments wide (each fragment is 8x8, and 256/8=32). So I click "Image" and select "Rearrange..." from the dropdown menu. In the dialogue box, I set the width of the image to 256 (because that's how wide it needs to be in pixels) and leave the height alone.



I end up with this. Now I want to convert the reduced tileset to 16 colors, and then import the NLZ image's palette.

To do this, I'm going to go to "Palette" and select "Requantize" from the dropdown menu. I type in "16" for the number of colors and click "OK". Then, to import the NLZ image's palette, I'm going to click "Image" and select "Import ..." from the dropdown menu. I'm going to make sure "Palette from image" is selected and then choose the NLZ image. Another dialogue box will come up, but I'm just going to leave everything as it is and click "OK".



My tileset is now reduced and made of 16 grayscale colors, and it has the same palette as the NLZ image. So I'm going to "Save As" and avoid overwriting the original image. When the "PNG Exporter" dialogue box comes up, I'm going to make sure the button for 16 colors is selected, and the box for "Transparent" is unchecked, and then I'm gonna hit "OK".

Now I'm going to BACK UP MY ROM and open Zero Mission with NLZ GBA Advance. And I'm going to check "Gray scale" and go to image 620. Then I'm going to click the "Import a bitmap" button and select my new grayscale reduced tileset and cick "Open". In the dialogue box that comes up, I'm going to leave the offset alone, make sure "Abort if new data is bigger" is checked, and make sure everything else is unchecked. And I'm gonna hit OK. And I'm gonna end up with this:



Everything looks good, so I'm going to click "Write to ROM" and close NLZ when it's done. Then I'm going to open up the Zero Mission ROM I just modified in DoubleHelix and see if it worked. And it did.



You can clearly see the vines and stuff. The palette's all fucked up, but you can fix that with DH's palette editor. After you do that, all that's left to do is reassemble the tileset using the Tile Block Editor ("General Tools" --> "Edit TSA"). Everything you did until now is easy. Reconstructing that tileset from the little pieces is going to make your life miserable.



Well, I think that's it for my tutorial! If you guys have any questions, just post a comment.

Good luck reconstructing those tilesets.

interdpth


Zhs2

Now turn it into a webpage and we can host it as a proper document on the Documents page!


FlamingCobra

come now. You know nobody uses that thing anymore.

Weterr123

Quote from: FlamingCobra on November 26, 2012, 09:59:08 PM
come now. You know nobody uses that thing anymore.

Not true. As someone who is still learning all this stuff, I can safely say that I have used and will continue to use the docs page.

Quote58

As someone who has made a hack and continues to hack, I can say that it is still useful.
There are plenty of docs in there for useful things you might have never come across, or never thought of.
what about project palette? what about Jame's guide to what each part of tileset palettes are for?

Quietus

Nice guide.  Perhaps if somebody were to do a beginners' guide like this for DH, then more people would hack Zero Mission, which would answer interdpth's eternal question. :oh:

Oh, and I too agree that the statement about the docs section is daft.  I'm always referencing it, both for my own use and when helping out new hackers.

FlamingCobra

Quote from: Quietus on November 27, 2012, 06:20:32 AM
Nice guide.  Perhaps if somebody were to do a beginners' guide like this for DH, then more people would hack Zero Mission, which would answer interdpth's eternal question. :oh:

Oh, and I too agree that the statement about the docs section is daft.  I'm always referencing it, both for my own use and when helping out new hackers.

What's his eternal question?

Quote58

why don't more people hack fusion and zero mission. It's one of the main site phrases.

Quietus

It's now even one of the quotes atop the site: "Why don't more people hack Fusion or Zero Mission?"

:^_^:

Edit: Pipped.