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:
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:
- 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?
- 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?
- 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.