Search Unity

Question Any simple way to add "provinces" onto a map?

Discussion in 'Editor & General Support' started by SoullessPuppet, Oct 12, 2022.

  1. SoullessPuppet

    SoullessPuppet

    Joined:
    Dec 20, 2016
    Posts:
    7
    I'm making a strategy game, and would like to split a map I made into different provinces/states/tiles (I'll just call them provinces from now).

    My goal is to have each province to have a different shape and shaded in team colors, something like this map from "Nobunaga's Ambition".


    And here's the map I want to convert:


    The only 2 ways I could think of are:
    1. Create individual transparent sprites for each province in Photoshop, then layering them on top of the map in Unity as individual objects. This seems time-consuming because there are many provinces, and they'd also be difficult to modify later on.

    2. Create a single sprite of province borders, then layering it on top of the map. No more team colors, ownership is instead only represented by an icon on top of each province only, which also acts as the button to select the province. This somewhat compromises the readability and feel of the map.

    Is either of those 2 my best option? If not, is there any other way to make this map? Any other related tips are also very much welcome :3
    For context, I'm still a novice at Unity, and this is a small solo project (something that can have a beta release in 1 month of full-time work).
     
  2. Kurt-Dekker

    Kurt-Dekker

    Joined:
    Mar 16, 2013
    Posts:
    38,697
    It completely depends on your use case.

    First version should be completely hard-wired. Grab a pencil and draw your map right now on paper, maybe use colored pencils or crayons if you're ambitious. Then grab your phone, photograph it, put that image into Unity on a plane, and then put polygon colliders on the map and STOP WORKING ON THE MAP.

    Now go actually make the game because you will already have a fully usable map. As you go you will learn what your map needs to become. But you will NEVER EVER learn that in advance, certainly not by asking strangers on the internet. :)
     
  3. nasos_333

    nasos_333

    Joined:
    Feb 13, 2013
    Posts:
    13,349
    Hi,

    Can define polygons directly on Unity over a quad with texture set as the map

    https://github.com/NotWoods/unity-polygon-2d-editor

    Then can texture each polygon with the map texture and tailor it, using either multiple materials with offsets or a special material that will apply the texture in world space.

    The github link is a sample of how to make the polygon directly inside Unity, there can be many other ways, but this one is straightforward.
     
  4. SoullessPuppet

    SoullessPuppet

    Joined:
    Dec 20, 2016
    Posts:
    7
    Thanks for the reply!
    I'm still a bit confused by the redrawing on paper part. I can think of several reasons why it might be beneficial, such as ease of tweaking once I've copied the map over. But I'm not convinced it's worth the effort now that I am pretty satisfied with the digital version of the map (as in, I'm probably not going to change anything I already have, I just need to add the provinces). Is there an important benefit that I missed?
     
  5. SoullessPuppet

    SoullessPuppet

    Joined:
    Dec 20, 2016
    Posts:
    7
    Thank you, that looks like an amazing tool for adding the provinces. I've almost never worked with Materials, though. Time to hit the books.
     
    nasos_333 likes this.
  6. nasos_333

    nasos_333

    Joined:
    Feb 13, 2013
    Posts:
    13,349
    The easy way is define one material per province and apply the mesh, all with the overall same map texture. Then play with offset in material texture to make it adapt to the shape.

    That way is less optimal, but has its perks, for example can set properties per provence material if one is selected for example.