Hegemony III: Clash of the Ancients

Hegemony III: Clash of the Ancients

Not enough ratings
Setting up a basic strategy map for custom maps, exporting custom maps to a mod
By Fristi61
Covers the final steps necessary to get your custom map ready to be used by a scenario in your mod.
   
Award
Favorite
Favorited
Unfavorite
Introduction
Welcome to this tutorial, where we'll be covering the final steps necessary to finish your custom map so it can be used by your mod’s scenarios.
To be precise, we will first cover how to make a very rudimentary static strategy map image and minimap, and then loading it in your custom map. Secondly, we will cover how to export the map to your mod once it’s set-up correctly.
It won’t be playable in-game yet, since for that we need to actually set-up a scenario that uses the map we’ve made, which is beyond the scope of this tutorial but I will cover it in another tutorial shortly.

For the purposes of this tutorial, I will be using a very basic map I whipped up in about 15 minutes, as can be seen below.


Requirements
Software:
The Hegemony editor.
An image manipulation program such as Photoshop or Gimp with a DDS plugin so it can load and save .dds files.
For the purposes of this tutorial, I will be using Gimp since it’s free. It can be downloaded here: https://www.gimp.org/ and the dds plugin for it can be downloaded here: http://registry.gimp.org/node/70

Other:
A correctly set-up modfolder (more info on that here: http://gtm.steamproxy.vip/workshop/discussions/-1/490124466459802053/?appid=308173 and here: http://gtm.steamproxy.vip/sharedfiles/filedetails/?id=830903307 )

A custom map that’s basically done and ready to be put in game.

What that means is you should be done with Terrain, Texture Painting, Water, Pathing, Trees, Grass, Props, Cities, Forts, Resource Buildings, Fog Regions and (optionally) Sounds and Season Settings.
You do not need to have used Scenario Mode to assign factions to cities yet, the scenario stuff is actually separate from the map (and one map can be used for multiple scenarios).
Exporting strategy map data
Now, it’s possible to export the custom map without manually setting up a strategy map first. The editor will automatically export a strategy map to go with it. However, the automatically generated strategy map will likely be unnecessarily large (can easily go into the hundreds of megabytes) and will likely cause slowdown in-game. Also, it is not always aligned correctly.

So we’re going to manually export an editor-generated strategy map, then resize it a bit, load it up in our custom map, and then make sure it aligns correctly.

There are 2 ways to do this. The first is to simply hit the “save strategy map” button (in terrain mode, the second folder icon after “Strategy map: none defined”.)
This will give you a strategy map that’s basically the same as the map that you’ll see when zoomed out in the editor.


However, there is another way that offers some more advanced options available which are very useful.


This second method actually allows you to get information on pathing and water to show up on your strategy map as well.
There are three options for things that can be made to show up in the strategy map in, and you can choose which from the three you want. The editor will merge the ones you select into a single image.

The first one is terrain, this is the exact same as what you get when you export the strategy map regularly, and as what you see in the editor when zoomed out.
The colours represent the elevation of the terrain underneath it, blue is 0 altitude and below, green is between 0 and 1500, grey/white is 1500 and above.


The second one is water. This will display a deep blue everywhere there is a water region. Note that it will display blue everywhere there is a water region, not just the parts that are actually visible above ground.
What this means is that the edges of the water mesh, which are likely underground so that the player can’t see them, will show up in the strategy map as well, this will make rivers likely look much broader and weirder than they do on the physical map.


Lastly, there’s pathing. This displays red where there’s pathing regions (including water pathing and blocked pathing regions), yellow where there’s cities and light blue/cyan where there’s forts and bridges.
Using this option can make the strategy map look a bit ugly, but it will allow the player to see where they can and can’t move on the strategy map, which they can’t see otherwise.


And here’s what you get when you use all 3 options. It looks ugly, but does give the player a lot of information. Of course, you can edit it in an image editor to make it look prettier while preserving all the information.


So how do we do this? Well, first we open the command console by pressing F2.

We type a line that looks like this: saveheightfieldmap(“imagename”, 1, true/false, true/false, true/false)

“imagename” can be anything you want. It has to be between quotation marks. This is just the name under which the editor will save the image.

For the “true/false” bits, you’d type either true or false depending on if you want the option that they represent. The 1st one is for water, the 2nd one is for paths, the 3rd one is for terrain. So if you want water and terrain but not paths you’d go “true, false, true”


I’m going to use paths and terrain, but no water. I’ll just name the file “pathterrainexample.png”.

So my command line looks like this: saveheightfieldmap(“pathterrainexample.png”, 1, false, true, true)

We type that in the console and press enter. The file will automatically be placed in the Hegemony III install directory (if using steam it’s likely something like: C:\Program Files (x86)\Steam\steamapps\common\Hegemony III)
Resizing the strategy map image, converting to .dds, placing it in the mod
In my case, the map I made is very, very small, so the resulting strategy map is only 2 mb.
On a larger map, though, your exported strategy map can easily be as large as several 100s of megabytes, and can slow the game down.
We’re going to be resizing the image to a more manageable size, and converting it to a .dds file which’ll probably make it run smoother as well.

Go ahead and open the image in Gimp (you can do this step in Photoshop as well of course, but I’ll be covering how to do it in Gimp since that’s what I have).
Go to image - scale image. Change it to 4096*4096 (it’s the size used by the devs in the macedon mod so you know it works), hit scale.


At this point, you could use the map you have right now as a base from which to make a much more visually appealing strategy map. Just remember: DO NOT CROP ANY PART OF THE IMAGE AS THIS WILL MAKE IT MUCH HARDER TO ALIGN THE MAP CORRECTLY. If you wish to remove rough edges or anything for whatever reason, just paint over it with black instead.

Next, we go to file-export as, click “select filetype” and hit “dds image” (if it’s not there then you’ve not installed the dds plugin correctly). Navigate to your mod folder’s resource folder or a subfolder thereof, change the filename if you wish and hit export. In the next screen, set compression to “BC1/DXT1” and mimaps to “no mipmaps”, hit OK.

Loading and aligning the strategy map in your custom map
Back in the Hegemony editor, go to terrain mode and press the “load strategy map” button (the first button after “strategy map: none defined”) and navigate to your strategy map image in your modfolder’s resources folder (or a subfolder thereof).


Now, the strategy map image likely won’t align quite right by default, as you can tell in the below screenshot by the positions of the cities.


This is because the editor always exports the strategy map in the shape of a square, grabbing extra empty tiles as necessary to fill out the square (you can see in the screenshots of my strategy map, it grabbed a few rows of empty tiles along the south so the strategy map is a square).
However, when loading the strategy map the editor then doesn’t account for the empty tiles the strategy map has and will likely project the strategy map which is square onto an area which is not a perfect square but merely rectangular.

To fix this, we want to manually set the area over which the strategy map projects to be a square, so it includes the same empty tiles that are accounted for in our strategy map.

To do so, we click “set strategy map bounds”. Now, we look at the numbers here. We calculate the difference between the 1st and 3rd numbers and the difference between the 2nd and 4th numbers to measure the dimensions of the area over which the strategy map currently gets projected.
The difference between the 3rd and 1st number for me is 91-79=12 and between the 4th and 2nd it’s 89-79=10. So it gets projected on an area 12*10 tiles large. We need these dimensions to be equal in length, with the shorter one becoming as long as the longer one. So we need to change it to an area 12*12 tiles large.
To accomplish this, we increase the 2nd number of whichever dimension is shortest (so if the distance between the 1st and 3rd number is shortest, then we increase the 3rd number, if the distance between 2nd and 4th is the shortest, we increase the 4th number).
In our case, we increase the 4th number by 2, and then we press ok.


If done correctly, the strategy map should now align correctly (you can tell from the positions of the cities and forts if it does).


Next, we set the minimap. We can just use the same image that we used as our strategy map. Go to the “load minimap file” button and load the same .dds image within your mod folder’s resource folder.

Building the map
With the strategy map and minimap set-up correctly, the map is now completely done and ready to be exported. This is really simple. Just go to the file menu in the editor (top left button) and hit “build release map”. Navigate to your mod folder’s resources folder or a subfolder thereof, and hit save.

NOTE: Your computer will be pretty much unusable while the editor is building the release map. This process can easily take a good amount of time depending on the size of your map and the strength of your computer. It may seem like your computer is frozen (there is no progress bar or anything like that) but do not panic, do not try to close the editor, simply remain patient. This process can easily take 15 minutes or more for larger maps. I imagine it taking an hour is not even out of the question for very large maps.


You will know it’s done when the file menu closes (it will remain open, likely with your cursor stuck on the “build release map” option, throughout the process) and you are able to move the cursor again.

Well, now you’re done! Your map is done, now you just need a scenario taking place on the map to be able to play the map. That is covered here: http://gtm.steamproxy.vip/sharedfiles/filedetails/?id=880513993

If anyone has questions, ask and I shall answer.
8 Comments
Bdeslaurs 21 Dec, 2021 @ 10:40am 
I also found the strategy map exemple they left on their google drive so I should be fine with that part too now.
Bdeslaurs 21 Dec, 2021 @ 10:39am 
oh ok, yeah that did it, thx :)
Fristi61  [author] 21 Dec, 2021 @ 6:15am 
That would suggest it has trouble parsing the input of the file-name you specified.
Did you copy that line from this guide directly? If so, don't do that, but actually type it out yourself by hand in the console.
Bdeslaurs 20 Dec, 2021 @ 1:36pm 
i'm getting a crash with "Invalid UTF-8 string" error when i try the: saveheightfieldmap(“pathterrainexample.png”, 1, false, true, true)
Apparently one of the character isn't valid or do I need a .str? Have you ever encountered this?
Bdeslaurs 20 Dec, 2021 @ 9:58am 
ok thx you for your information and your undying help in this forum :)
Fristi61  [author] 20 Dec, 2021 @ 1:18am 
Well it depends.
You can make a "simple" strategy map quite easily by just taking the exported strategy map data and editing it in some image-editing software (GIMP, Photoshop).
I think this is basically what SGZ does, but he does it very extensively and also adds in (static) city names to the image itself.

You can also opt to make a more dynamic strategy map that functions just like the Vanilla version, with extra layers that show or hide certain things (mountain/tree/swamp sprites & dynamic city/area names) depending on the zoom level.
This is the method I use for my own (Latium and Iberia) mods. I figured out the process for this by reverse engineering the vanilla strategy map, but I've never found the time to write a guide for it...
If you're very curious you could look at the files in the vanilla installation or in the installation of my Latium/Iberia mods to see kind of what it looks like...
Bdeslaurs 19 Dec, 2021 @ 10:12pm 
Damn, I can't image how much time it must have took you and SGZ to make your custom strategy map. Do you have any advice?

Also thx you for your guide :)
SGZ***71 6 Mar, 2017 @ 6:44am 
And thanks for this one too. I'm keen for the next step. ie adding factions and scenarios when you get a chance. Cheers mate.