Jump to content
  • Advertisement
Sign in to follow this  
MikeCreeda

World Map Display

This topic is 2603 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I've been reading that the best way to do 2D graphics with the latest systems is to use a 3D quad with a texture applied to it. As part of my game (a Risk-a-like) I need to have a world map where each country can be clicked on and change colour multiple times per game. I was just wondering the most efficient ways of doing this and some of the pros and cons.

Here are the things I've been thinking about so far:
  • As far as I can see, the first problem is how to split up the map; whether to have the whole map as one quad and one texture, or to have every country or every continent represented by a separate quad. After this, how do I handle the colouring? A pixel shader? A vertex shader? Editing the texture details?

    • As a side thing, I guess there's also the question of how to handle clicking on a particular country. If the whole thing is on a single quad, I assume that simplified collision domains or something would be the best way to handle it, but if every country is on a separate quad with transparency, I don't know if there's a way to just trade the click straight through to the first solid colour hit.

      Anyway... You can probably skip all that stuff above, I just wanted to show that I'd actually thought about it before I came here and didn't just run here for a quick answer... I'm probably barking up totally the wrong tree...

      Anyway... Thanks for any help! :)

      EDIT: I should point out that this map is just a 2D map :) Risk-A-Like top down :)

Share this post


Link to post
Share on other sites
Advertisement
Maybe you should think of the way you are going to store this information. If you uses the idea of a heightmap, where each value is a given country, you can build class that will be able to return the current texture given the color of each country. This texture could be any part of the whole image so you can zoom in and out. This class should also be able to return a height (or country) given any X/Y value. Then you only need to build an UI component linked to this object.

I'm not a pro so maybe their is better solution,
Hope it help

André

Share this post


Link to post
Share on other sites
Is the map static - that is, do the countries change shape at all during the course of play, or are they produced at compile time as a resource? How big are the maps? How are they being created (e.g. in Photoshop)?

If they are static, you can cheat by creating a separate world map texture, using a unique color key for each county. Then it's just a matter of indexing into this off-screen texture at the proper coordinates, and cross-referencing the color to get the county. Even if the maps are dynamic, you can re-build this color key texture as needed, as long as this doesn't need to be done too often it shouldn't be a speed issue. It doesn't even necessarily have to be a texture, it could just be an array of integers (country indices) with each element corresponding to a map coordinate, but it would certainly be easier to produce the key map as an image in a graphics program.

There are algorithms for testing whether a general convex polygon contains a specific point, but this may be overkill for what you are asking.

I would also say it would be easier to go with one large texture for the map, unless the map is very large or dynamic.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!