Board like strategy map

I want to make a strategy game like Risk. I want to use C# for the mechanics and Unity for the graphics.

My problem is that I don't know how to create the map itself and integrate it with C#. I don't want a tile map but instead I want to create a customized world map, with different provinces defined by me.

The map would be something like Imperial Glory, where you see it top down and then move your generals like chess pieces. I'm not implementing any real time battles at this point, it's just something really simple, like a board game. Could anyone please help me?

I'll try to explain it a bit better: I need to create a map of the Mediterranean basin that would cover all the land occupied by the Romans at the height of their empire.

Next, I'll divide the map into 20 provinces (Italy, Gaul, Germania, etc), each one producing a set ammount of resources and population. I also want them to have their own wheather and buildings (for example, you can only train soldiers in provinces that have a barracks). I guess I'll need a text box popup that appears when you click on a province to display it's information.

I'll also need some buttons to open dropdown menus or perhaps whole windows, for other purposes such as diplomacy, statistics, tech trees, etc.

I wanted the map to be in 3d because I think it would be much more interesting to look at it in perspective instead of flatten 2d.

I'm fairly new into Unity so I really admit that I have no idea where to start. Please, have patience with my ignorance. Thank you very much for all your help. If there are any doubts about my question, please let me know and I'll try to explain it better.

PS: I think I'll make it a turn based game since I think this would make it simpler to code and faster to run.

• Could you be more specific about what you mean by "customized world map"? On a Risk map, although territories look visually interesting, in terms of gameplay they are just a graph structure. – Anko Oct 17 '15 at 19:22
• By customized I mean with imperfect boundaries between the provinces, since I'm trying to avoid tiles because of the artificial look of the squares. – Celso Oct 17 '15 at 20:46
• Still more details please. Are you looking just for how to create the graphics or how to handle them as part of game logic? Do you want them to be procedurally generated? Raster- or vector-based? Do you need to be able to zoom the map? (You can edit the question to clarify.) – Anko Oct 17 '15 at 21:39

Unity is a game development platform that uses languages, such as C# and JavaScript, to create scripts that provide behaviours for elements within your game. If you're creating a 2D top-down game, you could use tools such as GIMP, Paint.NET or Photoshop to create graphics that you would import into Unity as assets.

For your map, you could create a world comprised of continents and provinces. Reddit's Worldbuilding subreddit (filtered to Maps) has some great examples, tips and tricks on creating worlds.

Example Map:

I moved these apart in Photoshop, making it easier to create a texture atlas, disabled the background, saved it as a .png file, and imported it into Unity as a Sprite with Sprite Mode set to Multiple. Finally, I created an empty GameObject called World, containing each of the continents, and a cube object behind them which fills the camera's view, acting as a surrogate ocean.

2D / 3D view of the result:

As you can see in the 3D perspective, the map is separated by four continents. My experience with Unity is limited, but this could be a good place to start, or give you an idea of what to do. I also suggest checking out Unity's official tutorials, their online forum and their answers site, if you want to learn more about the platform and how to use it.

• Could you please explain a bit more about how I would import the map as an asset? I'm not lazy about searching for what I need, (believe me, I've literaly spent the whole day trying to find an answer) but you seem to have already grasped the notion of what I'm looking for. – Celso Oct 17 '15 at 20:53
• Do I create a flat rectangule to serve as the "board" and then add the map as a texture? If so, how would I break it down into individual provinces? I need the provinces to change color according to the owner and I'll also need to store a bunch of variables for each one, such as resource production, wheather, buildings constructed and whether it's possible to build them or not (such as ports in inland provinces), etc.How would I get around to do that? Thank you for replying – Celso Oct 17 '15 at 20:58
• I edited my post to provide an example. – driima Oct 18 '15 at 2:03
• That actually looks pretty good. I try to get around and do the GameObjects and later I'll tell you guys how it went. Thank you. – Celso Oct 18 '15 at 9:07

Just as it has been said in the comments, it is not clear if you are asking both how to design/create the assets that will represent the provinces, or just how to connect the assets representing provinces within your C# code. My guess is that you are looking for the later.

So, first of all, you don't need to have one rectangle for the map and then subdivide it into the countries and then provinces. You could have a separate GameObject asset for each province. Then, a simple approach would be to give a proper name for each asset of each province, then to create in C# a custom class with a Dictionary that holds data for each province (the same can be achieved with a List if you prefer it over Dictionaries).

Then, each entry in such Dictionary would be a province with the Key being province name, and when you reference any given one (e.g. using the name of the province object that was hit by a mouse click), you could access its other info stored at that Dictionary entry. For example, for each enter in the Dictionary you could have a field for the number of units garrisoned there, another for the resources, another for weather, another with the color name of the owner, or even a sub-list within the Dictionary, containing the names of the neighbor-provinces of that province.

• Actually I need to know both: how to create the provinces and also how to connect them to the C# code for the game mechanics. Thank you for your reply, I'll check it out and come back later to tell how it went. – Celso Oct 18 '15 at 9:03
• If I were you, I would first try what I said: create one GameObject for each province in the map. It means, one 3D model for each or one 2D sprite for each. You can easily do that respectively in a free 3D modelling toll such as Maya, or even in Paint. If you have one GameObject for each province, it will be easy to use the codes I've linked to detect mouse click over each and then retrieve the info related to each from the Dictionary object. – MAnd Oct 18 '15 at 15:47

I was working on a very similar (but more complicated) project. The basic idea is to create a colormap and a 2D sprite and perform a per-province palette-swap in the sprite's fragment shader based on the province's RGB value.

Conceptually, you'd keep two textures, a colormap texture, and a lookup texture. The colormap could be whatever size you want, but the lookup texture has to be of size 4096*4096. The details are contained in the accepted answer to my earlier question on the topic.

This is a very graphically cheap way to do this, though it can be pretty computationally expensive to repeatedly update a large texture.

This also allows you the option of easily projecting your texture over a 3D terrain if you ever want to go that route (for example, if you ever want a map like the one in Risk 2, Europa Universalis, or Crusader Kings 2).

Another way to do it is to read through a colormap like the one in my linked question, and create 1 2D sprite per province. This approach was taken by the (now-defunct) Of Bears and Eagles project (which is coded in Java), but it is worth noting that a heavily-mutated private fork of the project is being run by Reddit user Kalelovil, and is pseudo-regularly updated here (the project on Reddit hasn't been very active, most of us who contribute do so over the project's Slack group). The project was recoded in C# once Kalelovil took over (in order to work with Unity), so if you want further details on how to write the map parser, I'd suggest seeking out Kalelovil on Reddit (he is active on Slack, so I imagine he is also active on Reddit, but I haven't checked).

I'd share my own code, but I use several classes and several files to generate my (now-obsolete) 2D maps, and honestly it would be extremely cumbersome to paste and format all that code (several hundred lines). This is pretty memory intensive, and it can be graphically intensive depending on the number of provinces you want to display, but it would be perfect for a game with only 20 or so provinces. You can use shaders to decrease granularity.

A third option would be to fork this Github project and use it to generate a 2D mesh for each province from a vector graphics file from path's. The linked file only handles the MoveTo and LineTo commands, but it can be easily modified to support Horizontal and Vertical commands. Other, more complex commands (Bezier curves and arcs) are going to be harder to implement, but are still within the realm of possibility.

Finally, as a last resort, if you don't mind paying large sums of money, the Unity Asset developer, Kronnect, has an entire string of (admittedly expensive, but extremely well-maintained and well-supported) assets that would definitely cover any and all map needs you might have. I personally own a copy of their World Political Map 2D Edition and their World Map Strategy Kit, and they both run like a charm. All the bottlenecks I have encountered (aside from the occasional bug which is usually fixed in a Beta within hours to a day of my report) have been in my code.