Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

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?

share|improve this question
3  
2  
actually, winning answer to this: gamedev.stackexchange.com/questions/6443/2d-top-down-view-maps would just as well be the answer for your question, even though your question isn't a 1:1 duplicate. –  Jari Komppa Sep 29 '11 at 7:10
1  
Well, use Mr Carmack's engine: secure.wikimedia.org/wikipedia/en/wiki/MegaTexture (seriously, it might be worth investigating). –  jv42 Sep 29 '11 at 10:04
add comment

2 Answers

up vote 3 down vote accepted

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!

share|improve this answer
add comment

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.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.