6
\$\begingroup\$

Generically speaking, how would you handle a huge 2D Map of which only a part is displayed? Imagine the old top-down racing games like Micro Machines.

I would know how to do something with a tile-based map, but I want to create completely custom Maps.

Target Devices are iOS, Windows Phone 7, Android, Mac and PC.

Assume the Map is too big to fit to fit into a single Texture. Would I have multiple textures, 4096x4096 each and load them all into RAM? Seems wasteful, and if textures are uncompressed I might actually run out of graphics memory.

Would I only load the max. 4 Textures that I need at any given point (when I'm at the intersection)?

Or would I have one huge image file and load parts of it? In that case, are there any image formats that make it easy (O(1)) to find the file offset and length which I would have to load?

Or is there a completely different algorhithm? Are textures the wrong idea?

How would you implement a game like Micro Machines?

\$\endgroup\$
3

2 Answers 2

3
\$\begingroup\$

In a map that is built from tiles, I have given a fairly full explanation of the approach I've found to work best down on the low end devices:

How should I represent a tile in OpenGL-es

Memory is the memory used by the tiles (not how many times they are reused) and the relatively small amount of memory used to index where to place each tile.

Maps like Terraria are entirely possible!

\$\endgroup\$
4
\$\begingroup\$

If you're not making use of tiles, but draw your entire map by hand, just split it into pieces - or tiles (-8

You need to experiment a bit with tile sizes,to balance constant loading/unloading of tiles (when tiles are small) and using more memory (when tiles are large). For example, on iPhone4 with 960x640 resolution, you may use 1024x1024 tiles and have no more than 4 of them loaded at any given moment. Or have 9 512x512 tiles, arranged in a 3x3 grid.

\$\endgroup\$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .