#5639 - twillinx - Sun May 04, 2003 4:17 pm
My question regards the maps for GBA, I'm currently using a 512x512 size map.
If I look at a game like SM World for example the maps in that game is ALOT bigger than 512x512.
Is it possible to load a lot of maps at startup and then shift maps at a certain X-value? How many maps would fit in to the GBA-RAM if possible?
Right now it takes about 5 seconds after startup before I see any graphic (it's doing a loop to get all the mapdata into memory), and if it takes 5 seconds every time it would take quite some time to start the game, if I look at Metroid or Castlevania they don't seem to have that problem.
#5642 - darkcloud - Sun May 04, 2003 4:56 pm
SM World probably uses a dynamic tile system so new tiles are constantly being loaded in and updating, that way, you can have a basically 'infinite' map size.
If you use DMA to copy your map data in, it will be much, much, faster and you probably won't see any delay at all.
_________________
Maybe in order to understand mankind, we have to look at the word itself: "Mankind". Basically, it's made up of two separate words - "mank" and "ind". What do these words mean ? It's a mystery, and that's why so is mankind.
#5643 - twillinx - Sun May 04, 2003 5:34 pm
After looking around a little more in the forum I found another topic discussing the maps, sorry. Ok, if the maploading would be faster I don't think there would be any problem loading new "maps" into my already existing 512x512 map, would there?
My idea is as follows, making alot of smaller maps (using a mapeditor, having them at the getgo once the games compiled) always writing over the old array of mapdata when the gamecharacter reaches a certain x-value.
What about the DMA? Never heard of it. :P But I wouldn't mind using it though.
#5644 - darkcloud - Sun May 04, 2003 5:45 pm
twillinx wrote: |
What about the DMA? Never heard of it. :P But I wouldn't mind using it though. |
DMA (direct-memory access) is a very fast way of moving data around in the gba, because the hardware does it for you.
It's very easy to use DMA and you'll definitely want to learn how to use it.
Check out the The Pern Project which has one tutorial about how to use DMA.
_________________
Maybe in order to understand mankind, we have to look at the word itself: "Mankind". Basically, it's made up of two separate words - "mank" and "ind". What do these words mean ? It's a mystery, and that's why so is mankind.
#5660 - twillinx - Mon May 05, 2003 11:58 am
Thanks alot, just what I needed, I will look in to DMA as soon as this problems solved.
One final (I hope) question about maps.
I'm using an array of 4095 to cover all the tilepositions for a 512x512 map, this doesn't work correctly though.
I've tried out to "lit" [0], [1] and [2] in my array mapData. What I thought was going to happen was that 3 tiles in a row would be "lit" and I was going to go on coding. The thing that happened was that there was a tilespace (8 pixels) between everyone of the "lit" tiles. "liting" [64],[65] and [66] of course gives me the same tilespace.
It looks like this:
XOXOX
OOOOO
XOXOX
when it should look like this:
XXX
XXX
I'm using rotationbackground, and thought the GBA could only handle 8x8 pixel tiles.
[2047] is the last tile I can "lit", although my Array should be up to 4095.
I've gone over the code over and over again, but I really need help (again) with this one.
#5661 - Quirky - Mon May 05, 2003 1:37 pm
VRAM (where the map is stored) can only be accessed as if it were an array of 16 bit values. So when you place your 8-bit map variables in there you need to do it 2 at a time. One way of going about this is:
bg.mapData[0] = mymap[0] | (mymap[1]<<8);
#5662 - niltsair - Mon May 05, 2003 2:16 pm
Another thing, you might want to use 256x256 background if you're implementing dynamic backgrounds (loading tiles as you need to show them). Because for each maps you're not using (in this case 3) you're freeing another 32tiles to use (64 Tiles in 16colors).