1
\$\begingroup\$

Okay let me start off by saying I have searched for several days on this topic, and it seems that either nobody posted anything about it, or it is on the internet, but too far buried under piles of useless information for me to find. I have created a custom terrain algorithm in Unity and have built a parser to read provinces onto the map.

The short version description of the parser is that it goes into the assets folder, finds "map/provinces.png", reads the borders of the provinces as vertices, reads "map/height.png" to determine the height of the visual terrain, and reads "map/terrain.png" to determine how much of each province is of each terrain (for example, Paris can be 95% urban, and 5% forest in my setup).

I want to make each and every one of the 500 european provinces start with a player. The idea is that the players will fight small-scale wars for 30-40 turns, by which point most or all small players will be absorbed into the most successful players country. These will then fight for 60-80 turns for dominance, with alliances being forged and broken and countries being destroyed. The problem is described below;

Each player has his own unique color. Many of the players will obviously have similar colors, and I do not want 2 dark red countries bordering eachother without some easy way to see the border. I want to basically draw a line in between any two provinces that belong to different players and border each other. I am having trouble finding a way to easily do this, as my current solution tests all provinces if they border foreign provinces, and runs a rather expensive test on each of the bordering provinces vertices to see if they border eachother, then stores those vertices as vectors and draws a line from each vertex to its others.

I have considered using a shader to accomplish this, but was unsure if that was the right approach and whether or not that would (or could?) be more efficient.

\$\endgroup\$
2
  • \$\begingroup\$ Somewhere around here there's a question asking to do exactly this that had some good answers, I just can't find the thing... \$\endgroup\$ – user1430 Aug 17 '16 at 22:46
  • 1
    \$\begingroup\$ @JoshPetrie Something like this? gamedev.stackexchange.com/questions/87396/… \$\endgroup\$ – MichaelHouse Aug 18 '16 at 5:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.