• We have updated our Community Code of Conduct. Please read through the new rules for the forum that are an integral part of Paradox Interactive’s User Agreement.
Since there was some discussions and curious people in the last dev diary thread I thought I should take a break from HOI3: For the Motherland and describe how the character portrait system works. If there are any art questions perhaps Danevang who is doing the actual art can answer those for you, I will focus more on the technical aspects. Remember that all of these pictures are still very much in progress and things will change and a lot of things will be added.


The primordial goo

The way a character looks is based on two things: inheritance (we call this DNA) and other factors (we call these properties). Your DNA is created when you are born and cant be changed. Its a mix of your characters parents DNA plus a small "mutation chance" to simulate genes from ancestors and to make people look different despite not having millions of characters. Properties on the other hand change during a characters lifetime depending on traits, social status etc.

For example DNA will tell if you inherited the big 'ol family potato nose and blond hair (and if not it might cast some suspicions on what your mom was up to while your dad was busy crusading) and properties will tell what kind of hair style you prefer and if you are likely to wear a crown because you're king and how fancy your clothes are.
Currently there are 11 DNA genes and 6 properties for each character, but its not unlikely that we will increase these during the project.

Below is a picture showing inheritance, sadly none of our female portraits are ready for showing yet so I'v shown only the male line:

stenkil.png

You can also see the effects of properties, our character in the middle is a king with a crown and one of his sons is a bishop, above him is his late father. This picture also shows the effect of aging. We currently have 4 age levels for the portraits so you will see your characters grow wrinklier, get bigger ears and their hair thinning and becoming white.

The DNA is scriptable in history files for character if we want to make someone look like their historic counter part (arguably this was more important in EU: Rome because the romans were pretty good at making statues so we could see what people looked like), then during startup the game will run through characters outwards from scripted ones and propagate their genes for a plausible result for all the ones not scripted.


Hey, you said this was about modding not biology!

ok ok, lets see some code and I'll show you how characters can be modded.
Character portraits are described in two files, one for the graphics and one for scripting logic around properties.

Graphical portrait setup
Code:
[COLOR=YellowGreen]# portraits.gfx[/COLOR]
[COLOR=YellowGreen]# graphical look of character portraits[/COLOR]

[COLOR=YellowGreen]# middle age[/COLOR]
portraitType = {
    name = [COLOR=Magenta]"PORTRAIT_norsegfx_male1"[/COLOR]
    effectFile = [COLOR=Magenta]"gfx\\FX\\portrait.fx"[/COLOR]
    layer = { [COLOR=YellowGreen]# GFX_TYPE:[d|p]INDEX:COLOR_LINK[/COLOR]
        [COLOR=Magenta]"GFX_character_western_background:p0"
        "GFX_western_male_clothes_behind:p3"
        "GFX_western_male_headgear_behind:p5"
        "GFX_western_male_beard_behind_midage:p4:h"
        "GFX_western_male_base_midage:p2"
        "GFX_western_male_neck:d0"
        "GFX_western_male_chin:d1"
        "GFX_western_male_mouth_midage:d2"
        "GFX_western_male_nose_midage:d3"
        "GFX_western_male_cheeks_midage:d4"
        "GFX_western_male_head:d5"
        "GFX_western_male_eyes_midage:d6"
        "GFX_western_male_eyes2:d6:e"
        "GFX_western_male_clothes:p3"
        "GFX_western_male_beard_midage:p4:h"
        "GFX_western_male_ear_midage:d7"
        "GFX_western_male_clothes_infront:p3"
        "GFX_western_male_headgear:p5"[/COLOR]
    }

    hair_color_index = [COLOR=Cyan]8[/COLOR] [COLOR=YellowGreen]# which DNA gene sets hair color[/COLOR]
    hair_color = { [COLOR=YellowGreen]# dark, base, highlight[/COLOR]
        { [COLOR=Cyan]15 8 0[/COLOR] } { [COLOR=Cyan]173 158 102[/COLOR] } { [COLOR=Cyan]255 255 255[/COLOR] }
        { [COLOR=Cyan]10 10 10[/COLOR] } { [COLOR=Cyan]125 100 82[/COLOR] } { [COLOR=Cyan]255 255 255[/COLOR] }
        { [COLOR=Cyan]30 22 18[/COLOR] } { [COLOR=Cyan]194 132 97[/COLOR] } { [COLOR=Cyan]255 255 255[/COLOR] }
    }

    eye_color_index = [COLOR=Cyan]9[/COLOR] [COLOR=YellowGreen]# which DNA gene sets eye color[/COLOR]
    eye_color = {
        { [COLOR=Cyan]58 109 193[/COLOR]}
        { [COLOR=Cyan]120 74 46[/COLOR] }
        { [COLOR=Cyan]34 103 36[/COLOR] }
    }
}
The name for the portrait type specifies that this is used for the norse graphical culture group and that he is male and middle aged (the number at the end sets age). The portrait is made up of 18 layers (this can change between ages and cultures as well if wanted) and each layer has a string describing it. Lets use "GFX_western_male_beard_midage:p4:h" as an example. This specifies that it should use an image from the GFX_western_male_beard_midage icon strip (specified higher up in the file), that it should use property 4 :)p4) from the character to decide which beard to pick and the last ":h" means that it should be colored using the characters Hair color. If we had wanted to connect to DNA instead of a property (like for the nose) we would write :d4 instead of p4.

Layers are free to connect to the same property and this is done quite a bit for clothes and beard/hair etc that needs to show both behind and in front of other layers. This is what GFX_western_male_clothes looks like for the first 3 options:

western_male_clothes.png

Further down are hair and eye colors specified. For hair there is 3 colors for each property so we can tint hair highlights differently from base colors etc.

Property scripting
A separate file "portrait_properties.txt" specifies what properties a character should have. These are updated on major changes on the character like a new trait, a new title etc and also randomly once in a while. Scripting properties looks like this this, any property not mentioned will basically have a random value picked (so if we don't specify anything for hair/beards you will just get a random beard):
Code:
[COLOR=YellowGreen]# p3 clothes[/COLOR]
[COLOR=Cyan]3 [/COLOR]= {
    [COLOR=Cyan]0[/COLOR] = { [COLOR=YellowGreen]# mail armour[/COLOR]
        factor = [COLOR=Cyan]1[/COLOR]
        modifier = {
            factor = [COLOR=Cyan]2.0[/COLOR]
            martial = [COLOR=Cyan]5[/COLOR]
        }
        modifier = {
            factor = [COLOR=Cyan]100.0[/COLOR]
            has_job_title  = job_marshal
            OR = {
                is_ruler = no
                is_theocracy = no
                NOT = { religion_group = christian }
            }
        }
    }
    [COLOR=Cyan]1[/COLOR] = { [COLOR=YellowGreen]# fancy shirt[/COLOR]
        factor = [COLOR=Cyan]5[/COLOR]
        modifier = {
            factor = [COLOR=Cyan]10.0[/COLOR]
            OR = {
                has_job_title = job_treasurer
                has_job_title = job_chancellor
            }
        }
    }
    [COLOR=Cyan]2[/COLOR] = { [COLOR=YellowGreen]# Catholic vestments[/COLOR]
        factor = [COLOR=Cyan]100[/COLOR]
        modifier = {
            factor = 0
            NOT = { religion_group = christian }
        }
        modifier = {
            factor = [COLOR=Cyan]0[/COLOR]
            OR = {
                is_ruler = no
                is_theocracy = no
            }
            NOT = { has_job_title  = job_spiritual }
        }
    }
}
The top level is the property, so 3 is the same as :p3 in the graphical description we showed above. The next level in specifies which entry among the icons to pick, this script basically selects between 3 options: chain mail, fancy shirt and a more spiritual outfit. The factors you see are just percentages, but if something is specified with a value of 100 or above it always overrules any other option after it.

Alright, hopefully that was clear. So lets test this with an example. We want to add another layer connected to property 6 to our portrait. lets call it "props" so first we declare a sprite like normally in our gfx file and refer to it in the portrait description at the very end with "GFX_western_male_props:p6". Then we add a rule in the properties script like so:
Code:
[COLOR=YellowGreen]# p6 props[/COLOR]
[COLOR=Cyan]6 [/COLOR]= {
    [COLOR=Cyan]0[/COLOR] = { [COLOR=YellowGreen]# empty, dont use props, this is default[/COLOR]
        factor = [COLOR=Cyan]1[/COLOR]
    }
    [COLOR=Cyan]1[/COLOR] = { [COLOR=YellowGreen]# new prop. overrule all if character qualifies[/COLOR]
        factor = [COLOR=Cyan]100[/COLOR]
        modifier = {
            factor = [COLOR=Cyan]0[/COLOR]
            trait = [COLOR=Red]cool[/COLOR]
        }
    }
}
This means that if our character gains the "cool" trait and we have done our modding correctly his portrait will be changed to something like this:

cool.png

Looks like this
*puts on sunglasses*
wraps up this developer diary.

YEAAAAAAAAAAAAAH!

(disclaimer: there probably wont be any sunglasses in the real game)
 
Last edited:
one reason not to go with genetics laws is that we have a limited set of characters unlike in the real world where there are billions of people. This means that there is a high risk of everyone looking like each others inbred cousins at the end of a long game if we model dominant genes. We also dont use genes from parents that might have been passed along but not become visible in the child. To simulate this to an extent we also have a small "mutation factor" of a few percent every time new dna is generated. In Rome we needed a pretty high mutation factor (20%) to make things look different enough but we are going to have more portraits and options and characters here in CK2 making something like 2-5% more of an option.

to support genetics rules we would also need a whole new rule system that would have to be made scriptable/moddable and we didnt think the result was worth the effort when it could also bring all sorts of problems with it.

But what about eugenics and marriage strategy?

How will the AI choose brides? If only the stats count, then the strongest individuals and their genes will survive and this will lead to the same effect, won't it?
 
The only thing i didnt in this DD was the chain mail representation (i think they call it mail coif in English). It looks like someone put a carpet over these guy's heads. A simple helmet or even padded coif

Yes, please, let us be even less historically accurate.

That guy in the middle (2nd from above) looks kinda too old for mail anyway.

Who told you that old Medieval noblemen didn't fight?

A Middle-Age nobleman is a man who has been trained to fight since he was 10, who has endured lots of skrimishes and battles, who has been hunting for decades, all his life, who has spent at least 10 years of his youth travelling across Western Europe from tournament to tournament.

This people are possibly the toughest warriors the world has ever seen, along with Japanese samurai. Men who have no concern other than war. If they don't catch any physical injury or any intern disease, they can still be on shape in their 60's and 70's.

William Marshal was kicking ass on the battlefield almost until he died, in his 80's. Henry VIII would have kept on being strong and athletic if he didn't suffer a leg injury that prevented him from doing any sport. Noblemen's medieval diet is not healthy, but if you excercise yourself in such an exhaustive basis, you can actually keep yourself very "young" until you die of some disease late in your 60-70's.

So, and old, 50-60 years old Medieval nobleman in battledress is actually very accurate.
 
But what about eugenics and marriage strategy?

How will the AI choose brides? If only the stats count, then the strongest individuals and their genes will survive and this will lead to the same effect, won't it?

In CK1 this was a problem early on. It was dealt with by making all stats except health and fertility basically random. Babies had zero in everything, and each year they'd gain a point or two in a randomly determined stat. Tghe only drawback was that they ended up having better stats overall then the people present at scenario start because they gained too much every year, but that is fairly easy to solve.

Health and fertility may creep up under this system, especially since we're not gonna have a lot of randomly generated courtiers, but having healthier people in 1450 then their ancestors were in 1066 isn't exactly game-breaking IMO.

Presumeably the same system will be present in CK2.

Nick
 
But what about eugenics and marriage strategy?

How will the AI choose brides? If only the stats count, then the strongest individuals and their genes will survive and this will lead to the same effect, won't it?

I'm not in the know for character ai because I'm on a different project now, but I would find it likely that ai is mostly going to be concerned with what titles etc a potential bride brings along as well as diplomatic situation. Stats will be secondary to the impact of those. Unless of course if you are breeding some übermensch heir :)
 
Last edited:
Stats should count very little when it came to choose a wife. Wives were:

1- A way to get land.
2- A way to get money through dowry (and until the XIIIth Century, it was THE MAN who gave dowry to the woman).
3- A way to get better social status. If you're a lord and get married to the daughter of a count, you get to be more important.

That's what should count. If the woman who just gave you Aquitaine is a master deciever or as dumb as a fly, that should not be your concern anyhow.

As far as I see it, the only trait that should count is fertility. And if a marriage has lasted too long and there has been no issue, then... well, get some gold to pay the Pope for an annulation...
 
That is ahistorical, the people of the middle ages looked at the stats when they chose a bride.

Since you have no indicators of such, sarcasm?

I completely agree with Cèsar on this point anyhow, wives and consorts had a political function and very few (in some cases except for when their sons were in minority and were subject to a regency) played an active role as a chancellor, steward, spymaster or some such and were not sought after by those qualities. When married, consorts preserved (or undermined) the legitimacy of the regent and in some cases kept the court stylish, grand and lively. Therefore the only real stat that could determine the behaviour of the consort in the constrains of the role would be intrigue (and health+fertility, but that's another matter). And it certainly wouldn't be a thing a prince would seek out but if the benefits of the marriage were great enough (mostly they would be, why else would one marry?! (rhetorical question)), it wouldn't be an obstruction either.
 
I have just one question regarding the character portraits. Will the clothes change with time reflecting the change in fashion of the medieval era? Or will a king in 1066 look exactly like a King in 1399?
 
I tended to use my ruler's female relations as council members, because I usually lacked enough good courtiers to go around, ahistorical as it might be. In many cases only the bishop and marshal were male in my games. I did notice from any early screenshot that there was a law decision to allow female chancellors, so maybe it could be an evolutionary development. The game is all about relationships, so a close bond between the liege and his or her consort could lead to a different situation than may have been more average in reality. Appointing women to the council might cause a scandal, but I think that like many things you should be free as a player to attempt whatever quirky developments in your own realm's history as you like.

That said, women should play a very strong role in court life, whether or not they held formal power on the council. They set the mood, and a queen with strong diplomatic or intrigue stats could turn things one way or another. King commented at the Paradox Convention that marriages will also play a role in alliance-making and CBs: his example was that if your son-in-law is attacked, that you will be called in to intervene in the conflict, so that is something to keep in mind, too.
 
Also, there's a thing few people are aware of: Medieval men didn't look for their own wives. Their family did it for them, or if they wanted, they could hire a professional bride-searcher, or ask their assistant to do it.

No man, noble or not, however vile or commoner he was, looked for a bride. It was just not the habit.

More reasons to include a proper bride-finder in game. I can see two ways: events ("your mother thinks X is a suitable bride for you. Accept or decline") or hiring a professional (in exchange for gold, he'll give you a list of availiable brides.

And, of course, you could do it yourself as well.
 
More reasons to include a proper bride-finder in game. I can see two ways: events ("your mother thinks X is a suitable bride for you. Accept or decline") or hiring a professional (in exchange for gold, he'll give you a list of availiable brides.

By the screenies we've seen so far, it seems every "office" of every ruler will have three options, so finding a bride should be a perfect mission for your chancellor.
 
By the screenies we've seen so far, it seems every "office" of every ruler will have three options, so finding a bride should be a perfect mission for your chancellor.

Or spymaster. But you might get different results. But this is a good idea for a mission. I would like to have this kind of complexity, given the importance of political marriages. It gives another dimension to the game.
 
I'm not in the know for character ai because I'm on a different project now, but I would find it likely that ai is mostly going to be concerned with what titles etc a potential bride brings along as well as diplomatic situation. Stats will be secondary to the impact of those. Unless of course if you are breeding some übermensch heir :)

Now that I think about it, if we'll have the ability to promise marriages between underaged members of dynasties, then the eugenics will automatically become secondary, since you'll choose to arrange marriages for diplomatic reasons primarily, as you can never be certain of what stats the other prince/princess will have when they finish their education.

So fingers crossed for arranged marriages.
 
Now that I think about it, if we'll have the ability to promise marriages between underaged members of dynasties, then the eugenics will automatically become secondary, since you'll choose to arrange marriages for diplomatic reasons primarily, as you can never be certain of what stats the other prince/princess will have when they finish their education.

So fingers crossed for arranged marriages.

That would be nice. I don't know if this is a common problem, but a couple of centuries in, I would always get a lot of inbreeding with my very dominant dynasty. Is there going to be a way to introduce new blood or will we be stuck with the same families for four centuries? Then again, maybe I got too good at arranging strategic marriages that created dynastic unions like every generation. ;)
 
That would be nice. I don't know if this is a common problem, but a couple of centuries in, I would always get a lot of inbreeding with my very dominant dynasty. Is there going to be a way to introduce new blood or will we be stuck with the same families for four centuries? Then again, maybe I got too good at arranging strategic marriages that created dynastic unions like every generation. ;)

Well there were certain religious rules concerning marriages, like laws against consanguinity for which a dispensation was needed if they still wished a certain strategic marriage. Maybe certain rules should be applied in CK2?
 
Well there were certain religious rules concerning marriages, like laws against consanguinity for which a dispensation was needed if they still wished a certain strategic marriage. Maybe certain rules should be applied in CK2?

I wish that were true. I had so many cousin-cousin=cousin-cousin marriages in my dynasty that only my senior line (which I controlled) could bear children any more. It is a demographic problem that can I think only be avoided with basic rules of the game for the AI to follow. I think that I used too much nepotism in granting titles, because most of the titleholders in western Europe had the dynastic name Jimenez.
 
To be clear I wasn't talking about CK1, but about what should (perhaps) be implemented in CK2. Not only nepotism, but the AI in general has the tendency to revoke titles from traditional (lower) titleholders for their ruler's offspring, so the system and rules for revoking titles should also be improved.
 
To be clear I wasn't talking about CK1, but about what should (perhaps) be implemented in CK2. Not only nepotism, but the AI in general has the tendency to revoke titles from traditional (lower) titleholders for their ruler's offspring, so the system and rules for revoking titles should also be improved.

I entirely agree with you on the revoking of titles by the AI. Historically, this would lead to a civil war every generation. Lieges couldn't do that much about who held titles in their realms, as I'm sure you know.