gbadev.org forum archive

This is a read-only mirror of the content originally found on forum.gbadev.org (now offline), salvaged from Wayback machine copies. A new forum can be found here.

Hardware > Map / Tile optimizations

#42 - Nessie - Wed Jan 01, 2003 9:38 pm

I've been searching around for details about how the hardware processes the map/tile data and wondering how to best set up. I'm not sure I've found the right answer, so I guess I'll ask here. Example:

I've checked out the GBA Castlevania games and it looks like they have the background on one BG layer and any surfaces that the player walks on, on a seperate BG layer on top of that. The background BG layer is pretty dense, ie, there don't tend to be many spots where there aren't any tiles being rendered, but the top BG layer hardly has much stuff being rendered at all.

Finally, to my question. :) How do I best handle these large open areas? Can I flag a map tile as being completely transparent so it doesn't even try to render that tile spot? Or do I have to create a tile with color 0 ( transparent )...and then paste that everywhere I want to be able to see through to the backbround BG layer? That seems wasteful if it has to churn through all of those transparent pixels in the tiles if it doesn't have to.

#46 - marschild - Wed Jan 01, 2003 10:06 pm

waste of cycles, hardware does everything just fine.

Last edited by marschild on Wed Jan 08, 2003 12:39 am; edited 1 time in total

#47 - Splam - Wed Jan 01, 2003 10:13 pm

Yeah, just do it with blank tiles, the hardwares going to decode the screen if there's anything there or not. If you write your scroll routine properly you should never be updating more than a few tiles each frame anyway.

#53 - Nessie - Thu Jan 02, 2003 12:04 am

Yeah, I guess I was wondering if there was any way to clue up the GBA hardware tile rendering to skip blank tiles. I hadn't seen any way to do it, and therefore figured you can't, but just thought I'd ask to make sure.

I wonder though, wouldn't such a thing make sense if you want to get the best performance out of the hardware? ie, why Nintendo didn't design it that way....or maybe the hardware tile rendering is so fast that it's trivial...

Oh, well thanks for the clarification.

#57 - Costis - Thu Jan 02, 2003 1:24 am

Hi,

You only need one blank (color 0) 8x8 tile, which just takes up 64 bytes of VRAM. That is how all GBA programs achieve complete transparency in tiles between layers. Other than turning off the whole layer, there isn't any visibility flag for individual tiles in a map.

Costis

#67 - Splam - Thu Jan 02, 2003 2:45 am

or a 16 colour one if you're not using rot/scale mode then its only 32bytes.

#427 - Ped - Tue Jan 07, 2003 5:49 pm

You can't do any hint to hw about empty tiles (except disabling whole layer).

Reason:
There will be always some game, which will need partialy transparent tile (i.e. just few pixels on few lines, rest is color0), so they had to do hw capable to render this worst case.
Now whatever hint technology you would add to that, it'll make the hw more complex. The only gain is the speed of rendering, but this doesn't apply as:

time consumed by rendering a line is FIXED, it's not PC-like 3D hw, where you aim to render some poly as fast as possible, because you can render the next one sooner than.
The hw renders line by line, and every line must be rendered in certain time span between two HBLANKs ... so once you have hw capable to render the worst case in this time span, you don't have any reason to make it more optimal for other case. You'll get more complex hw and you will be wasting cycles in gfx-processor w/o use.

Actually there are some hw sprite limitations per line, so the hw is *NOT* fast enough for worst case (i.e. rotated tilemap + 128 rotated sprites), but Nintendo probably wished to keep hw as simple as possible. (and I'm no hw geek, so I'm not sure, how much more complex would be hw using some hint system and spending more time on sprites). Anyway there would be big difference in spared time for empty/full lines, so this will hardly help to put up more sprites practically.

I hope I sound understandable, sorry for my english ... :)
_________________
-- Ped - ped at 7gods dot sk
there used to be times, when sex was safe and flying was dangerous...