Skeetendo

’Cause all games were better on the GBC

You are not logged in.

#1 2016-06-02 10:34:59

8405
Member
Registered: 2016-06-02
Post 1/11

Pokecrystal disassembly and maps

I've looked everywhere and tried my hardest, but I just can't figure out how to add new maps to pokemon crystal.

I'm pretty sure all the actual maps are contained in the .blk files, but I just have no idea how to edit them. I found one post on reddit that suggested using Crystalmap, but that just gave me a bunch of new problems:

1- How do I move the edited maps from the ROM to my assembly code? Is there even any way to do that?

2- If I add a map using crystalmap, how do I know how to connect to it? All the warps that the program shows me, when I click on them, it just tells me WARP TO, MAP, MAP BANK, but it's never explained how I can identify these things in a map I just made. Not to mention the problem with start adresses, all the existing maps already have them set, but what do I use in case I'm making a new map?

Is there a guide anywhere I can follow to explain me how this works? Is there any way of completely bypassing crystalmap?

Thank you!

Offline

#2 2016-06-02 13:15:16

Rangi
Member
Registered: 2016-05-09
Post 9/830

Re: Pokecrystal disassembly and maps

You can use crowdmap to add and edit maps directly in the assembly source code, no ROM needed. However, it doesn't let you edit tilesets, and I've found that it sometimes won't load custom maps.


ROM hack: Pokémon Polished Crystal (GitHub) — version 2.2.0 released!

Online

#3 2016-06-02 13:26:12

Rangi
Member
Registered: 2016-05-09
Post 10/830

Re: Pokecrystal disassembly and maps

I've been editing maps lately for an upcoming hack, so here's a guide to doing it the hard way:

• A map's scripts, warps, and sprites are defined in its maps/Name.asm file, which also has to be INCLUDEd by maps.asm.

• A map's ID, height, and width are defined in constants/map_constants.asm. The dimensions are given in blocks/metatiles, which are 32x32 pixels.

• Each map also has two headers, one in maps/map_headers.asm and one in maps/second_map_headers.asm. The first header is pretty self-explanatory, setting things like the tileset ID and background music. The second header defines connections to other maps, and the block ID of whatever block surrounds the map. (So a map using TILESET_JOHTO_1 that has surrounding block $5 will be surrounded by trees.) The three numbers in a connection are x-offset, y-offset, and breadth, but it may take a bit of trial and error to get them right for complex map joins.

• A .blk file is a sequence of width×height block IDs, in order from top-left to bottom-right (same order as with everything else). You'll need to INCBIN the .blk file in one of the maps/blockdata_#.asm files.

• Tileset IDs are referring to one of the tilesets/#_metatiles.bin files. (So if a map is using TILESET_JOHTO_1, which constants/tilemap_constants.asm defines as 01, then it's using tilesets/01_metatiles.bin.) A metatiles.bin file is a sequence of 16-byte groups, one group per block/metatile. The 16 bytes are a sequence of tile IDs for the block.

• Each metatiles.bin file is paired with a collision.bin file, which is a sequence of 4-byte groups, one per block. The 4 bytes are collision IDs for the four 16x16 sub-blocks. Common collision IDs are 00 for floor, 07 for obstacle, or 24 for water.

• Tile IDs are referring to the corresponding gfx/tilesets/#.2bpp.lz files. These files are compressed graphics storing a sequence of 8x8 tiles. You can convert them to PNGs with gfx.py ("python gfx.py png gfx/tilesets/#.2bpp.lz"), edit the PNG, and convert it back ("python gfx.py 2bpp gfx/tilesets/#.png; python gfx.py lz gfx/tilesets/#.2bpp"). Note that tile IDs skip the 32 values from 60 to 7F, so the ID after 5F is 80.

• Also, tilesets have palette data. tilesets/#_palette_map.asm has a sequence of color IDs, one per tile.

I have made a couple scripts to make manual tileset+map editing less troublesome. metatiles.py renders a set of metatiles and its corresponding tileset, with the colors defined by their palette. map.py renders a map, although you have to manually specify the height and tileset ID.

(crowdmap parses this kind of info automatically, but for some reason it won't load all of my custom tilesets, even though I follow the same formatting style as the original source code.)


ROM hack: Pokémon Polished Crystal (GitHub) — version 2.2.0 released!

Online

#4 2016-06-03 12:50:12

8405
Member
Registered: 2016-06-02
Post 2/11

Re: Pokecrystal disassembly and maps

Rangi wrote:

I've been editing maps lately for an upcoming hack, so here's a guide to doing it the hard way:

• A map's scripts, warps, and sprites are defined in its maps/Name.asm file, which also has to be INCLUDEd by maps.asm.

• A map's ID, height, and width are defined in constants/map_constants.asm. The dimensions are given in blocks/metatiles, which are 32x32 pixels.

• Each map also has two headers, one in maps/map_headers.asm and one in maps/second_map_headers.asm. The first header is pretty self-explanatory, setting things like the tileset ID and background music. The second header defines connections to other maps, and the block ID of whatever block surrounds the map. (So a map using TILESET_JOHTO_1 that has surrounding block $5 will be surrounded by trees.) The three numbers in a connection are x-offset, y-offset, and breadth, but it may take a bit of trial and error to get them right for complex map joins.

• A .blk file is a sequence of width×height block IDs, in order from top-left to bottom-right (same order as with everything else). You'll need to INCBIN the .blk file in one of the maps/blockdata_#.asm files.

• Tileset IDs are referring to one of the tilesets/#_metatiles.bin files. (So if a map is using TILESET_JOHTO_1, which constants/tilemap_constants.asm defines as 01, then it's using tilesets/01_metatiles.bin.) A metatiles.bin file is a sequence of 16-byte groups, one group per block/metatile. The 16 bytes are a sequence of tile IDs for the block.

• Each metatiles.bin file is paired with a collision.bin file, which is a sequence of 4-byte groups, one per block. The 4 bytes are collision IDs for the four 16x16 sub-blocks. Common collision IDs are 00 for floor, 07 for obstacle, or 24 for water.

• Tile IDs are referring to the corresponding gfx/tilesets/#.2bpp.lz files. These files are compressed graphics storing a sequence of 8x8 tiles. You can convert them to PNGs with gfx.py ("python gfx.py png gfx/tilesets/#.2bpp.lz"), edit the PNG, and convert it back ("python gfx.py 2bpp gfx/tilesets/#.png; python gfx.py lz gfx/tilesets/#.2bpp"). Note that tile IDs skip the 32 values from 60 to 7F, so the ID after 5F is 80.

• Also, tilesets have palette data. tilesets/#_palette_map.asm has a sequence of color IDs, one per tile.

I have made a couple scripts to make manual tileset+map editing less troublesome. metatiles.py renders a set of metatiles and its corresponding tileset, with the colors defined by their palette. map.py renders a map, although you have to manually specify the height and tileset ID.

(crowdmap parses this kind of info automatically, but for some reason it won't load all of my custom tilesets, even though I follow the same formatting style as the original source code.)

Crowdmap is pretty amazing, seems exactly what I need.

I have however been having some problems with it. I tried editing NEW_BARK_TOWN, and adding a new route to the south of it. To do this I changed the map height in map_constants.asm. For some reason though, even if the map is higher than it was before, I can't seem to save any edits.

test bbcode test

I can save that small edit to the south just fine, but for some reason if I add more than that, say like this:

test bbcode test

The map just won't save.

Last edited by 8405 (2016-06-03 13:53:50)

Offline

#5 2016-06-03 13:36:34

Kuroko Aizawa
Member
Registered: 2011-12-01
Post 311/497

Re: Pokecrystal disassembly and maps

I have to turn off notifications when I save and spam click the save button for it to work. Not sure what's up with the map editor. Always compile after doing that before moving to another map because it doesn't work all the time >_>

Offline

#6 2016-06-03 13:54:59

8405
Member
Registered: 2016-06-02
Post 3/11

Re: Pokecrystal disassembly and maps

Pia Carrot wrote:

I have to turn off notifications when I save and spam click the save button for it to work. Not sure what's up with the map editor. Always compile after doing that before moving to another map because it doesn't work all the time >_>

I tried spamming the save button too, and it asks me if I'm sure I want to overwrite, however it doesn't seem like it's saving.

Anyways I figured out how to connect maps, so the above issue is kinda pointless now since I can just work around it. I am having problems with actually making the ROM however. When I try to run make from cygwin I get this error:

test bbcode test

Not sure what it means.

Last edited by 8405 (2016-06-03 14:10:02)

Offline

#7 2016-06-03 14:09:34

Kuroko Aizawa
Member
Registered: 2011-12-01
Post 312/497

Re: Pokecrystal disassembly and maps

I had this issue setting up yesterday, in your tilesets folder theres a bunch of files like data1.asm, data2.asm, etc. You have to move stuff in between those because Tileset Data 3 (data3.asm) is full. This is due to crowdmap.

Offline

#8 2016-06-03 14:11:06

8405
Member
Registered: 2016-06-02
Post 4/11

Re: Pokecrystal disassembly and maps

Pia Carrot wrote:

I had this issue setting up yesterday, in your tilesets folder theres a bunch of files like data1.asm, data2.asm, etc. You have to move stuff in between those because Tileset Data 3 (data3.asm) is full. This is due to crowdmap.

But I didn't change anything in data3.asm, it's exactly the same as it was in the github repository.

Should I just take random lines from it and move them to one of the other files? Is that still gonna work?

Offline

#9 2016-06-03 14:15:50

Kuroko Aizawa
Member
Registered: 2011-12-01
Post 313/497

Re: Pokecrystal disassembly and maps

It isn't the same, because you opened those files via crowdmap xD

EDIT: And yes, you have to move stuff in between those folders until none of them are full. It takes a while to get running. I know because I spent 2 hours setting up pokecrystal yesterday.

Last edited by Kuroko Aizawa (2016-06-03 14:19:26)

Offline

#10 2016-06-03 14:21:44

8405
Member
Registered: 2016-06-02
Post 5/11

Re: Pokecrystal disassembly and maps

Pia Carrot wrote:

It isn't the same, because you opened those files via crowdmap xD

EDIT: And yes, you have to move stuff in between those folders until none of them are full. It takes a while to get running. I know because I spent 2 hours setting up pokecrystal yesterday.

Yeah, you were right, moving stuff around fixed it.

I'm getting a buttload of new errors though, I was able to fix most of them but I'm stuck on this one

ea6ce1dec0.png

Offline

#11 2016-06-03 14:55:41

Kuroko Aizawa
Member
Registered: 2011-12-01
Post 314/497

Re: Pokecrystal disassembly and maps

It's the same issue. Look at the github source and find bank $77. I forget which data it was but you aren't quite done yet.

Offline

#12 2016-06-03 15:10:36

8405
Member
Registered: 2016-06-02
Post 6/11

Re: Pokecrystal disassembly and maps

Pia Carrot wrote:

It's the same issue. Look at the github source and find bank $77. I forget which data it was but you aren't quite done yet.

Any idea which type of file would contain that info? Should I just go trough every single script?

Offline

#13 2016-06-03 15:28:12

Kuroko Aizawa
Member
Registered: 2011-12-01
Post 315/497

Re: Pokecrystal disassembly and maps

https://github.com/pret/pokecrystal/sea … bank+%2477

main.asm, line 6300 and something. Tileset Data 7 has too much.

Offline

#14 2016-06-03 15:50:30

8405
Member
Registered: 2016-06-02
Post 7/11

Re: Pokecrystal disassembly and maps

Oh sorry, didn't know that was a thing that you could do with Github.

Problem is gone, but it's been replaced by bank $07, which is nowhere to be found. Any suggestions on what to do in this case? Are these problems always related to the data.asm files?

Offline

#15 2016-06-03 17:17:42

Kuroko Aizawa
Member
Registered: 2011-12-01
Post 317/497

Re: Pokecrystal disassembly and maps

$07 is another one of those data.asm files, but I don't remember which it is. After that one there shouldn't be any more error messages.

Offline

#16 2016-06-03 18:14:08

8405
Member
Registered: 2016-06-02
Post 8/11

Re: Pokecrystal disassembly and maps

Pia Carrot wrote:

$07 is another one of those data.asm files, but I don't remember which it is. After that one there shouldn't be any more error messages.

Fixed that problem just to find another. Now it's giving me an error related to the map I added:

10e1027849.png

ROUTE_101 is mentioned in 3 files (https://github.com/guru8bit/personal-cr … =ROUTE_101), and comparing it to other ASM files everything that's needed should be there.

Also, about the Data.asm files, if I was having all those problems just by adding one map, are they just going to keep popping up the more maps I add? I mean at some point I won't be able to move stuff around to make it work, which means that I wouldn't have any more space to add maps.

Am I understanding how this works or am I sounding crazy?


EDIT: Nevermind, got it. Seems like I had forgotten to edit landmark_constants.asm

I think I might have it from here on out. Thank you guys so much for all the help!

Last edited by 8405 (2016-06-03 19:26:15)

Offline

#17 2016-06-03 20:34:52

comet
Member
Registered: 2012-04-09
Post 644/679

Re: Pokecrystal disassembly and maps

Pia Carrot wrote:

I had this issue setting up yesterday, in your tilesets folder theres a bunch of files like data1.asm, data2.asm, etc. You have to move stuff in between those because Tileset Data 3 (data3.asm) is full. This is due to crowdmap.

8405 wrote:

But I didn't change anything in data3.asm, it's exactly the same as it was in the github repository.

Pia Carrot wrote:

It isn't the same, because you opened those files via crowdmap xD

EDIT: And yes, you have to move stuff in between those folders until none of them are full. It takes a while to get running. I know because I spent 2 hours setting up pokecrystal yesterday.

It's pokecrystal's fault. Decompressing the tileset graphics forces it to recompress them, which ends up bigger than the originals. You can run "git checkout gfx/tilesets/*.2bpp.lz" to fix this.

You can also run "git checkout tilesets/data*.asm" to undo the changes to those files, if you feel like it.

Last edited by comet (2016-06-03 20:35:44)

Offline

#18 2016-06-03 20:45:38

8405
Member
Registered: 2016-06-02
Post 9/11

Re: Pokecrystal disassembly and maps

On another note, despite the map working pretty much perfectly, I can't seem to figure out how to set a custom map trigger for the new map. (the name of the area that pops up when you move to a new map)

I supposed most of these are contained in map_triggers.asm, but even after adding


trigger_def ROUTE_101,                              wRoute101Trigger

and


wRoute101Trigger::                           ds 1 ; d9c1

to wram.asm, I can't find anything else where to actually set what should pop up. Before adding this I got a string of question marks, now it's simply empty.

Am I looking in the right place or is this just wrong?

comet wrote:

It's pokecrystal's fault. Decompressing the tileset graphics forces it to recompress them, which ends up bigger than the originals. You can run "git checkout gfx/tilesets/*.2bpp.lz" to fix this.

You can also run "git checkout tilesets/data*.asm" to undo the changes to those files, if you feel like it.

That's good to know, wasn't sure if it would become a problem later on. Thanks.

EDIT: Tried using the tileset to png exporter (metatiles.py) but it doesn't seem to be working. No matter where I launch it from I get errors about it not finding the pallette or metatile I'm looking for. I tried launching it from /pokecrystal/, /utils/ and /tilesets/ but I get nothing.

I'm not sure if I used the right input from the terminal (I followed what it told me to use, python metatiles.py tileset 01_palette_map.asm 01_metatiles.bin).

Here's the errors I get

e89a938103.png

a230e91453.png

Last edited by 8405 (2016-06-04 01:09:31)

Offline

#19 2016-06-04 19:47:35

8405
Member
Registered: 2016-06-02
Post 11/11

Re: Pokecrystal disassembly and maps

So, I tried adding new tilesets.

First I edited 01.png, adding a new tileset to use in the white, unused part of the tileset. After editing 01_metatiles.bin it worked, crowdmap recognized it and I was able to add it to the game with its new collision. Only problem, is that the new image just wasn't showing up in the game. There was just a white tile instead of the image I added. I tried everything to fix this, and it's pretty evident that I can't add anything past that.

So, I've been trying to add a completely new tileset, but I can't figure out how to make it work. I added "TILESET_JOHTO_3" to my new map, only problem is that neither naming my 2bpp.lz file "TILESET_JOHTO_3" (like crowdmap asks me to) nor "37.2bpp.lz" seems to make the game recognize it.

What's the best way to get the game to recognize this new tileset I added?

Offline

Board footer

Powered by FluxBB