#178012 - fluffypants - Wed Jul 17, 2013 6:05 am
So I'm putting the finishing touches on my NDS Tile Editor, Grout, and need to make a decision about saving map data. My tiles blocks are 16x16, split to 8x8, and then stuffed into BG_TILE_RAM. No big surprises there. Bonus ASCII illustration:
Currently in the editor I'm storing the map data as the original 16x16 tile indices, which saves me a little on ram, and I'm just transposing to the correct 8x8 indices when I copy from the map to the BG_MAP_RAM. This works, but is definitely slow (not enough that I need to refactor, but enough that I wouldn't want to do it this way in my game). It's mostly slow because I have to account for the meta tile h/v flips.
Given the previous tile illustration, if I wanted to flip that tile horizontally, I would need to re-position the meta tile like the following and set the hflip bit on each piece:
Which means that every time I set a map value on the hardware it has to check all the h/v flip edge cases and sort the meta tiles accordingly. Quite slow.
So with those details out of the way, my questions are:
1. Am I going about this incorrectly, because it seems like this is a bad way to shuffle map data to the hardware?
2a. Should I take the 4x hit on ram and just store my maps as 8x8 meta tile indices so that copying to hardware doesn't require any additional logic?
2b. Am I overly concerned about having the CPU process map data during copies?
Feel free to question my entire approach to this, I want to do it correctly. Thanks in advance.
Code: Select all
------- -------
| | | 0 | 1 |
| Tile 0 | ---> ---+---
| | | 2 | 3 |
------- -------
Given the previous tile illustration, if I wanted to flip that tile horizontally, I would need to re-position the meta tile like the following and set the hflip bit on each piece:
Code: Select all
------- -------
| 0 | 1 | | 1 | 0 |
---+--- --H Flip--> ---+---
| 2 | 3 | | 3 | 2 |
------- -------
So with those details out of the way, my questions are:
1. Am I going about this incorrectly, because it seems like this is a bad way to shuffle map data to the hardware?
2a. Should I take the 4x hit on ram and just store my maps as 8x8 meta tile indices so that copying to hardware doesn't require any additional logic?
2b. Am I overly concerned about having the CPU process map data during copies?
Feel free to question my entire approach to this, I want to do it correctly. Thanks in advance.