地图模组制作

咯咯炀讨论 | 贡献2020年9月15日 (二) 10:24的版本 (创建页面,内容为“{{需要翻译}} == Heightmap == thumb|right|An example heightmap of Ireland and part of Britain The heightmap is the base of every…”)
(差异) ←上一版本 | 最后版本 (差异) | 下一版本→ (差异)


Heightmap

An example heightmap of Ireland and part of Britain

The heightmap is the base of every map, and defines the overall shape of the non-paper map. Heightmaps are represented as greyscale images, where black is the lowest possible elevation, and white is the highest possible elevation.

Creating a heightmap

For real world locations, NASA provides detailed heightmaps to the public through the topography section of the Blue Marble project.

Fictional heightmaps are usually created using a combination of software, often an image editor like Photoshop or GIMP and terrain generation software like World Machine or Gaea.

The main heightmap file

The heightmap is found at "[mod]/map_data/heightmap.png", and must be saved as a 16bit greyscale image.

The heightmap dimensions must match the "original_heightmap_size" definition defined in "[mod]/map_data/heightmap.heightmap".

Other heightmap files

Along with "heightmap.png", there are also two important automatically generated heightmap files, "indirection_heightmap.png" and "packed_heightmap.png". These will be created by the CK3 map editor when a heightmap is saved and repacked.

River map

An example river map of Ireland and part of Britain

The river map is a special file that defines coasts and rivers, which is both used by the terrain engine to paint rivers on your map as well as to define where river crossing are for armies.

Improperly created river maps will cause a CTD. They must be indexed RGB images with a very specific color pallet; the best way to prevent crashed when creating a river map is to start using the game's original river map, found at "[CK3 directory]/game/map_data/rivers.png". Any other colors besides those in the original color index, including antialiases or transparancy, will result in a CTD.

Understanding river map colors

River map color table.png

River maps should be color indexed, which means they're saved with special encoding that indicates only certain specific colors can be used.

Each color has a specific meaning, which is translated by the game engine into nice looking rivers.

  • #00ff00 (pure green) indicates the source of a river system
  • #ff0000 (pure red) indicates a tributary joining the main river
  • #fffc00 (pure yellow) indicates a river splitting
  • #ff0080 (magenta) indicates sea, lakes, and navigatable rivers
  • #ffffff (white) indicates land

The rest of the colors are a gradient of light blue to dark blue, where the darker the blue, the wider the river.

Pixel perfect

River validity.png

Each river pixel must be adjacent to no more than 2 other river pixels, and splits and joins must be adjacent to no more than 3 other river pixels. "Chunky" rivers will cause a crash, and rivers connected with only diagonal pixels will fail to render.

River source

There should only be a single source pixel for each river system; this means if a river has any tributaries, those tributaries should not have a green source pixel.

Province map

An example province map of Ireland and part of Britain

The province map defines baronies and sea regions. Each barony/sea region is defined by being of a unique color in the province map. Like the river map, a province map must avoid antialiasing and transparency.

The province map does not define counties, duchies, kingdoms, or empires. To Define Counties, Duchies, Kingdoms and Empires you need to define them in landed_titles folder

Creating titles

Creating titles is done by linking the colors in the province map to definitions of baronies, counties, duchies, kingdoms, and empires. The process includes the following steps:

  1. Create a province map to define individual baronies
  2. Identify baronies by the RGB found in the province map in "[mod]/map_data/definition.csv"
  3. Define your title heirarchy in a new file in "[mod]/common/landed_titles/"
  4. Create localisations for your titles in a new file in "[mod]/localization/[language]/"

Defining baronies

To turn the colors of the province map into usable baronies, you must define them in the "definition.csv" file.

The format of barony definitions is:

   [ID];[RED];[GREEN];[BLUE];[Barony Name];x;
   # For example:
   2333;128;183;194;PARIS;x;

IDs must be sequential, or your game will crash.

   # This will work:
   1;42;3;128;CAMELOT;x;
   2;84;6;1;AVALON;x;
   3;126;9;129;TINTAGEL;x;
   
   # This will cause a crash:
   1;42;3;128;CAMELOT;x;
   4;84;6;1;AVALON;x;
   19;126;9;129;TINTAGEL;x;

Landed Titles

Landed titles and the de jure hierarchy have to be defined in "[mod]/common/landed_titles/". The basic structure is below.

The names (e_empire_tier, k_kingdom_tier, etc.) are just examples, "color" can be any RGB value you like, but "color2" is static and valid capitals are county titles. Any one tier can contain multiple of the next lower tier (e.g. 5 kingdoms in 1 empire).

Baronies appear in the game in the same order as in the file. I.e. the first one will be the default capital.

   e_empire_tier = {
       color = { 0 0 0 }
       color2 = { 255 255 255 }
       capital = c_county_tier
   
       k_kingdom_tier = {
           color = { 0 0 0 }
           color2 = { 255 255 255 }
           capital = c_county_tier
   
           d_duchy_tier = {
               color = { 0 0 0 }
               color2 = { 255 255 255 }
               capital = c_county_tier
   
               c_county_tier = {
                   color = { 0 0 0 }
                   color2 = { 255 255 255 }
   
                   b_barony_tier = {
                       color = { 0 0 0 }
                       color2 = { 255 255 255 }
                       province = id (defined in map_data/definition.csv)
                   }
               }
           }
       }
   }

Setting barony map locators

Once baronies have been defined, the positions of their four main locator objects can be defined. This will tell the map where to spawn the holding building, raised army, army combat and siege weapon objects for each barony on the map.

The positions of these four locators are defined in the building_locators.txt, combat_locators.txt, player_stack_locators.txt and siege_locators.txt files respectively, which can be found in "[mod]/gfx/map/map_object_data/".

Within these files, each barony is represented by an instance where the position, rotation and scale of the map objects can be set. For example, the following code defines the locator for a single barony with ID = 1 at standard size and co-ordinates of x = 2,000 and y = 1,000 on the map:

   instances={
       {
           id=0
           position={ 2000.000000 0.000000 1000.000000 }
           rotation={ 0.000000 0.000000 0.000000 1.000000 }
           scale={ 1.000000 1.000000 1.000000 }
       }
   }

Once defined, the position, rotation and scale of these locators can be finessed using the Map Objects Editor in the in-game map editor.