You are on page 1of 14

Creating a World – Basic mapping from scratch

Contents
Required installations:........................................................................................................................................2
A Note to GIMP users........................................................................................................................................2
First steps - Modding of the modding folder (I love those word plays)............................................................2
Know your GIMP...............................................................................................................................................3
The map files......................................................................................................................................................4
Outline................................................................................................................................................................5
Filling.................................................................................................................................................................6
Layers.................................................................................................................................................................6
High creation......................................................................................................................................................6
Down from the height, onto the ground.............................................................................................................6
A Region, my kingdom for a region..................................................................................................................7
More features.....................................................................................................................................................8
I like tropical climate.........................................................................................................................................8
Of fog and water.................................................................................................................................................9
And then there were leftovers............................................................................................................................9
Other non-essential graphic files........................................................................................................................9
All the text..........................................................................................................................................................9
Configuration.cfg file.......................................................................................................................................13
Additonal Links................................................................................................................................................14

Required installations:
1. The GIMP, a free graphics program
2. ‘Bare Geomod Kingdoms’, a basic Kingdoms folder
3. M2TW Kingdoms Expansion
4. Map of Iceland

A Note to GIMP users


This tutorial is written for an old version of GIMP (2.6) – if you are using a newer version please keep in
mind that you will have to use ‘export’ and ‘export to’ instead of ‘save’ an d’save as’.

First steps - Modding of the modding folder (I love those word plays)
The ‘Bare Geomod’ installation will have created a new directory in M2TW\mods (provided you followed
instructions) that is aptly named ‘bare_geomod’. For the purpose of this tutorial, I want you to rename it
‘MyMapping’.
Small warning: if you do not type the names of files or directories in the way it is done here you will have a
CTD, so please don’t rush!
After this, we need to turn our attention to the ‘configuration.cfg’ file in that directory. Open the file with
Notepad and change this entry ‘mod = mods/Bare_Geomod’ to read ‘mod = mods/MyMapping’. Save and
exit. For those of you curious enough to have a look at the rest of the file: we will come back to a few of
these entries later.
Unfortunately this nifty installation does not come with a map directory, which means more hard work for
us. Create the following directory: data\world\maps\base. Once done repeat the fun and create this directory:
data\world\maps\campaign\imperial_campaign.
Here now the last preparation: create a new text file in the data\world\maps\base directory by right clicking
in an empty space of that directory; choose ‘New’ and then ‘Text Document’. Name this document
‘descr_terrain’. Copy the following lines into this file, save and exit:

dimensions
{
width 225
height 250
}
heights
{
min_sea_height -3122.256
max_land_height 7511.272
}
roughness
{
min 50.000
max 200.000
}
fractal
{
multiplier 0.500
}
lattitude
{
min 22.000
max 56.000
}

I can hear a complaint: ‘Why didn’t we copy this file from the M2TW directory?’ Answer one: ‘Oops.’
Answer two: ‘Teaching you basic file creating so you don’t have an excuse when I am asking you to create a
file’.
Copy the ‘Iceland.gif’ file into the maps\base directory.

Note: the maximum value for the numbers marked in green is 510 for width and 510 for height.

Know your GIMP


To avoid repeating various settings from our work we have to enable a preference setting. Open the GIMP,
click on ‘Edit, preferences’. In ‘Tool Options’ tick mark ‘Save tool options on exit’. Click ‘OK’.
For easier access I suggest creating a short cut of the maps\base folder on your desktop – highlight the folder
in Windows Explorer, right click it and choose ‘Send To\Desktop’.

As a good exercise, we will convert the format and change the size of the ‘Iceland.gif’ file. Right click the
file and choose ‘Edit with the GIMP’. For the sake of convention, I will call the window with the map ‘Pic
window’ and the window with the tool options ‘Tool window’.
A note on resizing: any graphics program will slightly ‘distort’ (changing the RGB value of pixels) a picture
while resizing it. That is quite a cool feature when working with the picture of your dear and beloved ones,
but it is disastrous when working on map files that depend on certain RGB values. We come to the meaning
of ‘RGB’ right now. In the pic window go to ‘image\scale image’. Next to the Width and Height indicators
is a chain symbol. Click on it to disable automatic scaling. Enter 451 for Width and 501 for Height. These
are double the values in our descr_terrain file plus one pixel in case someone wonders. Look a bit further
down in that small window and you see a ‘Quality’ segment. In the ’Interpolation’ drop down list choose
‘None’, this prevents distortion.

Now click ‘Scale’. The pic looks rather small now and we will give it a new name. Click on ‘file\save as’. In
the new window, type ‘Map_big.tga’ in the name space. Take note of the new file extension – it will make
our life a bit easier as all the map files are in tga format. Clicking on a tga file should also trigger the GIMP
to open it (unless you have another sophisticated program like Photoshop already installed). Now click
‘Save’ twice. Close the pic window (exit).

The map files


The following graphic files are necessary to create a map:

Name Size (see descr_terrain.txt - dimensions)


map_regions default
map_features default
map_trade_routes default
map_roughness twice default
map_heights twice default plus one pixel
map_fog twice default plus one pixel
map_ground_types twice default plus one pixel
map_climates twice default plus one pixel
water_surface 256 x 256
map.rwm this is the game generated actual map (not editable)

The creation process starts with map_heights. We will use Map_big.tga to create this file. But first we
follow the first golden rule of modding: back up! To do this, simply right click the tga file in Explorer,
choose copy and then right click the folder on the left pane of Explorer and choose paste. This will create a
file that will be named ‘Copy of Map_big’
Note: every time you change your map files and want to run the game you need to delete the old map.rwm
file. The game will generate a new file from your map files.

Outline
I will introduce you now to one of the good friends of the mapper: the layer mode. It is relative easy to
obtain (definitely easier than Nirvana). In the tool window, click on ‘file\ new’. In the ‘Fill with’ option
choose ‘Transparency’. If you tend to be vain or have that urge to be recognized, change the ‘Comment’
entry to reflect your name. Change the size to 451 x 501. Click ‘OK’. You now have a nice checkered empty
area. These ‘checks’ indicate transparency in the GIMP program.
Back to the layer business: in the pic window click ‘file\open as layers’ and choose ‘Map_Big’ by double
clicking. To help you control the two layers (big_map and transparent new) activate the pic window and
press Ctrl L. One more window pops up: ‘Layers’. Most of it should be self-explanatory. If we want to trace
the coastline of the map, we have to move the ‘background’ layer to the top. Highlight ‘background’ and
click on the upwards arrow. Apparently, nothing changed in the pic window. But then how do you tell if the
transparency is on top? Only when looking at the ‘layers’ window for the time being is the answer. Let’s
work with it.
In the tools window click on the pencil icon. Then change the brush size to 1 by clicking on the box with the
dot in the bottom part of the window and then choosing the smallest dot. In the area next to ‘Brush’ you
should now see ‘Circle (01)’. Now click on the black rectangle in the upper part of the window. A new
window will open: ‘Change Foreground Color’. This is the window were you set your custom colors. If you
look closer, you will have solved the riddle of the RGB: there are three horizontal lines that have these
letters in front of them. We will only concentrate on these, the other three are not important for us for this
tutorial. The values are 0,0,0 – change this value to 1,1,1. Close this window by clicking ‘OK’.
Our scale of the pic window will make it difficult for us to work with a brush size this small, so let’s go big!
Activate the window by clicking on its frame and press ‘Shift +’ six times. That should do it and a little
window at the bottom left should show read now 800%. In the layer window highlight the ‘background’
layer and then go ahead and trace the coastal outline. Make sure there are no gaps between the pixels!
STOP! Let me first introduce you to my personal friend the ‘Undo’ button. He sits in the pic window under
‘edit’. Somewhat awkward and long winded, that’s why the shortcut is ‘Ctrl Z’. Now off you go and have
fun with your paint box!
Once you are finished with the outline, reduce the scale of the pic window to 100% (remember, bottom left)
and check for inland water bodies (fancy word for lakes). These will also need to be outlined, but Iceland
hasn’t got any lakes. There is a little island to the South West of the mainland (bottom left for geographical
challenged individuals), put a line around that as well. Now we have to save the masterpiece. Activate the
‘layers’ window and check that the ‘opacity’ slider is all the way the right. (Just in case you have been
playing with it). Activate the pic window and click on ‘file\save as’. Enter ‘map_heights.tga’ as name, click
‘Save’, ‘Export’, ‘Save’ when it comes up.

Filling
Time to introduce you to a new tool: the paint bucket. On the tools window click the icon that looks like an
overflowing bucket. Scroll down the lower portion of the window until you come to a slider labeled
‘Threshold’. Make sure it reads 0.0 by sliding it all the way to left. Now fill the area in between your tracing
with the current color. Should everything go black than you didn’t listen to me earlier on and left a gap
between the pixels. Go see my good friend ‘Undo’ and find the error. If you are about to go nuts, change the
brush size to 3 or 5 and redraw the coastal outline. Now simply save your work (pic window, file\save click
export), I will show you what layers can be about.

Layers
Activate the ‘layers’ window and make sure the ‘background’ layer is high lighted. Now move the slider to
the left. Nifty, isn’t it? This will come very handy later on. Just remember this: when saving, make sure that
the slider is all the way to the right. The correct file name has to be displayed on top of the pic window as
well, else you will have to ‘Save as’ instead of ‘Save’.
We’ve got the land, we need the sea: fill the rest of map_heights with the RGB value 0,0,253. Now check
your coast line at 800% to make sure all pixels are either black or blue, it will save a lot of heart ache later
on. Save. Close pic window (exit). One file done!
Note: if your top layer has still got transparency in it you will have to remove the other layers before saving.
Simply highlight the other layer and click on the dustbin. If you need to save that layer as well, move it to
the top, opacity on 100, check correct filename, save and then remove.

High creation
This is one chapter where your artistic side will be challenged. You obviously don’t want a huge flat map.
Iceland got mountains, right? Fortunately our map_big file has got contour colors. The first step will be to
save the current map (map_heights) as ‘map_base.tga’. Open it again if you have taken a break and then
save it as ‘map_base.tga’. The reason for this will be revealed at a later stage. (I do love a little suspense.)
Now open map_big as layers, move it to the bottom and slide the opacity to the left until you can
comfortably see those contours (map_base at the bottom, map_heights on top and selected when using the
slider). Change RGB to 20, 20, 20 and trace the first (lowest) contour line, fill with the same RGB value
when finished. Change to 50, 50, 50 and do the dark green contour (don’t forget filling), follow it up with
90, 90, 90 for the white contour (which you fill as well…).
With a little imagination, you will realize that this is going to look like the rice terraces in Cambodia and not
like mountains. This is where creativity comes in. And a new GIMP tool: smudge. It is located on the right
of the third row in the tool window. Set the brush size to 3 (or 5 if you are adventurous) and use it to ‘blur’
the differences between the shades of grey. The same way can be used to create little hills. You might have
realized by now that the numbers in the RGB values are the same. It is called grey shade. And the lighter the
shade, the higher the mountain. Don’t forget to save your master pieces as map_heights! Right now it is
called map_base, that one we still need. A tip for the future: always leave one pixel of 1, 1, 1 at the edge of
waterbodies, it makes the shore look proper, even if you want sheer cliffs.
Never use 0,0,0 – this looks black but gets created as water. The famous ‘Ragusa port bug’ is the result of
the use of this RGB value.
Note: The best way to avoid smudging the blue (water) is by selecting the blue color with the Color Tool
(Shift+O) and then invert the selection (Ctlr+I), that way you can only work on the landmass.

Down from the height, onto the ground


As the heading suggests, we will create map_ground_types now. Open map_base (the suspense is over!).
We now have the tricky task of replacing the 1,1,1 RGB value with 0,0,0. “Tricky? Hey dude, just change
the value and fill!” Wish it was that easy. The pitfall is the only minute difference between these two shades
of grey. If you have a map with multiple independent land masses (islands for the lay man) it is easy to skip
one. This skip will be fatal later on. To avoid these tears proceed as follows: use a contrasting color, in this
case 0,250,250 to fill all the black areas. After that fill the same areas with 0,0,0. Double work? Sure. Heart
ache saver? Also sure. The foolhardy may go ahead and change 1,1,1 straight to 0,0,0. Now change the
water (0,0,253) to 196,0,0. No contrast needed here. Again, check your coastline for stray pixels. Save as
map_ground_types.tga. Take a break, stretch your legs, have a coffee.
The valid RGB values for map_ground_types are:
- Movement enabled
Beach - White (255, 255, 255)
Fertile Low - Grey-Blue (0, 128, 128)
Fertile Medium - Light Green (96, 160, 64)
Fertile High - Olive (101, 124, 0)
Wilderness - Black (0, 0, 0)
Swamp - Bright Green (0, 255, 128)
Forest Sparse - Green (0, 128, 0)
Hills - Olive-Brown (128, 128, 64)
- Movement disabled
Impassable – Grey (64, 64, 64)
Mountains High - Light Brown (196, 128, 128)
Mountains Low - Brown (98, 65, 65)
Forest Dense - Dark Green (0, 64, 0)
- Water bodies
Sea Shallow - Red (196, 0, 0)
Sea Deep - Dark Red (128, 0, 0)
Ocean - Dark Maroon (64, 0, 0)

A Region, my kingdom for a region


Shakespeare says it so fittingly – we need a map_regions file. The base for this is extremely simply to
create: open map_base. Scale the map (image\scale image – don’t forget the interpolation setting) to the size
in your descr_terrain file: 225*250. Convert back to RGB (image\mode\RGB). Save as ‘map_regions.tga’.
Change the water color to 41, 140, 233 – it is the default sea color.
A note here now for limits to this map: you can have a total of 200 regions. For the purpose of counting the
sea color(s) are counted as regions. Why (s)? It is an AI thing: he (she) will consider a region bordering the
sea as reachable by sea. An example would be Denmark and Scotland. The problem now starts when you
color the Red Sea with the same RGB code: the owner of Mecca would think the same as the owner of
Denmark and get a fleet ready to invade Britain. Won’t work now, would it? So there you would change the
RGB code just slightly, keeping in mind that every color counts as a region, water or no water.
Enough about water, back to land. Change the color to 31, 224, 31 and color the left half of Iceland and the
little islands with this gorgeous green. Color the right half with this amazing red: 232, 41, 46. Check that no
black pixels are left anywhere.
Onto the cities: change color to 0, 0 , 0 and place a single pixel in each colored area (not the sea, dummy!).
Right now, this is not difficult as all of the land mass is accessible and an error will not occur. Once you
have a complex map_ground_types and map_features you might want to use the layers method for
placement. Save, over and done with (exit).

Note: You will require 10 or more (depending on your map size) regions to have a stable, playable

More features
The map_features file is the one that will (at more complex maps certainly) give you the most head ache. A
simple misplacement of a pixel can cause a crash here, so pay attention closely.
First step will be to reduce the size of Map_big to default (225*250) and save it as Map_small.tga. Done?
You are getting good at this. (You didn’t forget about to set the interpolation to ‘None’, didn’t you?)
Step two will be to open a new layer. (I didn’t say: close map_small, so it should still be open) Press
CTRL+L to open the layers dialog box. Click on the bottom left button to create a new, transparent layer.
Change your color to 0, 0, 255 and trace all the rivers on the map. STOP! This is where 99% of errors on
this map file occur. Diagonal ‘connections’ will not work – the river will not be visible from this point on in
the campaign map. Example picture underneath.

Red indicates a missing pixel. Green indicates a surplus pixel. Yellow is a valid branch.

Note: An error will also be created if you rejoin a river.

Once you have got all the rivers in place (extend the river two pixels beyond the coastline to create a proper
‘mouth’), change the color to 255, 255, 255 and place a single pixel at the source (spring) of each river. If
you want to cross the river or have the urge to build a nice bridge replace a blue single pixel of 0, 0, 255
with 0, 255, 255. Once you are finished with all the river stuff fill in the rest of the area with 0,0,0 (not
absolutely necessary), delete the map_small layer and save as ‘map_features.tga’.
Other features that you can place are cliffs, land bridges (remember the Bosporus or Straits of Gibraltar?)
and volcanoes, these will not cause any CTD if placed wrongly, just some embarrassment. The valid RGB
codes are here:

River - Blue (0,0,255)


Volcano - Red (255,0,0)
Cliff - Yellow (255,255,0)
River Crossing - Light Blue (0,255,255)
River Source - White (255,255,255)
Land bridge - Green (0,255,0)

I like tropical climate


The easiest way to create this map_climates.tga file will be to take map_heights and fill it with any of the
RGB values that are listed beneath and save as map_climates.tga. I will not go into any details here as the
names of the colors are pretty self explanatory, apart from which it should be fun trying out what all the
combinations of ground types with climates will look like. Some of these will not have any ‘winter’
appearance like ‘Sandy Desert’, ‘Alpine’ will do that. But I did say self explanatory, didn’t I?

Tropical - Dark Green RGB(0, 166, 81)


Alpine - Green RGB(57, 181, 74)
Highland - Light Green RGB(141, 198, 63)
Swamp - Yellow RGB(255, 242, 0)
Deep Temperate Forest - Light Orange RGB(247, 148, 29)
Light Temperate Forest - Orange RGB(242, 101, 34)
Infertile Temperate Grassland - Red RGB(237, 28, 36)
Fertile Temperate Grassland - Dark Pink RGB(237, 20, 91)
Mediterranean - Pink RGB(236, 0, 140)
Semi-Arid - Blue RGB(0, 114, 188)
Sandy Desert - Dark Purple RGB(102, 45, 145)
Rocky Desert - Mauve RGB(146, 39, 143)

Of fog and water


Create the following two ‘eye candy’ map files.
map_fog.tga is the same size as map_heights (451*501) and filled with 255, 255, 255. If you want to create
‘undiscovered’ areas use 0, 0, 0. The difference between the two is the initial state: white will be fog where
you can see what is on the campaign map, black will prevent you from seeing anything at the beginning.
This will change to regular fog once a character has ‘seen’ the area.
water_surface.tga is basically map_heights resized to 256*256 with the water area covered in fancy shades
of blue. Let your imagination run wild and have a look what the results are.

And then there were leftovers


The reference here is to map files that the game needs but that do not have any influence on the actual map,
they are probably the remainder (hence left over) from previous versions of the map engine. So let us get
them out of the way:
map_roughness.tga, double the default size (450*500), filled with 0,0,0
map_trade_routes.tga, default size (225*250), filled with 0,0,0
Do you need any further instructions? No? Then hop to it!

Other non-essential graphic files


map_FE.tga is the placeholder file that gets displayed if you haven’t created faction maps yet. If you are
interested, the size is 384*275 and is easiest (and most appropriately) created by resizing and renaming
map_big.
radar_map1.tga (250*125) and radar_map2.tga (500*250) in the imperial_campaign folder are usually
created from map_big as well in the same way.

All the text


For this tutorial to work we will have the need of a couple of text files. Remember the lesson at the
beginning? Let’s put that experience to good use. Simply copy the text between the dotted lines into a blank
txt file and name it according to what is written above the dotted line.

In the map\base directory we need the following files:

descr_regions.txt……………………………………………
London_Province
London
england
English_Rebels
31 224 31
none
5
4
religions { catholic 85 orthodox 0 islam 0 pagan 13 heretic 2 }
Paris_Province
Paris
france
French_Rebels
232 41 46
none
5
5
religions { catholic 85 orthodox 0 islam 0 pagan 10 heretic 5 }
……………………………………………………………………

descr_sounds_music_types.txt……………………………….
music_type northern_european
; england
regions London_Province
; france
regions Paris_Province
factions england france
……………………………………………………………………

The data file for the region names in the data\text folder. Important: the funny sign has to be in the first line!
Note: you have to save this file in UNICODE format, click on the drop down menu ‘encoding’ when using
‘Save As’ and choose UNICODE.
For more detailed information see this tutorial.

imperial_campaign_regions_and_settlement_names.txt……
¬
{London_Province}London Region
{London}London
{Paris_Province}Paris Region
{Paris}Paris
……………………………………………………………………

More text files, this time for the imperial_campaign directory:

campaign_script.txt……………………………………………
script
restrict_strat_radar false

end_script
……………………………………………………………………

descr_strat.txt…………………………………………...............
campaign imperial_campaign
playable
england
france
end
unlockable
end
nonplayable
slave
end

start_date 870 summer


end_date 1200 winter
timescale 0.50

marian_reforms_disabled
rebelling_characters_active
gladiator_uprising_disabled
night_battles_enabled
;show_date_as_turns
brigand_spawn_value 60
pirate_spawn_value 90

faction england, balanced smith


ai_label catholic
denari 12500
denari_kings_purse 2500
settlement
{
level large_town
region London_Province

year_founded 0
population 3800
plan_set default_set
faction_creator england
building
{
type core_building wooden_wall
}
building
{
type barracks town_guard
}
building
{
type temple_catholic small_church
}
building
{
type city_hall town_hall
}
building
{
type market corn_exchange
}
building
{
type hinterland_roads roads
}
}
character William, named character, male, leader, age 40, x 73, y 129
traits Factionleader 1 , GoodCommander 1 , Intelligent 2 , VictorVirtue 3 , PublicFaith 2 , BattleDread 2 ,
StrategyDread 2 , ReligionStarter 1
army
unit NE Bodyguard exp 1 armour 0 weapon_lvl 0
unit Spear Militia exp 0 armour 0 weapon_lvl 0
unit Spear Militia exp 0 armour 0 weapon_lvl 0
unit Town Militia exp 0 armour 0 weapon_lvl 0
unit Peasants exp 0 armour 0 weapon_lvl 0

character Giles, admiral, male, age 36, x 62, y 141


army
unit cog exp 0 armour 0 weapon_lvl 0
unit cog exp 0 armour 0 weapon_lvl 0

faction france, balanced smith


ai_label catholic
denari 8000
denari_kings_purse 1500
settlement
{
level large_town
region Paris_Province

year_founded 0
population 3800
plan_set default_set
faction_creator france
building
{
type core_building wooden_wall
}
building
{
type barracks town_guard
}
building
{
type temple_catholic small_church
}
building
{
type city_hall town_hall
}
building
{
type market corn_exchange
}
building
{
type hinterland_roads roads
}
}

character Philip, named character, male, leader, age 40, x 91, y 5


traits Factionleader 1 , GoodCommander 2 , Intelligent 2 , Austere 1 , PublicFaith 1 , BattleChivalry 1 ,
StrategyChivalry 3 , ReligionStarter 1
army
unit NE Bodyguard exp 1 armour 0 weapon_lvl 0
unit Crossbow Militia exp 1 armour 0 weapon_lvl 0
unit Peasant Archers exp 0 armour 0 weapon_lvl 0
unit Spear Militia exp 0 armour 0 weapon_lvl 0
unit Spear Militia exp 0 armour 0 weapon_lvl 0

script
campaign_script.txt
……………………………………………………………………

The following two files are blank (no entry what so ever): descr_mercenaries.txt and
descr_win_conditions.txt

Configuration.cfg file
The provided file is set up for ‘Hotseat’ games and the Battle Editor is enabled.
The following line (green) will be of interest to the hard core modders:

[video]
windowed = false ## used for modding

Change the value from false to true to have a window in which the game runs. This makes it unnecessary to
exit the game if you wish to make changes in the original files. Just remember that you have to delete the
map.rwm file and restart your game for map changes to take effect. If you do changes midway through a
campaign and delete map.rwm you might get some weird results. You have been warned.

[log]
to = logs/M2TW.system.log.txt
level = * error

This value can be changed to ‘trace’ to get a more detailed look (MBs of it) of what is going on. Only
change this if the normal (error) log does not give you a clue what is going on. Chances are not very good
then either, but it doesn’t hurt to try.

And that is the end of the tutorial. Click on the ‘Executable’ to drool over your accomplishment.

Additonal Links
If you want to learn more about adding regions properly and other mapping issues, have a look at my other
tutorials at the TWCentre (in the list below). Other helpful stuff from this author and other great thinkers:

---
Creating a World - Functional Grape Shot
---
Creating a World - Replacing Strat Models
---
Creating a World - Adding a Culture
---
Creating a World - Using the Install Creator
---
Creating a World - Adding a new Faction
---
Creating a World - Height Map with 3Dem
---
Creating a World – Adding detailed Regions
---
Creating a World – Map Templates with Worldwind
---
Creating a World – Bare Kingdoms
---
Creating a World – Name Converter
---
Creating a World – The Grail of the seven Forts
---
Creating a World – Formatted Campaign ModelDB files
---
MapMod: Trees, Textures, Sea v1.0
---
New strat models for castles by Agart
---
Crashes and how to fix them by uanime5
---
Shared, Tooltips and Strat.txt
---
StringBin Converter
---
GeoMod Tool

--- Another fine tutorial by gigantus ---

You might also like