Image Storage
Do most people store a number of tiles in one bitmap, or do they store each tile or set of tiles (for animated cells) in one bitmap, and then create a unique surface for each tile? It would use roughly the same amount of memory, but I''m not sure if there would be any memory mangling problems. Any ideas?
Its most common to store a set of tiles as one bitmap then load that bitmap into one surface. It''s then easy to blt individual frames/tiles from the surface to where you want.
Just because the church was wrong doesn't mean Galileo wasn't a heretic.It just means he was a heretic who was right.
I would suggest create large bitmaps that contain tiles of the same style. An example would be all land tiles to include water for a season, e.g. LANDTILES_SUMMER. Then placing these tiles into a single surface. The tiles should be a fixed x and y dimension so accessing a specific tile is a simple matter. Trees in a bitmap/surface, the same for walls. I would like to know how others in the forum would handle this.
David "Dak Lozar" Loeser
bcs@iglou.com
David "Dak Lozar" Loeser
bcs@iglou.com
Dave Dak Lozar Loeser
"Software Engineering is a race between the programmers, trying to make bigger and better fool-proof software, and the universe trying to make bigger fools. So far the Universe in winning."--anonymous
"Software Engineering is a race between the programmers, trying to make bigger and better fool-proof software, and the universe trying to make bigger fools. So far the Universe in winning."--anonymous
I guess I am also wondering how to get around the limit on offscreen surface sizes not being able to be any bigger then the screen size.
With some tiles being as large as 190x80, theres a lot of shuffling envoled, that''s all.
With some tiles being as large as 190x80, theres a lot of shuffling envoled, that''s all.
If the version of Directx you are using is 5 or above, then you can store bitmaps in surfaces, which are larger than the primary one!
But
- not every graphics adapter can handle such large surfaces in videomemory
- surfaces should be not too large and should be in a square-like style (perfomance reasons)
The Smiling One (:
But
- not every graphics adapter can handle such large surfaces in videomemory
- surfaces should be not too large and should be in a square-like style (perfomance reasons)
The Smiling One (:
The Smiling One (:
I recommend keeping your surfaces to a 256x256 pixel size for performance reasons.
What I''m doing in my engine, is basically grouping tiles and objects into 256x256 surfaces.
Grouping them like this has some benefits. For example, say you have a region of your map that uses 40 tiles, and another region uses 40 different tiles. Grouping each 40 tiles together in 2 or more groups reduces the amount of time your game has to load them in from disk.
So if I was using tile sizes of say 32x32 then I would create a groupof 64 tiles and place them in one 256x256 bitmap, then load it into a surface. I number my surfaces from 1 to N, and tiles incrementally by surface, so to find tile with index 1591, we do : 1591/64 = resides in surface #24. offset into that surface is 1591 MOD 64 = 55th tile in that surface. (assummes base 0 index)
The above scenario is just an example but a basic guidline for grouping tiles. For surfaces that contain different sizes of tiles/objects you need some kind of indexing system.
What I''m doing in my engine, is basically grouping tiles and objects into 256x256 surfaces.
Grouping them like this has some benefits. For example, say you have a region of your map that uses 40 tiles, and another region uses 40 different tiles. Grouping each 40 tiles together in 2 or more groups reduces the amount of time your game has to load them in from disk.
So if I was using tile sizes of say 32x32 then I would create a groupof 64 tiles and place them in one 256x256 bitmap, then load it into a surface. I number my surfaces from 1 to N, and tiles incrementally by surface, so to find tile with index 1591, we do : 1591/64 = resides in surface #24. offset into that surface is 1591 MOD 64 = 55th tile in that surface. (assummes base 0 index)
The above scenario is just an example but a basic guidline for grouping tiles. For surfaces that contain different sizes of tiles/objects you need some kind of indexing system.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement