Map modding

From Europa Universalis 4 Wiki
Jump to navigation Jump to search

The map relies on different image files (.bmp bitmap format) to generate different effects and properties of the map.

Province map[edit]

provinces.bmp controls the shape of the provinces. Works in conjunction with the definition.csv. All provinces must have a unique red-green-blue (RGB) color combination. Note that setting any pixel in this file as completely black (0,0,0) will crash the game.

The provinces.bmp file should be in RGB mode and saved as a 24-bit bitmap image file (.BMP)

Europa Universalis IV\map\province.bmp

Terrain map[edit]

terrain.bmp controls the terrain assignment and textures. Works in conjunction with the terrain.txt.

The terrain.bmp file should be in Indexed mode and saved as a 8-bit bitmap image file (.BMP). Ensure the color table remains, and is ordered the same as the base version.

Europa Universalis IV\map\terrain.bmp

Tree map[edit]

trees.bmp controls the tree placement on the map. Works in conjunction with the terrain.txt. The resolution of the trees.bmp file affects the density of trees placed.

The trees.bmp file should be in Indexed mode and saved as a 8-bit bitmap image file (.BMP). Ensure the color table remains, and is ordered the same as the base version.

Europa Universalis IV\map\trees.bmp

River map[edit]

rivers.bmp controls the river placement on the map. Rivers must always be 1 pixel thick.

The rivers.bmp file should be in Indexed mode and saved as a 8-bit bitmap image file (.BMP). Ensure the color table remains, and is ordered the same as the base version.

The following colors are used in the rivers.bmp:

  • Green: (0, 255, 0) - The source of a river.
  • Red: (255, 0, 0) - Flow-in source. Used to join multiple 'source' paths into one river. Note that a flow-in source does not need a green source pixel.
  • Yellow: (255, 252, 0 ) - Flow-out source. Used to branch outwards from one river.
  • Blue: (0, 225, 255) - River with narrowest texture.
  • Blue: (0, 200, 255) - River with narrow texture.
  • Blue: (0, 100, 255) - River with wide texture.
  • Blue: (0, 0, 200) - River with widest texture.
Europa Universalis IV\map\rivers.bmp

Height map[edit]

heightmap.bmp determines the 3D mesh of the map. ( 0, 0, 0 ) is the lowest point, with (255, 255, 255) being the highest. The sea level is set at (94, 94, 94), so any values below that will be submerged.

Make the transitions between heights smooth, otherwise you will create noticeable jagged edges.

The heightmap.bmp file should be in Greyscale mode and saved as a 8-bit bitmap image file (.BMP).

Europa Universalis IV\map\heightmap.bmp

Normal map[edit]

world_normal.bmp determines the 3D bump map. This is required to correctly add shadow to the height map.

Normal maps can be created with Nvidia's texture tools from the heightmap.bmp, or by using Filter > 3D > Generate Normal Map in Photoshop CC.

Europa Universalis IV\map\world_normal.bmp

Color maps[edit]

The color maps: colormap_autumn.dds, colormap_spring.dds, colormap_summer.dds and colormap_winter.dds are applied on top of the terrain textures during their respective seasons.

The colormap_x.dds files should be in RGB mode and saved in the .DDS format, using the 8.8.8.8 ARGB 32 bpp profile (RGBA8 in Gimp 2.8) with no mipmaps.

Europa Universalis IV\map\terrain\colormap_autumn.dds

Water map[edit]

colormap_water.dds controls the color tint applied to water.

The colormap_water.dds files should be in RGB mode and saved in the .DDS format, using the 8.8.8.8 ARGB 32 bpp profile (RGBA8 in Gimp 2.8) with no mipmaps.

Europa Universalis IV\map\terrain\colormap_water.dds

default.map[edit]

The default.map is an important text file that defines several aspects of the map's gameplay function.

A basic version looks like this:

width = 5632
height = 2048
max_provinces = 4348

sea_starts = { }
only_used_for_random = { }
lakes = { }
force_coastal = { }

definitions = "definition.csv"
provinces = "provinces.bmp"
positions = "positions.txt"
terrain = "terrain.bmp"
rivers = "rivers.bmp"
terrain_definition = "terrain.txt"
heightmap = "heightmap.bmp"
tree_definition = "trees.bmp"
continent = "continent.txt"
adjacencies = "adjacencies.csv"
climate = "climate.txt"
region = "region.txt"
superregion = "superregion.txt"
area = "area.txt"
provincegroup = "provincegroup.txt"
ambient_object = "ambient_object.txt"
seasons = "seasons.txt"
trade_winds = "trade_winds.txt"

tree = { 3 4 7 10 }

width and height are what control the map resolution. The game reads these values and then expects the image files to match.

The following files should match the defined resolution:

  • heightmap.bmp
  • provinces.bmp
  • rivers.bmp
  • terrain.bmp

The following files should be half the defined resolution:

  • world_normal.bmp
  • colormap_autumn.dds
  • colormap_spring.dds
  • colormap_summer.dds
  • colormap_winter.dds
  • colormap_water.dds

It is possible to change the map resolution, although the height and width must be a factor of 128.

max_provinces is the maximum number of provinces that game allocates IDs to. This number should always be the actual max + 1. Exceeding this value is fine (you just get a lot of error.log spam), but having the max below your actual max will cause a crash to desktop during loading.

sea_starts = { } controls which provinces are sea zones. You must add a province's ID here for the province to be treated as a sea zone.

only_used_for_random = { }controls which provinces are used in the Random New World. For the Random New World feature to work, you need include approximately 1000 unused province IDs here. However, you can ignore this if you want, as there is no effect on the normal game if you are not using Random New World.

lakes = { } controls which provinces are lakes. These are essentially unusable sea zones that block distance calculations (i.e. coring distance). You must add a province's ID here for the province to be treated as a lake.

force_coastal = { } is unused. Presumably it forces provinces to count as coastal provinces, although this is speculation.

tree = { } is used to associate certain indexed colors in the trees.bmp as trees when used in the automatic terrain assignment.

The other definitions simply point to the relevant files for each map 'feature', i.e. definitions = "definition.csv".

This definition controls the location of a canal river tile on the game map. The coordinates are for the top-left pixel of the canal river tile, and the name is used to search for the canal river tile.

canal_definition = {
	name = "panama_canal"
	x = 1490
	y = 948
}

For example: name = "panama_canal" is linked to panama_canal_river.bmp, as the name is appended with _river.bmp. This also links the tile to the ambient object in ambient_object.txt.

Adjacencies[edit]

The adjacencies file is found at /Europa Universalis IV/map/adjacencies.csv. As a comma-separated file, you may open it with Excel or other similar programs, or a text editor. The default encoding is ANSI.

The file controls which provinces non-contiguously connect to other provinces. For example, an island is normally not connected to any other land provinces, as there are sea provinces in the way. The adjacencies file tells the game to connect such provinces, allowing land units to walk between them.

The format is as follows:

From;To;Type;Through;start_x;start_y;stop_x;stop_y;Comment
<province id>;<province id>;<type>;<province id>;<map coordinate>;<map coordinate>;<map coordinate>;<map coordinate>;<comment>

There are three types of adjacency:

  • sea
  • lake
  • canal

Each changes the graphical image used to display the adjacency. You can leave the type blank to display no graphic.

The map coordinates are used to adjust the starting and ending point of the graphic displaying the adjacency. If no adjustment is needed, use -1 in place of an actual coordinate.

Let's say you want to connect Skåne (province id: 6) and Sjaelland (province id: 12) together. However, the sea Öresund (province id: 1258) is between them both. You would define an adjacency as follows to do this:

6;12;sea;1258;3008;1633;3000;1630;Skåne-Sjaelland

Areas[edit]

Every province must belong to an area. If you interact with a province in game and it does not belong to an area, you will experience a crash to desktop.

Areas can contain any number of provinces, although Paradox tends to have 3 to 5 provinces within every land area. This controls the level of development within each area. Sea areas are more lax, as over or under filling them has less of an impact on gameplay.

Areas are formatted as follows:

area_name = {
    <province ids>
}

The color of the area (seen in the Areas map mode) is random. However, you can manually define an area's color:

area_name = {
    color = { <r>, <g>, <b> }
    <province ids>
}

The color definition used the default RGB values, which range from 0 to 255 (i.e. not decimal RGB).

Regions[edit]

All areas must be associated with a region. Each region can take any number of areas.

Importantly, the sea regions (i.e. regions containing sea areas) are what define the explorable regions in game via the Exploration missions for fleets.

Regions are formatted as follows:

region_name = {
    areas = {
        <areas>
    }
}

For Random New World to function correctly, you need to include the following at the top of your region.txt, as the game populates it with the randomly generated areas.

random_new_world_region = { }

Superregions[edit]

Superregions are used to define 'continent' sized regions. Each region can only belong to one superregion, and sea regions are not assigned to any.

Superregions are formatted as follows:

superregion_name = {
    <regions>
}

For Random New World to function correctly, you need to include the following within your superregion.txt, as the game populates it with the randomly generated regions.

new_world_superregion = { }

Continents[edit]

Found in continent.txt, continents are used to group large swathes of provinces together as a traditional continent. Continents have unique gameplay effects that superregions don't, which is where they differ.

All provinces must belong to a continent, otherwise you may experience crashes.

For Random New World to function correctly, you need to include the following within your continent.txt, as the game populates it with the randomly generated provinces.

new_world = { }

Province Groups[edit]

Found in provincegroup.txt, province groups are similar to areas, although they have no inherent function. Rather, they allow the grouping of provinces, and then the province group name can be used as a scope in effects and triggers.

Ambient Objects[edit]

The ambient_object.txt is used to define the cosmetic 3D objects found in the map. This includes the map frame, so don't simply empty the file if you want to remove the other objects.

The format for an ambient object is as follows:

# Used once for each graphical asset
type = {
    type = <string>         # Refers to the graphical asset in ambient_object.gfx
    use_animation= <yes/no> # Used set set if an object is animated or not
    scale = <float>         # Sets the scale of the asset. 1.0 is default size.
    time_duration=300.000   # Always set to 300 for animated objects, may be redundant
    
    always_visible = <yes>              # Used to force visibility
    visible_in_all_map_modes = <yes>    # Used to show is non-terrain mapmodes
    
    # Each instances is a separate object
    object = {
        name = <string>                 # Name does not have to be unique
        hidden_on_start = <yes/no>      # Whether the object is hidden (can be revealed with show_ambient_object)
        position = {
            <x>     # Horizontal coordinate
            <z>     # Height coordinate - 0.0 is base
            <y>     # Vertical coordinate
        }
        rotation = {
            <x>     # Horizontal rotation
            <z>     # Height rotation - this is used for most rotations
            <y>     # Vertical rotation
        }
    }
    
}

You can use the Nudge tool to place new instances and move objects, but if you want to add a new type, you must add it to the file first, then use the Nudge tool.

The ambient objects for the canals are found here. To link them to the canal definition in default.map, you need to make sure they share the same name (i.e. panama_canal).

Positions[edit]

The positions.txt is used to define the idle position for units, cities, etc. You need to have these defined for every province, otherwise the game will become unplayable as soldiers disappear into the aether.

The format for a position is as follows:

<province id> =
	{
		position= - Dictates the position of the various graphical element a province can have.
		{
			2777.000 1287.000 - The x and y co-ordinates for the City model
			2783.000 1287.000 - The x and y co-ordinates for the standing Unit model
			2777.000 1287.000 - The x and y co-ordinates for the province name Text
			2764.000 1288.000 - The x and y co-ordinates for the province's Port (If the port model is not touching a sea province, the model will not appear)
			2777.000 1287.000 - The x and y co-ordinates for the province's Trade route model (will not appear if the province is not the main location of a trade node, as defined in 00_tradenodes.txt)
			2783.000 1285.000 - The x and y co-ordinates for the fighting Unit models
			2777.000 1287.000 - The x and y co-ordinates for the Trade Wind icon (not used if the province is not defined in the tradewinds.txt)
		}
		rotation= - Dictates the rotation of each element. The value here is rotations (rot). 1 rot = 360 degrees
		{
			0.000 - City Rotation
			0.000 - Standing Unit Rotation
			0.000 - Text Rotation
			0.785 - Port Rotation
			0.000 - Trade Route Model Rotation
			0.000 - Fighting Unit Rotation
			0.000 - Trade Wind Model Rotation
		}
		height= - Dictates the height of each element. The value here is is roughly equal to 1 step in the greyscale used for the heightmap.bmp. So -1.00 results in a model one step below the base level (96), whilst 1.00 results in a model one step above.
		{
			0.000 - City Height. Unfortunately, this only affects the central city model, and none of the additional ones that appear in high base tax provinces.
			0.000 - Unit Height.
			1.000 - Text Height. Does not actually change the height of the text in an obvious way. Never change this.
			0.000 - Port Height.
			0.000 - Trade Route Model Height.
			0.000 - Fighting Unit Height.
			0.000 - Trade Wind Model Height.
		}
	}

It is best to use the Nudge tool to do this. Activate it by adding -nudge to your launch options for Europa Universalis IV. Then in game click the Nudge button in the initial menu. Use the tool, and then save.

The altered positions.txt is found at //Paradox Interactive\Europa Universalis IV\map\positions.txt. Copy this over your original version in your mod.

You then need to delete the positions.txt found at //Paradox Interactive\Europa Universalis IV\map\, as it overrides the vanilla/mod versions otherwise.

Nudge Tool keyboard shortcuts:

  • 'next' is bound to '1'
  • 'prev' is bound to '2'
  • Rotation +0.5° is bound to 'q'
  • Rotation -0.5° is bound to 'e'
  • Rotation +45° is bound to 'r'
  • Rotation -45° is bound to 'f'
  • Move +0.5 units on the z-axis is bound to 'w'
  • Move -0.5 units on the z-axis is bound to 's'
  • Move -0.5 units on the x-axis is bound to 'a'
  • Move +0.5 units on the x-axis is bound to 'd'
  • 'Mapmode' is bound to 't'

Terrain[edit]

The terrain.txt has multiple functions. It defines what terrain categories there are (i.e. grasslands, forest, etc) and associates these categories with indexed colors found in terrain.bmp. It does the latter for the trees.bmp as well.

There is a category for every terrain type in game, as well as various special-case categories, such as pti and ocean. You can add and remove categories as you wish, although you must make sure all references else where to removed terrains are cleaned up, otherwise you may run into crashes.

The format for a category is as follows:

name = {
    color = { <rgb> }           # Defines the RGB color to use for showing the terrain in the simple terrain mapmode (optional)
    
    sound_type = <type>         # Defines the ambient sound definition to use for the terrain. Found in sound/all_sounds.asset
    
    is_water = <yes>            # Defines whether this category is treated as sea
    inland_sea = <yes>          # Defines whether this category is treated as an inland sea
    
    type = <type>               # Defines the gameplay type (i.e. plains, which is used for the Nomad shock bonus)
                                # Types: pti, plains, forest, hills, mountains, jungle, marsh, desert
    
    # Used to explicitly make provinces this terrain category. Overrides automatic algorithm.
    terrain_override = {
        <province ids>
    }
    
    # Terrain-only modifiers
    movement_cost = <float>                     # Multiplier to movement time into/out of province with terrain
    defence = <int>                             # Addition to defence roll in combat in this terrain
    nation_designer_cost_multiplier = <float>   # Extra cost multiplier when picked in the Nation Designer
    
    # Province modifiers can be used here as well.
    <province modifiers>
}

Each indexed color in the terrain.bmp can be associated with a terrain category. This is used in the automatic terrain algorithm, saving you from having to use terrain_override.

The format is as follows:

terrain = {
    <name>  = {
        type = <terrain category>
        color = {
            <index>
        }
    }
}

For trees, rather than terrain categories, it is the terrain names defined in terrain = { }. Making the format:

tree = {
    <name>  = {
        terrain = <terrain>
        color = {
            <indexes>
        }
    }
}

Terrain Atlas[edit]

The terrain textures used for specific terrains are found in atlas0.dds and atlas_normal0.dds.

The association between the texture and terrain is inferred from the order of the indexed colors within terrain.bmp. For example, Grasslands associates itself with color index 0, meaning it will use the first tile in the texture atlas. Hills will use the second tile, etc.

The atlas0.dds and atlas_normal0.dds must be saved in DXT5 with Mipmaps enabled.

It is possible to increase the size of the texture atlas. In pdxmap.shader in /Europa Universalis IV/gfx/FX/, edit the NUM_TILES variable to match your new number of rows.

It is possible to increase the size of the texture tiles within the texture atlas. In pdxmap.shader in /Europa Universalis IV/gfx/FX/, edit the TEXELS_PER_TILE variable to your new size.

Climate[edit]

The climate.txt is used to define which provinces belong to the special climate types:

  • tropical
  • arid
  • arctic

These climates apply a modifier 00_static_modifiers.txt to the province, and are handled differently by the AI.

The climate.txt is used to determine which form of winter a province will suffer from is defined here. There are three winter types:

  • mild_winter
  • normal_winter
  • severe_winter

If a province is not defined here, they will experience no winter.

The climate.txt is used to set which provinces are impassable.

Trade winds[edit]

The trade_winds.txt file is used to set the prevailing winds over certain provinces. This reduces or increases the speed of ships, affecting the speed of exploration.

The format is as follows:

<province id> = <rotation>

The rotation is represented by a integer, with 0 pointing right, +10 moving counter-clockwise, -10 moving clockwise.

Seasons[edit]

The seasons.txt file is used to define the color adjustments during the four seasons that pass in game. There are four seasons: winter, spring, summer and autumn.

The format for each is as follows:

<season> = {
    start_date = <date>      # 00.<month>.<day>, in numeric form, i.e. 00.12.01
    end_date = <date>
    
    # Applies to the northern hemisphere
    hsv_north = { <hsv> }    
    colorbalance_north = { <hsv> }
    
    # Applies to the equator
    hsv_center = { <hsv> }    
    colorbalance_center = { <hsv> }
    
    # Applies to the southern hemisphere
    hsv_south = { <hsv> }    
    colorbalance_south = { <hsv> }
}

The color format used is decimal HSV (Hue, Saturation, Value).

The seasons.txt file also controls the tree models visual appearance over the year.

Elevated Lakes[edit]

Due to the nature of the heightmap, the water level for the game is set the same everywhere on the map. However, lakes do exist at high altitudes. To create a lake above the water level, you need to use the lakes/00_lakes.txt file.

This file allows you to spawn a lake texture via a triangle strip (https://en.wikipedia.org/wiki/Triangle_strip) at a set height.

The easiest way to visualize how this works is this: The triangle strip marks out the general area for the elevated lake, and then the height marks the new waterline within that marked out area. You are not actually drawing the lake with the triangle strips!

The format is as follows:

lake = {
	triangle_strip = { 
        <x> <y>     # Vertices, repeat as needed
	}
	height = <int>  # Height at which to show the texture (0 is water level)
}
Documentation EffectsTriggersModifiersScopesVariablesLocalisationCustomizable localization
Scripting AdvisorsAgesBookmarksBuildingsCasus belliColonial regionsCountriesCultureDecisionsDefinesDiplomatic actionsDisastersEstatesEventsFactionsGovernmentGreat projectsHistoryIdea groupsInstitutionsMissionsModifiersNation designerPoliciesReligionRebel typesSubject typesTechnologyTrade companiesTrade goodsUnits
Map MapRandom New WorldTrade nodes
Graphics 3D ModelsInterfaceGraphical AssetsFontsParticlesShadersUnit models
Audio MusicSound
Other Console commandsChecksumJoroDox mod making toolMod structureTroubleshootingThe Validator
Guides Adding a province