How to create provinces and borders by bitmap?
Hi, I'm making about creating 2D strategy game. I'm stucking on one thing that's the heart of my game, it is "provinces" the properties of my provinces are...
1) Can make freely shapes that's neither squares nor hexagons.
2) Can click on it and pop up any windows on screen (clickable provinces).
3) Can capture provinces like send troops to capture that province.
4) Can make country (the country depends on how many provinces it has).
This picture shows perfectly provinces that I needed. (Based on game Supremacy 1914)
Basely I want only how to create provinces by coding and using bitmap(bmg) picture or any way that you know and can click on it. The map would contain about 2,000 provinces(massive map).
Or create provinces and borders from bitmap (like this picture). (Sample bitmap provinces from Crusader Kings)
Thanks :)
If you only have a few provinces (like less than 100), you could get away with having a seperate GameObject with collider for each of them. If the count is higher, I'd create it as a a single mesh (even a simple quad) with a special bitmap "behind the scenes" which is color-mapped so each province has one unique color. The game reads the cursor position, converts it to the right pixel position on the bitmap, and reads the color information via GetPixel. Something like a dictionary is of course neccessary as a lookup table so colors are connected to the province data.
Yes, my map will contain more than 100 provinces maybe 2 thousands. If bitmap is the choice, so I want to know about how to create it step-by-step and code it.
That's a little much to ask for... UA isn't for "write my script for me" type of questions, I'm afraid. The general theory is already described in my post so I suggest starting from there. You really need to know how to use these three things:
Choosing the right collection type for using Dictionaries.
If you have any trouble implemeting any of these, feel free to come back and ask a new question specific to the problem at hand. Happy coding!
Answer by Bunny83 · Nov 27, 2017 at 10:44 PM
A similar question had been asked some time ago and i posted already an answer over there
Your answer
Follow this Question
Related Questions
Can't get object to destroy itself on collision. 0 Answers
What is the most effective way to structure Card Effects in a Single Player game? 1 Answer
Trouble with directing launched projectiles in Unity 2D 0 Answers
Vectrocity VectorLine Method not Making Multiple Points Line With List 1 Answer
Smooth touch movement on axis only while going up? 0 Answers