2D Territorial Control Game

I’m trying to make a 2d territorial control game in unity, and wondering what’s the best way to implement the 2D world map (which is essentially the main scene of the game.) game looks very similar as the Europa universalis as picture below:

alt text

The map will be split into provinces(regions),and there will be small objects showing up on the map (buildings, cities, armies, characters etc.)

Here are several major points which I’m pondering upon:

  1. how to properly detect mouse click (hovering over) a particular province. I’m thinking to load a relatively low res texture with each province painted in its unique color. and listening to mouse click, transform the click position onto texture coordinates, get the color of that pixel thus have the province Id. but the question is which function can I use to index a texture and figure out the pixel color?
  2. when hovering over a province, it will be highlighted. what’s the best way of implementing that. I may need to crop the provincial texture I mentioned above into pieces (one for each province) and dynamically create one object for each. And then hide all of them but the one currently hovering over? Again not sure how to crop texture into small textures at runtime. Or will it be a better choice to use shaders?
  3. What’s the most efficient way of displaying small objects on the map? the immediate solution I could think of is to make one plane for each object (the objects need to be spawned/destroyed dynamically)

Thank you all in advance. It’s kind of a unusual use of unity, hoping to be able to gather some ideas here.

#1 You’re on the correct track with your thinking here. You’re going to want to enable Read/Write in the import settings for your GUI textures and then use Texture.GetPixel to sample values from the texture.

#2 and #3: You should split all the textures up and draw them independently using either GUI.DrawTexture or as billboarded planes in the scene. Create different textures for the states of your objects (normal, selected, hover, etc). You probably won’t need to worry about performance here unless you’re going to have 500 or so different images on screen. Keeping draw calls down is good, but for pretty much any modern hardware, I doubt you have much to worry about.