#28823 - Touchstone - Sun Nov 07, 2004 3:45 am
How do you guys incorporate image data in your games? Do you create a source-file containing required info, like size, tilebank and palette, or do you have some kind of file system and a big file image that is linked into the binary in some way?
How do you allocate tile RAM for your game, do you have a static allocation-table for each level or have you a more dynamic scheme that might let you load and unload tile data at any time? Perhaps with a reference-system that lets your code load the same tiles over and over again but subsequent loads will just reference to the first allocated space?
What I'm trying to figure out is how I should write an animation subsystem that will need to be able to load image data, so that it is suitable to as many development styles as possible.
Cheers.
_________________
You can't beat our meat
#28824 - tepples - Sun Nov 07, 2004 4:03 am
Touchstone wrote: |
How do you guys incorporate image data in your games? |
All is explained in the FAQ.
Q: How do I load assets such as audio and graphics from my program?
Quote: |
How do you allocate tile RAM for your game, do you have a static allocation-table for each level or have you a more dynamic scheme that might let you load and unload tile data at any time? |
The level of dynamic allocation in a scrolling engine depends on how much time the programmers have to debug a more complex allocator.
There are two ways to animate parts of the background: replace the tile data itself (as Super Mario Bros. 2 and 3 for NES do) or redraw the map with other tiles in the tileset (as Contra for NES does). For sprites, you can get away with allocating 0.5 KB of VRAM to each of 32 32x32 pixel sprites and the rest to smaller objects such as bullets. Details in my whitepaper on sprite cel VRAM, available from my GBA page.
_________________
-- Where is he?
-- Who?
-- You know, the human.
-- I think he moved to Tilwick.
#28834 - Touchstone - Sun Nov 07, 2004 1:09 pm
Thanks Tepples but I wasn't asking for help on how I could do it, I want to know how people have actually decided to do.
_________________
You can't beat our meat
#28837 - Krakken - Sun Nov 07, 2004 3:22 pm
I have made two tools for handling this, the first is a BMP > Tile converter which I use to convert and compress my tile data into a file that contains only the RAW data and nothing else. I then attach it to my ROM at runtime using my file system which is a little like tepples GBFS (GBFS would do the job fine also.)
It's a nice way to organise things I think. Plus it has the benefit of allowing you to use GBA-Crusher to compress your data.
I'm not quite sure what you mean about allocating tile RAM. I just organise how much I need on paper and the implement it. I've never had a project where it's been a problem.
#28839 - poslundc - Sun Nov 07, 2004 3:51 pm
I generally write converters that output data either as ASM files or C files. Stuff like entire images usually gets output as an ASM file, whereas I might use C files for things that have a smaller volume of data but more compilcated data structures.
Dan.
#28841 - Touchstone - Sun Nov 07, 2004 4:14 pm
Thanks guys.
Poslundc, do you have a tile memory manager or do you do like Krakken and statically allocate needed tiles for a scene?
_________________
You can't beat our meat
#28843 - ampz - Sun Nov 07, 2004 4:23 pm
tepples wrote: |
There are two ways to animate parts of the background: replace the tile data itself (as Super Mario Bros. 2 and 3 for NES do) or redraw the map with other tiles in the tileset (as Contra for NES does). |
Actually, there is a third way...
For things like blinking lamps/indicators and stuff on scifi/tech backgrounds (megaman style games) you can easily get away with just changing the color of the lamp/indicator in the palette.
#28857 - poslundc - Sun Nov 07, 2004 7:03 pm
Touchstone wrote: |
Thanks guys.
Poslundc, do you have a tile memory manager or do you do like Krakken and statically allocate needed tiles for a scene? |
I have a memory manager, but I don't use it for displaying large, static pictures. Instead (if I want to use a tile mode) my game sets up the tile background so that each tile in the map points to a sequential tile in VRAM, and then the tiles are loaded in directly from ROM. (My converter outputs the image in the agreed-upon tile format.)
Dan.
#28942 - Touchstone - Mon Nov 08, 2004 11:34 pm
Thanks for sharing, Dan and Krakken.
I wish more people where like you. :-)
_________________
You can't beat our meat