Drawing a Minimap

Heads-up - This is a C# game using XNA for a college project, hence the subforum

tl’dr at bottom

So I am having a little trouble at the moment with my minimap, not so much it working but it causing frame rate issues. The issues with the frame rate is already apparent as we are rendering everything at once.

We have a tile system for our map and the size starts at 160x90 tiles, with 2 layers so that is 28,800 tiles being rendered. Like I have said, it’s not optimized yet and culling and chunk system will be added with the next update.

Now if I go onto the medium map, which is 320x180 (115,200 tiles) the frame rate drops. If I render the mini-map it REALLY drops.

The way the mini-map is created is simply give it a new camera and spritebatch, the camera is basically just a tiny little version of the world camera with the render holding all the same data.

This means the mini-map is rendering 115,200 tiles and the world is as well.

The whole “just use a small camera and render your map in it” approach seemed logical but I could see it going tits up when big maps are loaded.

Now I can see that if we culled and drew only the tiles visible inside the camera bounds, we would be rendering (with default zoom) 40x23 tiles which is only 920 tiles, which is fine. However that mini-map is still drawing a whopping 57,600 tiles.

What other way could I do this?

A few requirements for the mini-map:

  • Must show the whole map
  • Must show stationary entities (buildings, walls)

These 2 requirements literally throw the entire “just use a shader and color each pixel to that of the terrain type (grass green, blue water etc)”.

What other methods can I do? Should I just forget those requirements and re-discuss the approach with the group?

tl;dr My mini-map lags my game as it is drawing everything over again, what do?