第139行: | 第139行: | ||
==高度地图(Height map)== | ==高度地图(Height map)== | ||
'''heightmap.bmp''' | '''heightmap.bmp''' 决定了地图的3D网格。''( 0, 0, 0 )'' 表示最低点,''(255, 255, 255)'' 表示最高点。海平面的高度为 ''(95, 95, 95)'' ,所以任何低于这个值的地形都会处于水下。 | ||
应当使高度平滑过渡,否则地图会出现锯齿状边缘。 | |||
'''heightmap.bmp''' 文件以灰度模式保存为一张8位的位图图片文件 (.BMP) 。 | |||
{{clear}} | {{clear}} |
2022年7月29日 (五) 15:21的版本
游戏的地图是由若干层位图和描述地图内容的文本文件组成的。相关的文件位于/Hearts of Iron IV/map/。
default.map
文件default.map涉及组成地图的位图文件和文本文件。一个基本的版本如下所示:
definitions = "definition.csv" provinces = "provinces.bmp" positions = "positions.txt" terrain = "terrain.bmp" rivers = "rivers.bmp" heightmap = "heightmap.bmp" tree_definition = "trees.bmp" continent = "continent.txt" adjacency_rules = "adjacency_rules.txt" adjacencies = "adjacencies.csv" #climate = "climate.txt" ambient_object = "ambient_object.txt" seasons = "seasons.txt" # Define which indices in trees.bmp palette which should count as trees for automatic terrain assignment tree = { 3 4 7 10 }
所有的文件路径可以改变,但是需要与map/文件夹相关。接下来的部分中提到的都是默认文件路径。 default.map的名字本身是硬编码的(不要改动)。
地图的宽度和高度由provinces.bmp决定,并且都要是256的倍数。下列文件也需要有相同的分辨率:
- heightmap.bmp
- provinces.bmp
- rivers.bmp
- terrain.bmp
省份地图(Province Map)
definition.csv包括了游戏能够识别的省份,它的内容以下列方式排列:
province id; r value; g value; b value; province type (land/sea/lake); coastal (true/false); terrain (plains/hills/urban/etc); continent (int)
省份id和RGB值必须是独一无二的。有效的地形类型定义在/Hearts of Iron IV/common/terrain。大洲是一个从1起的到大洲列表的索引。例如:
7;212;179;179;sea;true;ocean;1 - a coastal sea province 114;40;15;15;land;false;plains;1 - an inland plains province 260;170;235;235;land;true;urban;1 - a coastal urban province
如果省份定义不完全,游戏会在用户目录里创造一份此文件的拷贝,任何不完全的或者遗漏的省份定义都会写入。在对原来的内容进行修改之前,删除这个拷贝或许是必要的。[1]
文件必须是Windows样式的行结尾(CRLF)!
provinces.bmp控制了地图上省份的位置和形状。每一个像素都属于与它的RGB色值相对应的省份。有相同像素边缘的省份在游戏中彼此相邻并连接。在debug模式开启的时候,它可能会警告下列情况:
- "Map invalid X crossing. Please fix pixels at coords":四个省份有共同的顶点。游戏会连接左下和右上的省份,但是这对于玩家来说是很迷惑的,应当避免。
- "Province X has TOO LARGE BOX. Perhaps pixels are spread around the world in provinces.bmp":省份的宽度/高度超过了地图总宽度/高度的1/8。这可能表示有两个省份无意使用了相同的颜色。
- "Province X has only N pixels":省份的像素不多于NGraphics。MINIMUM_PROVINCE_SIZE_IN_PIXELS(默认为8)。这样的省份可能太小以致影响玩家的体验。
省份id应当尽可能地相邻,过大的间隔会让游戏崩溃。
文件provinces.bmp应当是RGB模式并且保存为24位位图文件(.BMP)并且没有色域信息。
地形地图(Terrain Map)
terrain.bmp是一个控制地形分配和纹理的8位索引模式的BMP文件。地形的列表可以参考 /Hearts of Iron IV/common/terrain/00_terrain.txt文件的底部。地形只影响地图和省份间路径的视觉效果;省份本身的地形由definitions.csv定义。
树木地图(Tree map)
trees.bmp控制地图上树木的摆放。文件trees.bmp的分辨率影响树的密度。
文件trees.bmp应为索引模式并保存为8位位图(.BMP格式)。
河流地图(River map)
rivers.bmp控制地图上的河流。该文件中的河流应当只有1像素宽。
文件rivers.bmp应为索引模式并保存为8位位图(.BMP格式)。
Index | 颜色 | 意义 |
---|---|---|
0 | (0, 255, 0) | 河流的源头 |
1 | (255, 0, 0) | 流入源。用于把多条河流合并为一条干流。 |
2 | (255, 252, 0) | 流出源。用于把一条河流分流为多条支流。 |
3 | (0, 225, 255) | 外观最窄的河流 |
4 | (0, 200, 255) | 外观较窄的河流 |
5 | (0, 150, 255) | |
6 | (0, 100, 255) | 外观较宽的河流 |
7 | (0, 0, 255) | |
8 | (0, 0, 225) | |
9 | (0, 0, 200) | |
10 | (0, 0, 150) | |
11 | (0, 0, 100) | 外观最宽的河流 |
列表中的 0[2] 到 6[3] 在游戏机制中被识别为小河,后续直到 11[4] 被识别为大河。为了正确渲染,每一条河都必须被唯一标识,即只有一个起点(绿色/黄色)或一个终点(红色)。
如果两个省份之间的 路径 与一条河流的像素重叠,将会被视为跨河。如果它与多条不同类型的河流的像素相交叉,行进类型将由游戏实际行为决定。为了避免玩家困惑,省份的路径应该明确的穿越或者远离河流。
高度地图(Height map)
heightmap.bmp 决定了地图的3D网格。( 0, 0, 0 ) 表示最低点,(255, 255, 255) 表示最高点。海平面的高度为 (95, 95, 95),所以任何低于这个值的地形都会处于水下。
应当使高度平滑过渡,否则地图会出现锯齿状边缘。
heightmap.bmp 文件以灰度模式保存为一张8位的位图图片文件 (.BMP)。
Normal map
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.
Color maps
The colormap_x.dds files define the overall color tint applied to the map. Without a colormap file, all land will appear the same overall color, regardless of terrain type.
They should be in RGB mode and saved in the .DDS format, using the 8.8.8.8 ARGB 32 bpp profile with no mipmaps.
Water map
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 with no mipmaps.
Adjacencies
The adjacencies file is found at /Hearts of Iron 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 modifies and adds custom adjacencies between provinces on top of the normal connections defined by the provinces and rivers maps. For example it controls which provinces non-contiguously connect to other provinces. 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. It also allows changing the properties of an existing connection, e.g. making them impassable, changing their type, or defining which provinces are gated by straits.
The format is as follows:
From;To;Type;Through;start_x;start_y;stop_x;stop_y;adjacency_rule_name;Comment <province id>;<province id>;<type>;<province id>;<map coordinate>;<map coordinate>;<map coordinate>;<map coordinate>;<comment> -1;
The type may be empty for a normal land connection, or "river"/"large_river"/"sea"/"impassable" for a connection of the respective type. The "through" field defines a province that can block the adjacency. While an enemy unit controls this province, the connection will be unavailable. -1
disables this feature. 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. Optionally an adjacency rule can be referenced that controls access through the adjacency.
Even when otherwise empty, the file must be terminated with a line containing a negative from-field and a semicolon to prevent an infinite hang on start-up.
Strategic Regions
Every province must belong to a strategic region. If you interact with a province in-game and it does not belong to a state, you will experience a crash to desktop.
A strategic region may contain provinces from multiple states, but a state should not have provinces in multiple strategic regions as this can cause instabilities and will show a warning in error.log.
Strategic Regions are formatted as follows, in example:
strategic_region={ id=18 name="STRATEGICREGION_18" provinces={ 2775 2799 2824 2847 2871 2895 2977 3528 4370 5929 7242 8450 8621 11748 12389 13004 13006 13007 } }
The color of the strategic region is random. However, you can manually define an area's color:
color = { <r>, <g>, <b> }
The color definition used the default RGB values, which range from 0 to 255 (i.e. not decimal RGB).
Supply areas
All states must be associated with a supply area. Each supply area can take any number of states, and each state should be in only one supply area.
Supply areas are formatted as follows:
supply_area={ id=1 name="SUPPLYAREA_1" value=12 states={ 5 85 } }
大陆(Continent)
可以在"map"文件夹的"continent.txt"文件中找到。大陆被用来定义AI区域。
所有地块必须属于某一个大陆,否则会遇到错误/崩溃。
原版游戏中的大陆是 (大陆后的数字是它们的ID):
欧洲(1)
北美洲(2)
南美洲(3)
大洋洲(4)
非洲(5)
亚洲(6)
中东(7)
(修改原因:原大陆和其ID可能有错误)
Ambient Objects
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).
Terrain Atlas
The terrain textures used for specific terrains are found in atlas0.dds and atlas_normal0.dds.
The association between the texture and terrain is found in /Hearts of Iron IV/common/terrain/00_terrain.txt. Within this file is the terrain scope which defines the terrain objects used by the game to interpret the terrain.bmp.
- type is the terrain category assigned to provinces that are covered by the specified terrain in the terrain.bmp.
- color is the indexed color from the terrain.bmp that represents this terrain object.
- texture is the tile from the terrain atlas textures that this terrain object uses.
When the game automatically generates terrain (i.e. using the Nudger) these terrain objects are what control the assignment of terrain categories to provinces.
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 constants.fxh in /Hearts of Iron IV/gfx/FX/, edit the MAP_NUM_TILES variable to match your new number of columns and rows (a setting of 5.0 will result in 5 x 5 = 25 texture indices, as opposed to the vanilla 4 x 4).
It is possible to increase the size of the texture tiles within the texture atlas. In pdxmap.shader in /Hearts of Iron IV/gfx/FX/, edit the TEXELS_PER_TILE variable to your new size.
Seasons
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.
Color map and city lights
/Hearts of Iron IV/map/terrain/colormap_rgb_cityemissivemask_a.dds serves two purposes. The RGB channels define the default coloring of the map, which gets modified by terrain. When making changes to the terrain or height map, this color map should be updated too to reflect the changes visually. The alpha channel is used for city lights at night. More opacity means stronger lights.
The file should have half the vertical and horizontal resolution of the map.
Sizes
It is possible to change the size of the map, with the majority of bitmap files requiring the same resolution.
- The vertical and horizontal resolution should be a multiple of 256
- world_normal.bmp should have half the vertical and horizontal resolution of the map
- trees.bmp should have the vertical and horizontal resolution of the map at a ratio of 0.29296875
- The maximum area of pixels does not exceed 13,107,200
It will be necessary to use the Nudge tool to adjust any ambient objects to suit the new map.
文件 | 效果 • 条件 • 定义 • 修正 • 修正列表 • 作用域 • 本地化 • on action • 数据结构 (标记, 临时标记, 国家别名, 变量, 数组) |
脚本 | 成就修改 • AI修改 • AI focuses • 自治领修改 • 权力平衡修改 • 剧本/标签 (游戏规则)• 建筑修改 • 人物修改 • 修饰性TAG修改 • 国家创建 • 军队修改 • 决议制作 • 装备修改 • 事件修改 • Idea修改 • 意识形态修改 • 军工商修改 • 国策制作 • 资源修改 • Scripted GUI • 科技制作 • 单位修改 |
地图 | 地图 • 省份 • 补给区域 • 战略区域 |
图形图像 | 界面 • 图形资产 • 实体模型 • 后期特效 • 离子效果 • 字体 |
装饰性 | 肖像 • 命名列表 • 音乐 • 音效 |
其他 | 控制台指令 • 故障排除 • 模组结构 • 成就代码分析 • Mod相关 • Nudger修改 |
- ↑ forum:1153223
- ↑ NMilitary.RIVER_SMALL_START_INDEX
- ↑ NMilitary.RIVER_SMALL_STOP_INDEX
- ↑ NMilitary.RIVER_LARGE_STOP_INDEX