Genes in Imperator define the various parts that make up character portraits. They are seperated into gene types (such as accessories), which contain one or more categories (such as clothing), which can include gene sets (such as Greek clothing). This hierarchy allows modders to add not only new sets, but also entirely new genes.
The gene sets defined within the genes file are used in the ethnicities file. This makes cultural clothing, hairstyles, skin colours and much more possible.
Genes have the ability to be marked as inheritable, allowing their children a chance of having the same gene selection.
Creating new genes.txt files isn't supported, so modders are required to copy and edit the vanilla 00_genes.txt file. This is due to the way genes are structured, with the categories only being read once by the game and overwriting one another.
Basics
The genes data is contained within the 00_genes.txt file located in the game/common/genes folder.
While editing the file can be done in any text editor, a proper text editor is recommended. Using Notepad++ or Visual Studio Code with the CWTools Extension will allow modders to easily contract and expand sections of code and more easily spot missing brackets.
The 'reload' commands in Imperator allow modders to easily test changes to the genes without restarting the game. To do this, the user must first ensure their game has the correct launch parameters added to allow use of the console. To do this; right-click the game on Steam, choose Properties, Set Launch Options, add "-debug_mode -develop" (without quotes).
pressing ` (tilde) in-game will bring up the console. Typing "reload genes" (without quotations) will load any changes made to the genes file since starting up the game.
General structure
The genes are contained in a hierarchy which separates the various parts of a portrait into logical sections. Most gene entries must iterate upon an 'index' number.
Gene categories can be seen in the portrait editor in-game, accessible by typing "pe" (without quotations) in the console.
- Gene Type - The highest level of gene. Each new entry does not require an index number. Contains one or more gene categories.
Example: Accessory Genes - contains all clothing, hairstyles, beards etc.- Gene Category - Each new category iterates upon an index number shared by all other categories, regardless of Gene Type. They also have the option of being inheritable or not. Contains one or more gene sets.
Example: hairstyles / index = 95 / inheritable = no - contains all hairstyle gene sets, use the unique index number of 95 and are not inherited by children.- Gene Sets - Each gene set iterates upon an index number only used within that particular gene category. Contains one or more set entries.
Example: roman_hairstyles / index = 1 - contains the set entries that Roman portraits will use in-game.- Set Entries - Each set entry defines who will use the contained objects, generally based on gender and age. Also contains weighted odds for specific objects being chosen.
Example: male / 6 = male_hair_roman_1 - tells male romans to use male_hair_roman_1
- Set Entries - Each set entry defines who will use the contained objects, generally based on gender and age. Also contains weighted odds for specific objects being chosen.
- Gene Sets - Each gene set iterates upon an index number only used within that particular gene category. Contains one or more set entries.
- Gene Category - Each new category iterates upon an index number shared by all other categories, regardless of Gene Type. They also have the option of being inheritable or not. Contains one or more gene sets.
Technical descriptions
Indices
Gene categories and gene sets make use of index numbers, starting from index = 0. Gene categories globally use the same index sequence, while gene sets have a unique index sequence per category. Using the same index number twice for a category or set will cause only one to be loaded in-game. This is the main reason why making a new genes file isn't possible, as it will overwrite index numbers.
Weighted random selections
Commented example
Practical examples
Creating a new clothing set
Creating a new gene
文档 | 效果指令 • 触发条件 • 修正列表 • 作用域 • 变量 • 数据类型 • 本地化 • 可自定义的本地化 |
脚本 | AI • 建筑 • 宣战理由 • 人物 • 人物互动 • 战术 • 国家 • 文化 • 决议 • Defines • 经济政策 • 事件 • 渊源 • 政府 • 总督政策 • 理念 • 修正 • 军事传统 • 官职 • 行动 • 派系 • 价格 • 人口 • 宗教 • 省份 • Script Values • Scripted Modifiers • 附属国类型 • 科技 • 商品 • 特质 • 单位 |
地图 | 地图 • 地形 • 地图定位器 |
图形 | 3D模型 • 界面 • 盾徽 • 图形资产 • 字体 • 粒子效果 • 着色器 • 单位模型 |
音频 | 音乐 • 音效 |
其他 | 控制台命令 • 校验和 • 模组结构 • 错误调试 |