Skeetendo

’Cause all games were better on the GBC

You are not logged in.

#1 2012-06-29 09:48:31

Danny-E 33
Administrator
Registered: 2012-06-09
Post 17/1,021

Pokemon Red: Tile Blocks

So for my Red hack, I don't need to add any additional tiles, and I probably won't add any new tilesets, but I would like to add several new tile blocks (again, no new tiles. Just different combinations of existing tiles) Is this even possible? If so, could someone explain the structure of block data? It would be easy to move the blocks to free space and change the pointers, I would just like to know if the game has a limit to the number of blocks it can support in one tileset. Also, I wouldn't need to worry about collision data, right? Because collision data, which is pointed to in each tilesets' header, is assigned to the tile number, not the block number, right? And since I would only be creating blocks out of existing tiles, these blocks' collision data should be accurate, right?

Also, while on this subject: Just out of curiosity, how is the data stored for whether or not you can surf on a tile/block? (i.e. it either lets you surf or triggers the "No SURFing on [Pokemon] here!" message) Is it determined by saying: If the 12t byte of the current tileset header is an animation flag, then allow surfing on tile ox14? The water tile is ALWAYS tile 0x14 in every tileset that includes water, so there has to be a reason for this. If this is true, or if it is something else along these lines, this also means that surfing permisson won't be an issue with custom blocks, because when determining if surfing is allowed it refers to the tile rather than the block, right?

That's all I can think of right now. I'll post more questions related to this as I come up with them.
~Danny-E 33


Red Hack: Pokémon Prototype

Total number of registered users: 7000+
Total number of active users: ~12

Offline

#2 2012-06-29 13:55:46

Sawakita
Administrator
Registered: 2010-10-16
Post 271/364

Re: Pokemon Red: Tile Blocks

Basically each tileset has a set of pre-made blocks (they are 4x4 tiles each). You can read more about it in the rbheaders doc, under "Tileset Header Structure".

I don't remember exactly where the behaviour for surf-able tiles is defined, but a look at the tilesets' collision data might help. Or you could check the routines that handle the surf action. I recall doing some disassemblying of it along with IIMarckus, so you might find something in the disassembly.

Last edited by Sawakita (2012-06-29 13:56:46)

Offline

#3 2012-06-29 17:18:26

Danny-E 33
Administrator
Registered: 2012-06-09
Post 20/1,021

Re: Pokemon Red: Tile Blocks

Sawakita wrote:

Basically each tileset has a set of pre-made blocks (they are 4x4 tiles each). You can read more about it in the rbheaders doc, under "Tileset Header Structure".

Right, I understand all that. I've read that document so many times :P That document shows that each tileset and it's corresponding block data are in the same bank, and that the pointer for the block data is in the tileset's header but that's all it says about blocks. It mentions that the tileset has to be able to fit within $9000-$95FF in VRAM. But I'm interested in knowing if there is a limit on the number of blocks that can be defined within a tileset. I'll take a look at some block data and see what I can figure out as far as the structure of the data, and I'll try experimenting and see what I can do. I was only wondering if there was anyone here who has already tried this.


Red Hack: Pokémon Prototype

Total number of registered users: 7000+
Total number of active users: ~12

Offline

#4 2012-07-01 12:35:55

Sawakita
Administrator
Registered: 2010-10-16
Post 273/364

Re: Pokemon Red: Tile Blocks

Danny-E 33 wrote:

Right, I understand all that. I've read that document so many times :P That document shows that each tileset and it's corresponding block data are in the same bank, and that the pointer for the block data is in the tileset's header but that's all it says about blocks. It mentions that the tileset has to be able to fit within $9000-$95FF in VRAM. But I'm interested in knowing if there is a limit on the number of blocks that can be defined within a tileset. I'll take a look at some block data and see what I can figure out as far as the structure of the data, and I'll try experimenting and see what I can do. I was only wondering if there was anyone here who has already tried this.

Sorry, I tend to point the obvious sometimes.
Each block is referred to using a single byte; each map data is made up of bytes, each one referring to one block of the tileset used by the map. This means you can have up to 256 blocks for each set; that doesn't mean that each tileset's blockset contains 256 blocks, it only means that the existing code allows to reach that quantity. For instance, if you have a blockset that has 0x50 effective blocks and a map's data uses block 0x51 the map will render that block reading some data that wasn't meant to be used as "block data" (it depends on what is stored after the blockset in the ROM).

You'd have to repoint blocksets if you're going to extend them; it shouldn't be too complex if you're using the disassembly, it has already all the tilesets stuff disassembled and labeled. Maybe you don't even need to repoint them if the bank that contains the blockset is completely disassembled and has enough free space to handle the expanded data).

Offline

#5 2012-07-01 16:33:27

Danny-E 33
Administrator
Registered: 2012-06-09
Post 24/1,021

Re: Pokemon Red: Tile Blocks

Ok, thanks for explaining! :) I just really wanted to have more combinations of walkable spaces and the 2x2 tile rocks in tileset 0. I should be able to figure this out without too much difficulty, whenever I get around to it :)

Quick question though. The pointer to the tileset headers is at 0xC767, and that address reads BE 47. But which bank are the tileset headers in? Thanks for everything :)


Red Hack: Pokémon Prototype

Total number of registered users: 7000+
Total number of active users: ~12

Offline

#6 2012-07-04 14:10:05

Sawakita
Administrator
Registered: 2010-10-16
Post 275/364

Re: Pokemon Red: Tile Blocks

Tileset headers are in the same bank (bank 0x03).

Offline

#7 2012-07-04 19:41:33

Danny-E 33
Administrator
Registered: 2012-06-09
Post 33/1,021

Re: Pokemon Red: Tile Blocks

Okay thank you. :) and so I know that a block is refered to as a single byte, but how is the data for the definition of a block stored? Does each block have 16 bytes of the 16 tiles that make up that block?


Red Hack: Pokémon Prototype

Total number of registered users: 7000+
Total number of active users: ~12

Offline

#8 2012-07-05 14:01:52

Sawakita
Administrator
Registered: 2010-10-16
Post 277/364

Re: Pokemon Red: Tile Blocks

Danny-E 33 wrote:

Okay thank you. :) and so I know that a block is refered to as a single byte, but how is the data for the definition of a block stored? Does each block have 16 bytes of the 16 tiles that make up that block?

Exactly. Each block is defined by 16 bytes, each one specifying the corresponding tile. So each byte is like a sub-block. Sub-blocks are ordered from left to right, from top to bottom, like this sequence:

Block:
00 01 02 03
04 05 06 07
08 09 0A 0B
0C 0D 0E 0F

Offline

#9 2012-07-06 02:36:48

Danny-E 33
Administrator
Registered: 2012-06-09
Post 34/1,021

Re: Pokemon Red: Tile Blocks

Awesome! :)) I was just makin sure I'm lookin at it the right way. Thanks a bunch! I'm pretty sure I now know everything I need to know to add all the additional blocks that I want to tileset 0!


Red Hack: Pokémon Prototype

Total number of registered users: 7000+
Total number of active users: ~12

Offline

Board footer

Powered by FluxBB