A map, after being “built”, has to be split in various regions, each one with its own settlement. This is done in map_regions.tga, where the map is divided into smaller parts, each one using a unique RGB value, with all pixels of that colour belonging to the same region. Also, there single black (0,0,0) and white(255, 255, 255) pixels representing settlements and ports/fishing villages, as well as areas of the map representing sea bodies.
As you have definitely noticed by now, our new island, even though we did not do anything about it, has already been divided into several smaller parts and each one has been assigned to an already existing region. But opening your map_regions.tga you will see that the area between Sicily, Hellas and Cyrene is still coloured as a part of the “sea region”. So how did this happen? Every time a campaign starts, the game takes all the information from map_heights and map_regions.tga, compares the two files and then generates a new file, called corrected_map_regions.tga, which is essentially an adjusted version of map_regions. This file, which is stored at the main RTW directory, is the actual file the game uses when it runs a campaign - this does not mean however that map_regions.tga is not needed. Mappers usually create their map_regions.tga file, run a campaign so that the game generates the corrected_map_regions.tga and then copy the corrected version and put it in the place of map_regions.tga and continue editing that file instead. This saves them from the trouble of making minor adjustments themselves, just as it will save us from the trouble of creating the area of our new island on our own.
So, go to your main RTW directory, copy the corrected_map_regions.tga, then go to our modfolder, delete map_regions.tga and put the copied file in its place, after renaming it to “map_regions.tga” as well. Now open the file. As we have already seen in-game, the new square that has been created to represent our island has been coloured with various RGB values, which means every differently coloured part belongs to another region; usually the ones that are next/close to it. We want to make this island a new region of its own, so we need to find an RGB value that is not being used by any other regions and paint our square with it. I chose (253,67,233) for our example, which is a bright pink one, but you can use anything you want
as long as it is not used anywhere else on the file.
**Note:A good way to check that a region has its unique colour is using the “colour count” function that 2-d software provide. Before painting the region with your colour check how many colours your image uses. Paint your region and then check again. If the colour count has increased by 1 then everything is ok, otherwise you need to choose a different colour.
Using your colour paint the entire square. Once you’re done and everything is fine, it means we have a new region. But we are not done yet. A region also requires a settlement. Settlements are represented by single black (0,0,0) pixels. So, using that colour, paint a single pixel where you want your settlement. Generally, in land regions, that pixel must not border other regions.
**Note: If our island was flat and empty, you could put the settlement anywhere on it, but since we have rivers, mountains, volcanoes etc on it, the game will show you a relevant error message and then it will CTD if you put the settlement on an invalid tile. You will need a bit of trial and error here to get it right, or if you have used the same coordinates as me throughout the manual, you can put it on (117,123), where it works for sure.
Since this is an island, we want it to be able to have a port/fishing village, so we will have to add a “port” pixel as well; ports are optional though, even for coastal regions. Using white (255,255,255), paint a single pixel with at least one of its sides bordering the sea. Be careful not to put it on the pixel where our river mouth is.
**Note:Here are a few other things you should remember about regions:
- they should be 'convex' (one landmass, no inaccessible areas)*
- they should have only one settlement and only one port
- all land tiles should be part of a known region
- each non-sea region should contain at least some fertile tiles
- continuous sea surfaces should form one region
- the maximum number of regions supported is 200
- the distance between the centres of any two adjacent regions should not exceed 50 tiles*
*: not doing these things shouldn't cause a crash, but it may cause the AI to mess up. After you are done with this, your map_regions.tga should look like this:
Ok, we are now done with the graphical part of creating a new region. Now comes the time for some coding.
First we must “create” our new region, code-wise. The data for all the map regions are stored in the descr_regions.txt. Open the file and scroll down to the end. Copy the entry for the last existing region, press enter, and paste the copy right below. Time to edit it now, according to our preferences.
The first line you see is the internal name of the region itself.
**Note:Internal means that the info is what the engine uses, not necessarily what the player will be seeing on screen. It is a very important discrimination, that will be used throughout this manual.
Let’s name our region “New_Region” for now. Be careful with the upper/lower case letters and the underscores.
Right below is the internal name of the region’s settlement. Let’s name it “New_Settlement” for now.
The third line is the default_faction for that region. We will not get into the details about that here, but, roughly, the default faction is the faction that the region will be most loyal to. We will be making this island a greek colony, so we are going to use their internal name, “greek_cities”, for this line.
**Note:You can use here the internal names of any factions present on the campaign map, as these are coded at the top of descr_strat.txt.
The fourth line is the rebel “faction” that belongs to this region. We will be using an already existing rebel faction for the island, so scroll up (or ctrl+f) the text file until you find the entry for Syracuse (“Sicilia_Graecus” region), copy the rebel faction name from there (“Syracusans”) and put it in our new entry. So, when our region revolts, the rebels that will be spawned will be “Syracusans” and will use the appropriate units.
**Note:The rebel factions are defined in descr_rebel_factions.txt along with the units that “belong” to them.
The fifth line of a descr_regions.txt entry is the region’s RGB value we assigned it on map_regions.tga. So, just open the image file, find out what colour you used to paint our square and then write down its RBG value in that line, with a space character separating the three numbers from each other.
The sixth line is a comma-separated list of all the region’s resources, both trade (visible resources) and hidden ones.
**Note:Trade (or visible, as they are sometimes called) resources need not be listed here, if they are listed in descr_strat.txt. Declaration just in descr_regions.txt is enough to activate effects that require them (such as the building of mines where gold exists) but the model for the resource will appear only if the resource is declared in descr_strat.txt. We are going to follow vanilla’s example here however and list the resources in descr_regions.txt as well. Trade resources are defined in descr_sm_resources.txt. Hidden resources are defined at the top of export_descr_buildings.txt (more on that in another section of this manual)
Let’s decide what types of resources are there on our island… Ok, let’s have slaves, gold, olive_oil and grain. We can always add some more later, if we want to.
The seventh line of the entry is called “triumph value” and it is unused, so just ignore it.
The eighth line is the farming level of that region (indicates fertility). Let’s set it to 5 for now, we don’t want to make the island too productive.
If you have done all the above, your descr_regions.txt should be like that now:
Now that we have created our region and its resources code-wise, it’s time to also create the settlement for it and also put the resources on our map. Resources, as well as settlements and the buildings that exist in each one of them are defined in descr_strat.txt (it lies in the world/maps/campaign/imperial_campaign directory). The file can be roughly divided into 4 different sections, the first being the “options” section, the second being the “resources” one, the third being the “faction setup” one and the last being the “diplomacy” section. We will be focusing on the second and third sections for this manual.
First, search for the “resources section” text. Then scroll down to the end of the section (it should be line 440). We have added four resources in our region, so we are going to need four new resource lines. Copy the last resource line and paste 4 copies of it right below it. Each line’s format is the following: The word “resource”, then the internal name of the resource type we want and then the x and y coordinates of our map, where the resource will be placed. We know the names of our resources (slaves, gold, olive_oil, grain) but we do not know yet where we are going to place them. Let’s find out. Open up map_regions.tga. Now here is the catch. Your software counts pixels starting from the top-left corner, while RTW counts using the bottom-right corner as the (0,0) coordinate. So, if you try to match a coordinate from your .tga image to a point on the map directly, you will get the horizontal coordinate just fine, but you will get the vertical coordinate wrong. There are two ways to get the right vertical coordinate for a pixel.
a) Simply “flip” the image upside down in your 2d-editng software. Optionally, you can paint the pixel you want with a distinctive colour, so that you don’t “lose” it when the image is flipped. The pixel you want will now have the same coordinates in the image as it will have on the map. Just don’t forget to
NOT save the flipped image.
b) Note down the vertical coordinate of your pixel. Let’s say it is Y_img. We also have the total height of our map or our image; let’s name that H. The accurate in-game vertical coordinate of our pixel, which we will name Y_map, is given by this formula: Ymap = H – Y_img – 1.
We will be following the first way here, in order to avoid math. Choose a colour you want and paint with it the pixel where you want the slaves resource to appear. Then using different colours do the same for gold, then for grain and then for olive oil. Now flip the image (menubar->Image->Flip). Find the coloured pixels you made, and note down their coordinates. When you’re done, exit the file
without saving the changes.
Back to the resource section of descr_strat.txt. Fill in the proper coordinates we just found out for our added resources. That’s it, we are done with this; your descr_strat should be like that at this point:
It is now time to create our new region’s settlement.
Scroll down to the “factions” section of the file. Take some time to see how it is organised. In a nutshell, it is divided in several parts, each one for every faction. At the top of each faction’s part there is general info about the faction (faction name, starting treasury etc), then there is a list of all their starting settlements, then a list of their armies, their leading characters and their agents and finally information about the faction’s family tree. We will be dealing with the second part now, the one about the settlements.
Scroll down the file until you get to the “slave” faction’s part – we will give this settlement to the rebels for now. Scroll a bit further down, until you find the end of the settlements part. It should be line 4260. Copy the existing entry for the Tripolitania region and paste the copy below it. That will become the entry for the settlement we put in our new region.
Every settlement’s entry starts with the word “settlement” and then, inside curly brackets follows the settlements information.
The first line is the settlement level. There are 6 levels ranging from village (the smallest) to huge_city (the biggest) and the settlement level determines the buildings that can be built here, as more advanced buildings require high-leveled settlements to be constructed. For now our new settlement will be a small village, so don’t change this line.
The second line of the entry is the internal anme of the region where the settlement belongs. We named our region ‘New_Region’ earlier, so that is what we are supposed to put in this line.
Next comes the foundation year line, which is redundant, so leave it 0.
The fourth line is the starting population of the settlement. You can have anything here, between 400 and 50,000 and it is not linked to the settlement’s level, but it is usually better if these two are ‘compatible’ (ie a town-level settlement should have from 2,000 to 6,000 people, because if it had more, there would be high squalor). Set this to 500 for our settlement.
The next line is the settlement plan that our settlement will be using on the battle-map. Each settlement can have its own, specific one, otherwise if declared as “default_set”
It will be using the predefined plan for it’s culture/level combination. So, just leave this line alone for now.
The last line is the faction_creator, which declares who “built” the settlement. The buildings that exist in that settlement will look like the buildings of the faction that has been defined as faction_creator. We want our buildings in the settlement to look greek, so greek_cities is what we fill in here.
**Note:Any faction belonging to the greek culture would do for our purpose, but faction_creator is also linked to some other things we will not be analysing here, so we are going to use greek_cities.
Usually, after the faction_creator line, follows a list of the settlement’s buildings, but for now we are going to leave our settlement without any of them, so we will add nothing here.
And that’s it, we have created our settlement’s code as well, and descr_strat.txt should now be looking like this:
Ok, one final step to go before we are done. We have to update the list of regions and settlements with our island’s info. Go to the text/imperial_campaign_regions_and_settlement_names.txt and scroll down to the end of the file. We have to make two new entries, one for our region and one for its settlement.
At the very end of the line, write the internal name of our region enclosed in curly brackets. Now, using the ‘tab’ button and
NOT the spacebar, make three spaces and then write the external name of the region; the external name is what you will be seeing in-game. Make a new line and then do the same thing for the settlement’s name.
**Note:Remember that internal names can only use latin characters and the underscore, no special characters or spaces at all. The external names can use any character you lik, including spaces and punctuation.
After that, your imperial_campaign_regions_and_settlement_names.txt should be like that:
Time to check our new editions in game now. As always, delete map.rwm and start up BMM. Starting as the Julii, remove the fog of war and take a look at our island. If all went well, you should be seeing a new region, with gold, olive-oil and grain on it and also a lonely greek settlement, without any buildings or garrison and a fishing village on the eastern coast.
Good work, we have almost covered the basics of mapping; just a little more to go.