地图模组制作:修订间差异

(同步到官方百科01:46, 20 September 2020‎ WildPeacock)
无编辑摘要
第18行: 第18行:
=== Other heightmap files ===
=== 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 repacked and saved.
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 repacked and saved.
[[File:Repack.png|thumb|left]]
==== Repacking ====
Any time the main heightmap.png is changed, you must "repack" in the map editor to make things like rivers, borders, and titles conform to the new heightmap. If you have any issues where things don't seem to be "obeying" the heightmap, the first troubleshooting step should always been to repack.


== River map ==
== River map ==
第75行: 第79行:
    19;126;9;129;TINTAGEL;x;
    19;126;9;129;TINTAGEL;x;


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


第132行: 第136行:
=== Auto nudge ===
=== Auto nudge ===


The in-game map editor contains an auto nudge tool (represented by a dice button on the object placement mode) that allows users to automatically generate land province's object locator files and randomly test new object positions within a given province. To use it, an editor should use the province selection tool, select which province's it wants to randomize, and then click the nudge tool button. The map-editor should then try to spawn each of the default objects on all selected provinces. In case there are any invalid positions (such as objects spawned outside the province's area due to lack of valid spawning space), affected provinces will be crossed by red stripes on the map. To try again, the user should either select any red-stricked provinces and try a new random valid position by clicking the auto nudge button again or drag any invalid objects into the province manually.
The in-game map editor contains an auto nudge tool (represented by a dice button on the object placement mode) that allows users to automatically generate land province's object locator files and randomly test new object positions within a given province. To use it, an editor should use the province selection tool, select which province's it wants to randomize, and then click the nudge tool button. The map-editor should then try to spawn each of the default objects on all selected provinces. 
 
In case there are any invalid positions (such as objects spawned outside the province's area due to lack of valid spawning space), affected provinces will be crossed by red stripes on the map. To fix the issue, the user should then either select any red-stricked provinces and try a new random valid position by clicking the auto nudge button again or drag any invalid objects into the province manually.


The in-game map editor also allows users to fine-tune the auto nudge tool's spawning settings. To facilitate random placement with the auto nudge tool, an user may reduce the collision box of objects or tweak the minimal and max distances between each object. Users should be aware that the default siege engine's settings are optimized so that the siege engine's animation properly interacts with the holding building object.
The in-game map editor also allows users to fine-tune the auto nudge tool's spawning settings. To facilitate random placement with the auto nudge tool, an user may reduce the collision box of objects or tweak the minimal and max distances between each object. Users should be aware that the default siege engine's settings are optimized so that the siege engine's animation properly interacts with the holding building object.
第158行: 第164行:
PANNING_WIDTH =  8192
PANNING_WIDTH =  8192
or whatever the equivalent pixel width of your map is.
or whatever the equivalent pixel width of your map is.
=== Why can't I use the auto-nudge (dice) button to place my buildings and locators? ===
Due to a bug, you'll need to have those defined ''before'' you can auto nudge. Luckily the game generates them for you.
Copy all of the files in:
   C:\Users\[user]\Documents\Paradox Interactive\Crusader Kings III\generated
Paste them into:
   \gfx\map\map_object_data
{{Modding navbox}}
{{Modding navbox}}
[[Category:模组制作]]
[[Category:模组制作]]
[[en:Map modding]]
[[en:Map modding]]

2020年10月18日 (日) 21:51的版本


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 repacked and saved.

Repack.png

Repacking

Any time the main heightmap.png is changed, you must "repack" in the map editor to make things like rivers, borders, and titles conform to the new heightmap. If you have any issues where things don't seem to be "obeying" the heightmap, the first troubleshooting step should always been to repack.

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. Two-pixel wide rivers will cause a crash, and rivers connected using 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 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. The engine will use the capital baronie's culture and religion set in "[mod]\history\provinces@_title.txt" to determine its county's culture and religion at any set date.

   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)
                   }
               }
           }
       }
   }

Map locators

Once baronies have been defined, the locations (positions) of their four main locator objects can be defined. This will tell the engine where to place each sea tile's raised army (ship placement), as well as 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 }
       }
   }

These values, specially raised army's position for both sea and land provinces, are used to define troop movement pathfinding. At any time, the position, rotation and scale of these objects can be finessed using the Map Objects Editor in the in-game map editor.

Be mindful that if there is any serious problem with a mod's locator files, errors.log should indicate that four files (generally holding buildings, raised army, army combat and siege weapon locator text files) have been created in the "[user]\[documents]\Paradox Interactive\Crusader Kings III\generated" folder. You can then copy those over to your mod's "[mod]/gfx/map/map_object_data/" folder, replace the old files and re-start the in-game map editor.

Auto nudge

The in-game map editor contains an auto nudge tool (represented by a dice button on the object placement mode) that allows users to automatically generate land province's object locator files and randomly test new object positions within a given province. To use it, an editor should use the province selection tool, select which province's it wants to randomize, and then click the nudge tool button. The map-editor should then try to spawn each of the default objects on all selected provinces.

In case there are any invalid positions (such as objects spawned outside the province's area due to lack of valid spawning space), affected provinces will be crossed by red stripes on the map. To fix the issue, the user should then either select any red-stricked provinces and try a new random valid position by clicking the auto nudge button again or drag any invalid objects into the province manually.

The in-game map editor also allows users to fine-tune the auto nudge tool's spawning settings. To facilitate random placement with the auto nudge tool, an user may reduce the collision box of objects or tweak the minimal and max distances between each object. Users should be aware that the default siege engine's settings are optimized so that the siege engine's animation properly interacts with the holding building object.

Connections

Baronies can be connected in two ways: having adjacent pixels, or having a connection defined in "[mod]/map_data/adjacencies.csv".

Entries in "adjacencies.csv" take the format:

   ID From;ID To;Type;ID Through;start_x;start_y;stop_x;stop_y;Comment
   #For example:
   1527;1526;river_large;629;948;2791;-1;-1;London-Southwark
   -1;-1;;-1;-1;-1;-1;-1;
  • ID From, ID To, and ID Through are all IDs found in "definitions.csv"
  • ID From and ID To are baronies; ID Through is a sea or navigable river.
  • Type is either "sea" or "river_large"
  • start_x start_y are the (x, y) coordinates from which an army 'embarks' in the "ID From" barony.
  • stop_x and stop_y are the (x, y) coordinates to which an army 'lands' in the "ID To" barony.
  • start_x, start_y, stop_x, and stop_y can all use "-1" instead of actual coordinates, which will default to wherever the normal army placement is in that barony.
  • Preserve the "-1;-1;;-1;-1;-1;-1;-1;" at the end of the file.

Frequently asked questions

Why can't I scroll all the way to the right?

You have to open common/defines/graphics/00_graphics.txt and set PANNING_WIDTH = 8192 or whatever the equivalent pixel width of your map is.

Why can't I use the auto-nudge (dice) button to place my buildings and locators?

Due to a bug, you'll need to have those defined before you can auto nudge. Luckily the game generates them for you.

Copy all of the files in:

   C:\Users\[user]\Documents\Paradox Interactive\Crusader Kings III\generated

Paste them into:

   \gfx\map\map_object_data