Sign in to follow this  
d000hg

Implementing a 2D minimap using D3D8

Recommended Posts

While implementing a minimap for a RTS game should be pretty simple, doing it through D3D adds a little more complexity. I can see a few ways to do it, but I'm not sure if any of these would incur a serious performance hit or cause problems for my minimum spec (Geforce1 or the equivalent Radeon card). We have a static texture representing the terrain, on which data representing each sides' units & buildings should be overlayed, as well as possible map objects belonging to no player. One way to do it is to have our static texture, and a dynamic texture which is updated to show unit distribution. We can then use render-to-texture to a 3rd render-target texture and do it that way. But render-targets seem a bit OTT for such a simple thing. Or we could have our same static and dynamic textures, and then just render a quad using both textures in the first two texture stages - any card provides dual texturing these days. The 2D way of doing it would be to render the original terrain map, then manually draw coloured dots for the units. We can duplicate this by drawing small quads instead of dots, but the small scale might cause problems. I'm preferring the 2nd option but I wondered if there is something even better? As far as the dynamic texture goes, would people generally manipulate the pixels directly?

Share this post


Link to post
Share on other sites
Usually an RTS involves fairly dense areas, so drawing anything bigger than colored dots on the minimap probably won't do much for you. You can use the point size attribute to make the dots bigger, without actually having to draw a tiny quad.

As far as efficiency goes, first draw the minimap itself, then fill all of the dot positions into a dynamic vertex buffer and render it. There's no particular reason to affect the actual texture.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this