# Thread: Mod Guide: Altering the Map

1. ## Mod Guide: Altering the Map

This is a basic guide to editing the map itself, based upon my own experiences creating in changing EU3's Japan from this:

to this:

I haven't created an entirely original map yet, but I imagine that it could be done in a largely similar manner.

I. Programs/Utilities Needed

II. Preparation

First, figure out what exactly it is that you are going to do: what provinces are going to be added, which are to be removed, etc. (it might also benefit you to look over some of the other mod guides here, if you haven't yet) Create a rough image to base your map on like this one:

Next, create text files in history\provinces for the new provinces that you've created, and copy over all other province files that are likely to be altered by your map. The content of your new province files doesn't particularly matter at this point. I just copied another Japanese province. Renumber all the province files to take into account your new provinces. Because EU3 requires that all land provinces come before all sea provinces, you can't just place your new provinces at the end of the list. I named my new provinces 1250 and 1251 (the numbers of the first 2 sea provinces) and then moved the previous 1250 and 1251 to the end, renaming them 1742 and 1743.

With that done, open localisation\text.csv. Each province has a line in this file that determines what its name will be on the map that begins with PROV and its province number (so London's line begins PROV236;, for example). Insert new lines and change province numbers as necessary to reflect your new map's situation.

III. The Map Files

With all that preparation out of the way, it's time to move on to the real map files.

default.map
- The 2 variables here that you will want to alter are max_provinces and sea_starts. Max_provinces should be set to the number of total land and sea provinces + 1 (for PTI). Sea_starts is the province number of the first sea province.

definitions.csv
- Each province is defined by a unique RGB color value that is defined in this file. Either create one yourself, or use one of the numerous extras provided by Paradox at the end of the file. This is also the final file that contains province numbers, so alter them as you did in text.csv and the history/provinces files.

- This file determines which straits can be crossed over without ships. If you plan to alter or create any such straits, alter this file accordingly.

climate.txt
- This file determines what kind of winter each province has and whether it is tropical. You do not have to alter this file to get your file to run.

continent.txt
- This file associates provinces with continents, which determines such things as which advisors you have access to. Enter any new provinces appropriately.

provinces.bmp
- Each province in the game is shown on this map in its unique RGB color as listed in definitions.csv. Since the map is upside down and flipped, you'll probably want to correct that from the Image menu before you start remember to put things back the way they were when you finish!) Make your changes to the map, coloring your new provinces according to the appropriate RGB value, and doing your best not to unknowingly alter any existing provinces that you didn't intend to change. It's worth noting that some sea zones have RGB values so close together that they can not be distinguished by eye. The game scans this file and attempts to create a province for each color it encounters, so even a subtle error here can make your map refuse to load, since it will think a stray pixel is a new province. I've heard that you can check that things are okay by finding the total number of unique colors in the file (which should be total provinces + 1), but have not done this myself. If you are trying to find a stray pixel, my recommendation to you is to use the paint bucket tool set to tolerance 0, anti-alias off and contiguous on and start filling in black around the area that you have been working. Obviously you should save before you start doing this.

rivers.bmp
- I didn't do much with this file, as Japan doesn't have any rivers in EU3. The important thing here, as it will be for all of the .bmp files and colormap.dds, is to make sure that all of your map changes to the various files match perfectly. The easiest way to accomplish this is to copy and paste your changes from one map to another and then alter it to match.

terrain.bmp
- This file determines what terrain each province has, and presumably is used
in determining what type of terrain battles fought in that province have. The
terrain of each color is defined/explained in terrain.txt, so take a look at that if need be. This files does little to determine how your map appears in game, so you could just make everything grassland and come back to it later if you wish.

topology.bmp
- This file can be a little intimidating at first. It determines topology based on how light and dark each pixel is. I recommend that you just fill in all new territory with a fairly dark color like 30,30,30 (not black, as that will make your land appear undewater) and come back to this file later, as it makes working with positions.txt easier. When you do come to work on this file, I recommend you copy it into another file in psd format first. Why? Because the brush tool cannot be put into normal mode while working on a bitmap. Now take the rush tool, turn its opacity down to 30% or so, and select a light grey color. This should you allow to make subtle changes to the topology fairly easily. Going back over the same area twice should make it lighter, etc. Experiment. I don't consider myself to be artistic at all, but I feel I got fairly good results. Obviously, if you working on a real area looking at topographic maps will help greatly here.

colormap.dds
- This map determines what your map actually looks like in game (how green, etc.) When opening it with Photoshop, use the default options. Like with topology.bmp, you can just fill in all your changes with a basic green and move on for now if you wish. My approach to editing this file was similar to topology.bmp: a small brush with low opacity. I started with a light green, went over the map, then grabbed a few more shades. I included grey for the mountains last. I found that creating a psd file with topology.bmp as a layer superimposed over colormap.dds that could be hidden and shown at will made this much easier. When saving you have to be very careful as to what settings you use. I've uploaded a preset file here that can be used when saving. Oh, and if you need to play around with PTI, you can find it in the alpha channel of this file.

colormap_water.dds
- I actually just erased Japan off of this map. It obviously determines what color water appears as, but it doesn't seem as important as the other files, so I didn't really bother with it.

minimap.dds
- This file (along with minimap_bg.dds which should be edited by just copying information over from this file) can be found in gfx\interface, and determines what is displayed on the minimap that shows up in the lower right part of the display. Its fairly abstract so I did not edit it myself, but I see no reason why you couldn't treat it like either of the other .dds files.

positions.txt
- This annoying file will, depending on how much of a perfectionist you are (and how small your provinces are), take a long time to get straight. It determines where cities, ports, units, etc., show up on the game map. You can get a rough idea as to what values to use by opening provinces.bmp and clicking on the info tab next on top of the navigator window in the upper right of Photoshop. Click on the left of the X Y Coordinates box that appears and choose points as a measurement unit. That box will now display the coordinates currently being pointed at by the mouse. In theory, that works fine. In practice, you'll have to load up EU3, take screenshots of the map in-game to see how it looks, then alter positions.txt appropriately. The reason I suggested skipping topology.bmp earlier is because it can be easier to place things when everything is flat. Oh, and you can't flip and rotate provinces.bmp while you're doing this because it screws with the coordinates. And everytime you make a change EU3 will recalculate all the paths when loading. So all this can be very time consuming.

One last note on positions.txt. The port_rotation and text_rotation entries in the file determine the direction of ports and province names in game. The value these entries take is the angle as measured in radians from due west. No problem, right? Using the ruler tool in Photoshop we can just determine what angle we want to use, right? Not quite. From what I've been able to determine on-line, there's no way to make Photoshop report angles in radians. Also, Photoshop measures angles from due east (not due west like EU3) and has a maximum value of 180 degrees before switching to negative numbers, whereas radians work on the full 360.

So here's the formula you'll want to use to convert the degrees Photoshop gives you to the value you put into positions.txt:

Code:
radians = (-1 * (degrees - 180)) * 0.0174533
The radians used for text_rotation are flipped along the x axis (so a line of text running from NW to SE on the map uses the value you'd expect for one running SW to NE), so take that into account.

Or as a shortcut just use these values:
Code:
port_rotation=0.000000 = W
port_rotation=0.785398 = NW
port_rotation=1.570796 = N
port_rotation=2.356194 = NE
port_rotation=3.141593 = E
port_rotation=3.926991 = SE
port_rotation=4.712389 = S
port_rotation=5.497787 = SW

text_rotation=0.785398 = from SW
text_rotation=0.392699 = from WSW
text_rotation=0.000000 = from W
text_rotation=5.890486 = from WNW
text_rotation=5.497787 = from NW
I should probably also mention that province names are centered (not begun) on the value that you enter for text_position.

IV. Post-script

Okay, I think that's it. If you've done all of the above correctly, your map should be done. If not... well, I'm planning to toss up a troubleshooting section explaining what problems I had along the way and maybe some more pictures, but it's late, so that can wait for another day.

Thanks to Infiris for his utilities, and Cabezaestufa for help with .dds files.

2. Reserved Space

3. This is great! Many, many thanks and kudos to you!

As soon as my new graphics card arrives, I´ll get started altering the central and eastern Europe map. Thank you for this guide!

4. Excellent! Thank you.

5. All this stuff did I already know!

But can't get my map and mod to work, It was much easier back on EU2.

I have some questions.

province.txt in history/provinces, can I have any name as I want on them or how does Eu3 know that .txt 1-xxx is province 1 on my map?

One more thing, I get graphics as error! What can it be then that I have done wrong?

6. Excellent work, Sakura-san! I hope you don't mind if I add some more tips which deal with problems I have encountered:

- colormap_water.dds: As you rightly said, this file won't make or break your mod. It makes it look pretty, though If you paint black a zone where there's supposed to be sea, you'll notice ugly black shadows in that area. Also, this file deals with rivers: you should paint blue the areas with rivers for them to show properly (see original file to see how there are streaks of blue wherever there are rivers). Additionally, the alpha channel of this file also holds PTI info.

- rivers.bmp: First, you should take a look at the pallette of this file. There are different shades of blue, one instance of magenta, red, green and white and the rest is all black. The shades of blue define the rivers: the lightest the color, the narrower the river. Magenta is sea or PTI, white is land, red are pixels where two rivers met and green is the start of a river. The rivers must be exactly one pixel wide in all places. Otherwise, the game might not load. Also, it's a good idea to draw rivers a few pixels into the sea, to show their current.

Hints and tips:

- Be very careful with how you save provinces.bmp. You must choose 24 bit color when you do. Don't make the same mistake as me: I chose 16 bit color and the game wasn't able to calculate province boundaries. If your map consists entirely of terra incognita and logs\setup.log shows all bounding boxes as (0,0) except for bounding box 0 (which will contain your entire map), and all adjacencies as NONE, it's likely you have made this mistake.

- Never let one of your land provinces touch the top or bottom edge of the map. The game will crash at start and the last line in setup.log will be: "Setup[provincemanager.cpp:447]: Creating province collision data.". Use PTI to avoid this. Water provinces can touch the top or bottom without any problem, though.

- Be careful with the size of your provinces. If they are too big, the game will crash at the start, when the musketeers image shows and the message "Creating the world" appears. The last line in setup.log will be: "Setup[provincemanager.cpp:453]: Finished creating province collision data.". I haven't determined the maximum size for provinces, but if it's more than roughly 60x60, be afraid. Sea zones can be larger, but I don't know if they also have a maximum size.

- You must try to avoid isolated provinces. With this, I mean parts of the map completely surrounded in PTI, so that it's impossible to get to them from other parts of the map. This could make the game crash right at the beginning, on the "traders" loading screen.

- If you have no forests of any type in "terrain.bmp", you must set "renderTrees=no" in "settings.txt". Otherwise, the game will crash when showing the message "Creating Trees".

I'll update this whenever I remember anything else or when I find another possible pitfall.

I recived a bug when placing all new stuff in a huge mess!

8. Need help, can some one contact me on msn please!

9. Originally Posted by Krantz
province.txt in history/provinces, can I have any name as I want on them or how does Eu3 know that .txt 1-xxx is province 1 on my map?
I think you must have the province text file begin with the province number.

One more thing, I get graphics as error! What can it be then that I have done wrong?
Can you be more specific?

10. Originally Posted by Sakura
I think you must have the province text file begin with the province number.

Can you be more specific?
noffing special with graphic, I know why that come up!

Well I will try to contact Inferis or Harvard soon or I will go back to EU2 and complete the map I'am working on!

11. Originally Posted by Cabezaestufa
- Be careful with the size of your provinces. If they are too big, the game will crash at the start, when the musketeers image shows and the message "Creating the world" appears. The last line in setup.log will be: "Setup[provincemanager.cpp:453]: Finished creating province collision data.". I haven't determined the maximum size for provinces, but if it's more than roughly 60x60, be afraid. Sea zones can be larger, but I don't know if they also have a maximum size.
For what it's worth, the largest land province in the default map has a bounding box of 65 x 35, and the largest sea province has 81 x 85.

12. I most say thanks again! I'am so happy now.

Thank you Cabezaestufa!

This is fantastic!

Awesome!

13. I love that your Scandinavia is located south-east of Africa.

14. Originally Posted by Krantz
I most say thanks again! I'am so happy now.

Thank you Cabezaestufa!

This is fantastic!

Awesome!

You are welcome

But now we have found another weird problem: Neither of our maps work if we activate renderTrees! It crashes just after displaying Creating Trees (of course). The weirdest part is that Krantz's mod didn't have any forest, just plains. I added the three different types of forest to my mod, but no cigar, it crashes just the same. It works fine if we deactivate renderTrees. Anyone has any idea why could it be?

Last message in setup.log: "
Setup[provincemanager.cpp:453]: Finished creating province collision data."

15. Originally Posted by Wetew
I love that your Scandinavia is located south-east of Africa.
Wait till you scroll over Öland and gotland, they are so big when using the lowest zoom level! Perhaps you will see Elephants in Sweden!

Hmm weird that tree bug. Paradox must fix that issue.
Should we post this information in another forum for Paradox Interactive?

16. Originally Posted by Cabezaestufa
But now we have found another weird problem: Neither of our maps work if we activate renderTrees! It crashes just after displaying Creating Trees (of course). The weirdest part is that Krantz's mod didn't have any forest, just plains. I added the three different types of forest to my mod, but no cigar, it crashes just the same. It works fine if we deactivate renderTrees. Anyone has any idea why could it be?

Last message in setup.log: "
Setup[provincemanager.cpp:453]: Finished creating province collision data."
Disregard that, I found the problem. If your terrain.bmp has no forests and have renderTrees=yes, the game crashes. Looks like an uncatched exception to me

17. Very, very nice and outstanding work. Saved me a lot of time trying to learn by trial and error. Thank you so very much!

Additionally If you like I will convert a finial version of this into a .pdf file for the community. The same goes for any other modding guides.

18. I got a question :

I'm currently making a map. I have nearly finished the provinces.bmp.... and it seems i've added nearly 300 new provines

Will the number of added provinces have an impact on game speed or anything else ?

19. 1/ After over a day and over 150 views... i apologize but i'll ask again : will adding around 300 provinces hamper game speed or else ?

And i have a couple more questions.
2/ In the positions.txt, you have for example :

Code:
#Västergötland
7 = {
city={
x=995.000000
y=608.000000
}
port={
x=988.799988
y=606.799988
}
port_rotation=-0.261003
x=994.000000
y=606.000000
}
manufactory={
x=991.000000
y=608.000000
}
text_position={
x=996.000000
y=610.400024
}
text_rotation=1.047197
text_scale=1.000000
}
Why do some provinces have trade or manufactory positions and other don't ?
More importantly, why do some provinces, such as this one, not have a unit position ?

3/ Can I (and if yes, how) have TI displayed differently than this white cloud ?

20. Originally Posted by gigau
1/ After over a day and over 150 views... i apologize but i'll ask again : will adding around 300 provinces hamper game speed or else ?
Maybe. That about a 20% increase in the number of game provinces, so it'll certainly have some kind of impact on game performance. Some are convinced that adding only 100 additional provinces would make the game significantly slower, though I don't think they have any actual evidence that it does. You'll just have to try it and see.

And i have a couple more questions.
2/ In the positions.txt, you have for example :

Code:
#Västergötland
7 = {
city={
x=995.000000
y=608.000000
}
port={
x=988.799988
y=606.799988
}
port_rotation=-0.261003
x=994.000000
y=606.000000
}
manufactory={
x=991.000000
y=608.000000
}
text_position={
x=996.000000
y=610.400024
}
text_rotation=1.047197
text_scale=1.000000
}
Why do some provinces have trade or manufactory positions and other don't ?
More importantly, why do some provinces, such as this one, not have a unit position ?
I believe the game comes up with default positions for every province, which are then replaced by the information in positions.txt (since the default positions don't look that good.) I think that when something doesn't appear in positions.txt it means that they liked the default position.

3/ Can I (and if yes, how) have TI displayed differently than this white cloud ?
If you can, I don't know how.