The common/alternate_start folder is used for defining settings for the alternate start generation, both Shattered World and Random World.
Settings follow this format:
name = { # Name of the setting. Same name in loc will be used, prefixed with "setting_". E.G., "setting_name" in this case. That key post-fixed with "_tooltip" will be used for the tooltip, and with "_tooltip_delayed" for the delayed tooltip
}
Settings come in the following types:
Settings can set various parameters that will be executed by the code, or referenced by script. Full list of parameters with code effects:
* generate_dukes = yes # Elevate a count in every duchy to duke, and vassalize the other counts * consolidate_dukes = yes # The dukes will also get every county in their duchy, held personally * holding_type = historical # Does not touch holdings, but makes all rulers of one or two holding tribal provinces (note holdings, not slots) of Nomadic cultures Nomads * holding_type = feudal # Makes every county in the game have a feudal, temple, and city holding, in that order * holding_type = tribal # Makes every county in the game have just a single tribal holding * holding_type = nomadic # Makes every county in the game have no holdings whatsoever * holding_type = tribal_nomadic # Makes all Nomadic cultured provinces (as defined in the culture itself) have no holdings. Everything else has a single tribal holding * holding_slots = random # Causes the number of holding slots to be randomized between 1 and 7. Formula is ( 2d7 + 1 ) / 2 * holding_slots = one-seven # Causes the number of holding slots to be set to this number in the whole world * culture = random/full_random # Causes culture to be randomized. See "culture and religion spread" section * religion = random/full_random # Causes religion to be randomized. See "culture and religion spread" section * technology = flat # Causes all provinces to have the same tech level (interpolated by year between the ideal years for 0 and 8 tech) * dejure_kingdoms = none # Causes all dejure kingdoms and empires to get removed * dejure_kingdoms = random # Causes all dejure kingdoms to be replaced with randomly generated ones * dejure_empires = none # Causes all dejure empires to get removed * dejure_empires = random # Causes all dejure empires to be replaced with randomly generated ones * holy_sites = random # Causes holy sites for any religion with provinces on the map to be randomized. See "holy site generation" for more info * culture_names = random # Causes culture names to get randomized. See "culture name generation" for more info * religion_names = random # Causes religion names to get randomized. See "religion name generation" for more info * religion_features = random # Causes religions to have their features reset, and then generated from the religion_features folder in common. See "religion feature generation" for more info * generate_random_dukes = yes # Elevate counts to dukes if they meet certain requirements. For more info, see "random duke/king/emperor generation" * generate_random_kings = yes # Elevate rulers to kings if they meet certain requirements. For more info, see "random duke/king/emperor generation" * generate_random_emperors = yes # Elevate rulers to emperors if they meet certain requirements. For more info, see "random duke/king/emperor generation" * generate_random_holdings = yes # Randomizes the holdings in the world. For more info, see "random holding generation"
You can also define any parameter in order to reference it in script with the "has_alternate_parameter" trigger. E.G., "test = hello" would have no effect, but could be checked in script with has_alternate_parameter = { key = test value = hello }
The following sliders have code effects:
The following double sliders have code effects:
Settings are executed in priority order. When priority is the same, ties are broken by definition order. The parameters of a setting are executed before the "effect" section. All options are executed *after* the generation of counts, but before the game has actually started, unless "apply_before_generation = yes" is set. If set, the option is instead executed before character generation.
The on-action "on_alternate_start" will be run on game start if an alternate start is used. It fires after the generation is done, the save loaded, and execution of startup stuff completed
is_alternate_start = yes # Whether the game was started as a shattered/random world
is_shattered_world = yes # Whether the game was started as a shattered world
is_random_world = yes # Whether the game was started as a random world
has_alternate_start_setting = { # Whether the given setting has the given option
setting = dukes # The key of the setting to check
option = checked # The key of the option to check for
}
has_alternate_start_parameter = { # Whether the given parameter has been set to the given value
key = generate_dukes # The parameter key to check
value = yes # The value key to check for
}
has_alternate_start_setting = { # Whether the given setting has the given value
setting = female_percentage # The key of the setting to check
value > 10 # The value to compare to. Also takes variables
}
has_alternate_start_setting = { # Whether the given setting has the given bounds
setting = age_bounds # The key of the setting to check
max > 10 # The value to compare the max value to. Also takes variables
min > 5 # The value to compare the min value to. Also takes variables
}
is_name_randomized = yes # Checks if the name of the religion or culture currently scoped to has been randomized
Future: is_random_world = yes
export_to_variable = { # Will export the value chosen by the player for a setting to a provided variable
which = variable_name # Variable to export to
value = alternate_start_value/ # What to export
alternate_start_min_value/
alternate_start_max_value
key = setting_name # Which setting to export it from
}
It is possible to randomize cultures and religions. The basic process is this:
0. All cultures/religions are cleared from the map 1. For every group, a random province is chosen as the seed province (for religions, this is weighted using "religion_group_spawn", which can use the special trigger any_religion_distance to check the distance to groups already spawned. Religion group spawn happens in a random order) 2. Each province that neighbors a group gets its score calculated. Note that this means a province that borders multiple filled out provinces can have multiple entries. Even for the same group 3. A province is picked by random (weighted proportionally by the score) from the score list, and given the culture/religion group 4. Step 2 and 3 are repeated until all provinces have a culture/religion group 5. For each group, the religion/culture is cleared once more. Each culture/religion within that group randomly picks a starting province within the area allocated to the group. Steps 2 through 4 are then run using cultures rather than group
On top of normal adjacencies, the adjacencies from the "adjacencies" section are used. See the "adjacencies" section of this document. These are *required* if your mod has islands, as otherwise they might end up with no culture or religion. Your territory thus has to be fully connected. You can ensure a score of 0 to make sure it only ever spreads via such an adjacency when there are literally no other options though.
Scoring is done by the culture_spread and so on sections. In vanilla you find these in 01_spread.txt. The scopes available are the culture/religion as ROOT, and the province being evaluated as FROM. For the groups, the provided culture/religion scope is the first entry within the group.
You can also set the following parameter in religions, cultures, and their groups: alternate_start = { some_trigger } The scope is the culture/religion (first culture/religion in group if on group-level). Can be used to check for specific settings and the like
Kingdom/empire generation works somewhat similarly to culture and religion. However, instead of all cultures/religions getting evaluated at the same time, for title generation only a single title is generated at a time.
On top of normal adjacencies, the adjacencies from the "adjacencies" section are used. See the "adjacencies" section of this document.
The algorithm is this: 1. We keep a list of all provinces that are on the border of the duchies handed out so far 2. We grab a random unassigned duchy that borders one of those provinces. If we're out of border provinces, we just grab a random unassigned duchy 3. We then grab random duchies that border the just created kingdom until we either hit our target size (random number in the range provided by the slider slider) or we run out of bordering duchies 4. If we're short of the minimum number of duchies, we try to find a neighboring kingdom to merge with. If the current kingdom is one duchy large, it will merge no matter what. Otherwise, it only merges if that would still leave it under the max duchy limit. E.G., if the min is 3 and the max 10, a 2-duchy kingdom would merge with a neighboring 8-duchy kingdom, but not a 9-duchy kingdom 5. We return to step 2 until we are out of unassigned duchies For empires, just replace "duchy/kingdom" with "kingdom/empire".
At the end of this process, the game attempts to give away duchies/kingdoms that are only slightly connected to the rest of the kingdom/empire, so as to get more realistic title shapes. This always respects the min and max duchies/kingdoms.
Duchies/kingdoms are picked similarly to provinces in the culture/religion spread; for every province the title being generated currently borders that is not already given to a title, a score is calculated. Note that like culture/religion spread, each unique border pair gets its own score, so if two provinces both border the same two provinces in another duchy, that's a total of four scores. This helps keep the titles compact.
The kingdom scoring is done in dejure_kingdom_spread. The empire scoring is done in dejure_empire_spread. ROOT is the province being evaluated. FROM is the province within the title closest to its geographical center of the title being generated, updated as more duchies/kingdoms are added to it. FROMFROM is the province bordering the province being evaluated
The historical dejure kingdoms/empires get marked as inactive.
Adjacencies follow this format: adjacencies = { 1 = 2 # The two provinces to connect. Order does not matter; the connection is two-way 2 = 3 ... }
The game will generate five holy sites for any religion with provinces on the map if the "holy_sites = random" parameter is provided.
Any province with a county title is eligible for this. The selection ensures the same province cannot be selected twice. Parent religions will be processed before their heresies, ensuring you can base heresy holy sites partially or entirely on parent religion holy sites if you want.
A province is selected at random based on the weighting provided in "holy_site_spread".
To make nice-looking selection easier, we've added the following triggers:
When holy sites are randomized, the preferred capital of the rel head title will be set to the first generated holy site.
The game makes sure all holy sites end up with a temple, increasing the # of holding slots if necessary. In Nomad titles this will result in no temple, but guarantees enough slots to build one
Be aware that the spread calculations use 32-bit fixed point numbers. This means that if the sum of all chances is above roughly 2.1 million, the numbers will go negative and all hell breaks loose. Therefore, try to keep your numbers within reason. It also means that modifiers smaller than 0.001 are not possible; it will be interpreted as 0.
The culture naming is very simple. The game will compile a list of every county that has the culture. It will then pick one at random (unweighted), and then 50-50 to pick either the county's adjective or the adjective of the duchy it is in. The exact same thing is done for culture groups, except checking the counties' culture group rather than culture.
Religion naming comes in three formats: character name based, dynasty name based, and holy site based. These are equally likely.
What loc keys to use are defined in "religion_name_formats" (02_naming.txt in vanilla). Note that all three sections *must* have at least one key, or the game will crash when religion name randomization is used.
If holy site is picked, a random loc key from the "holy_site" section will be picked, and a random holy site will get picked and the name of the county inserted.
If character or dynasty based naming is picked, a list of all provinces with the religion will be made, much like for culture generation. One is picked at random, and the culture in that province used to generate the name. For character name based, it will pick a random male name, weighted according to the regular naming weights. For dynasty name based, it will pick a random dynasty of that culture with no restrictions. This pick is unweighted. The last word in the dynasty name will be used if it consists of more than one word. Apostrophes E.G., as in d'Anjou) will be considered as spaces.
It then takes a random loc key from the character/dynasty section, and runs it through localisation.
Gods, piety, and so on get their names randomly selected from the corresponding section in religion_name_formats. These are simply loc keys that provide suitable generic names. Heresies will take their descriptions from heresy_desc rather than desc. Descriptions will be unique as long as you have defined at least as many descriptions as there are religions that can spawn on the map, as divided between heresies and non-heresies.
Religions with no provinces will copy their parent religion's naming for gods and so on, while generating a name of their own based on the culture used for the parent religion's name, or its holy sites.
After the naming has been decided the scripted effect "randomize_religion_names_effect" is called. There is no scope. It is used to activate, give holders and rename all religious titles.
When religion names are randomized, the icons will be replaced with the religion icon strips in gfx/interface/shattered_random
Religions are processed in definition order, except with all base religions first, then heresies. Reformed versions get their features removed, but no new ones generated since that gets handled by reforming the religion. First, the scripted effect "reset_religion_features_effect" is called. The scope provided is the religion as ROOT. Then features are picked according to the ai_will_do of the features. Note that the FROM scope will be undefined as there is no reformer.
When features are randomized, "allows_matrilineal_marriage" in governments will be ignored and assumed to always be "yes".
Random duke generation works pretty simply. We roll a number from 0 up to and including 99. If it is below the "duke_ignore_rate" parameter, we skip this duchy.
We make a list of all rulers in the duchy. We sort it by # of counties they have in the duchy. Then we grab the one with the most counties. Ties are broken by # of counties held (that is, if they hold more outside the duchy). A ruler is considered to hold their personal counties, and those of any vassal who is at least two levels below the tier being generated (not relevant for dukes, but gives better results for kings and emperors). If they hold at least as many % of the duchy as "duke_threshold" duke parameter, we give them the duchy. For the remaining rulers in the area, if they are still count-level and independent, we roll for each a number between 0 and 99. If it is below the "duke_vassalization_rate" parameter, they get vassalized by the duke. Rulers with more than half their realm outside the dejure area will not get vassalized
For kings and emperors, same as above, but replace the word "duke". Any enclaves (defined as a realm bordering only a single realm, and not being coastal) get vassalized by the realm surrounding them, assuming they're higher tier
| 历史 | 角色 • 家族 • 省份 • 头衔 • 剧本 |
| 脚本 | 指令 • 条件 • 作用域 • 修正 • 事件 • 决议 |
| 常规 | 定义 • 游戏规则 • 另类开局 • 宗教 • 文化 • 政体 • 特质 • 血脉 • 科技 • 法律 • 建筑 • 宣战理由 • 朝贡国 • 单位 • 目标 • 疾病 • 死亡 • 荣誉头衔 • 社团 • 宝物 • 地图外政权 • 内阁成员 • 贸易路线 • 继承 • 奇观 • 称号 |
| 图像/音效/本地化 | 地图 • 图形 • 盾徽 • 肖像 • 界面 • 小地图 • 音乐 • 本地化 |
| 其他 | 故障排除 • 验证器 • 控制台指令 • 编辑游戏存档 • Steam创意工坊 • EU4转档器模组制作 |
EU4转档器模组制作Random WorldSteam创意工坊事件模组制作作用域修正内阁成员模组制作决议模组制作剧本模组制作单位模组制作历史模组制作另类开局模组制作图形模组制作地图外政权模组制作地图模组制作头衔模组制作奇观模组制作宗教模组制作定义宝物模组制作宣战理由模组制作家族模组制作小地图模组制作建筑模组制作指令控制台指令政体模组制作故障排除文化模组制作朝贡国类型模组制作本地化条件模组制作死亡模组制作法律模组制作游戏规则模组制作特质模组制作界面模组制作疾病模组制作目标模组制作盾徽模组制作省份模组制作社团模组制作科技模组制作称号模组制作继承模组制作编辑游戏存档肖像模组制作脚本荣誉头衔模组制作血脉模组制作角色模组制作贸易路线模组制作音乐模组制作验证器