Genes modding

From Imperator Wiki
Jump to navigation Jump to search

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.

The 00_genes.txt, as seen using the CWTools extension for Visual Studio Code

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[edit]

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[edit]

General overview of the structure of the 00_genes.txt file.

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

Technical descriptions[edit]

Indices[edit]

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[edit]

Commented example[edit]

Practical examples[edit]

Creating a new clothing set[edit]

Creating a new gene[edit]

Documentation EffectsTriggersModifiersScopesVariablesData TypesLocalisationCustomizable localization
Scripting AIBuildingsCasus belliCharacterCharacter InteractionsCombat TacticsCountriesCultureDecisionsDefinesEconomic PoliciesEventsEthnicitiesGovernmentGovernor PoliciesIdeasModifiersMilitary TraditionsOfficesOn ActionsPartiesPricesPopsReligionScript ValuesScript ModifiersSetupSubject TypesTechnologyTrade goodsTraitsUnits
Map MapTerrain
Graphics 3D ModelsInterfaceGraphical AssetsFontsParticlesShadersUnit models
Audio MusicSound
Other Console commandsChecksumMod structureTroubleshooting