• 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:
I have a question about heritability etc.

There are two scenarios I'mthinking about: one, where you get a "pretty wench catches your eye" event, which spawns a bastard, and two, when two characters in a court become "friends" and one of them ends up pregnant.

IOjn the first case, would the DNA descent be consistent with the family simply becuase the wench doesnt exist as an in game entity?

In the second, does the DNA descent really go by parents, as opposed to who is spouse? I don't actually even know if that sort of thing actually happens in the game engine, but it would be cool to have, for example, one child over whom a cloud of suspicion hangs because they have unusual hair colour or something.

Bastards in CK1 did not have a mother. So if the same is true here, half the DNA will probably be random, thus maybe generating a child that looks very different from his/her siblings.
 
Also, try not to make a system that goes against the laws of biology. For example if a white character(from England maybe) marries a black character(from Ethiopia maybe) the skin of the offspring should not be "middle eastern tan" but instead black or white. (Probably heterozygote black in the first generation since black is dominant but Im not sure).
 
Also, try not to make a system that goes against the laws of biology. For example if a white character(from England maybe) marries a black character(from Ethiopia maybe) the skin of the offspring should not be "middle eastern tan" but instead black or white. (Probably heterozygote black in the first generation since black is dominant but Im not sure).

Yeah, some lighter form of black would be great.
 
The background is very dark. I understand you are going for a middle ages feel, but I feel like the three witches are gonna come out and start telling people it's their destiny to be king of Scotland. Couldn't the background be a nice pleasant spring day? Or maybe a nice crisp winter day of you are old and the fiery pits of hell once you are dead.

But it is my destiny to be king of Scotland. (side note: MacBeth got a bad rap.)
 
As to the mixed-race question, would there have been enough Rus/Tatar intermingling back then to justify it?

Everything in the update looks great to me! And you've got to keep the shades in as an easter egg.
 
Bastards in CK1 did not have a mother. So if the same is true here, half the DNA will probably be random, thus maybe generating a child that looks very different from his/her siblings.

As long as half the DNA is random, I'm happy. I just never noticed that bastards in CK1 looked any different to the rest of the kiddie crop.
 
Also, try not to make a system that goes against the laws of biology. For example if a white character(from England maybe) marries a black character(from Ethiopia maybe) the skin of the offspring should not be "middle eastern tan" but instead black or white. (Probably heterozygote black in the first generation since black is dominant but Im not sure).

Uurgh, that's a really, really thorny problem which it's not worth getting into. For one thing, "black" Africans are not all the same colour. For another, the conclusion the mixed offspring are "black" is dangerously close to the "one drop" doctrine of racial purity. Mixed race children are usually sufficiently visibly distinct that people have coined words for them, so in all honesty, as an abstraction, some kind of half-tone is almost certainly the safest and simplest solution.
 
As long as half the DNA is random, I'm happy. I just never noticed that bastards in CK1 looked any different to the rest of the kiddie crop.

I never noticed it either ... but then again, I never really noticed any specific traits continuing through the family line. But I am pretty sure half the DNA was randomize for bastards.
 
Also, try not to make a system that goes against the laws of biology. For example if a white character(from England maybe) marries a black character(from Ethiopia maybe) the skin of the offspring should not be "middle eastern tan" but instead black or white. (Probably heterozygote black in the first generation since black is dominant but Im not sure).

I don't see how a color between black and white would go against biology (though it would be pretty strange if the child of black and white parents looked Middle Eastern). Have you ever seen a person who came from mixed parents? I've never known any who had the same skin tone as either parent.
 
Uurgh, that's a really, really thorny problem which it's not worth getting into. For one thing, "black" Africans are not all the same colour. For another, the conclusion the mixed offspring are "black" is dangerously close to the "one drop" doctrine of racial purity. Mixed race children are usually sufficiently visibly distinct that people have coined words for them, so in all honesty, as an abstraction, some kind of half-tone is almost certainly the safest and simplest solution.
I don't see how a color between black and white would go against biology (though it would be pretty strange if the child of black and white parents looked Middle Eastern). Have you ever seen a person who came from mixed parents? I've never known any who had the same skin tone as either parent.
Well people complain a lot about historical inaccuracy, so why should biological inaccuracy be allowed? Some genes are dominant, others are recessive. I dont demand a perfect system that has taken into account every single gene in the DNA just a system that has taken into account the obvious ones. For example if a blond scandinavian character from a dynasty of blond-haired people marries a black-haired Italian from a dynasty of black-haired people the offspring should always be heterozygote black-haired. If these children then marry blond-haired or heterozygote black-haired characters then there is a chance to get a blonde-haired offspring.
 
Well people complain a lot about historical inaccuracy, so why should biological inaccuracy be allowed? Some genes are dominant, others are recessive. I dont demand a perfect system that has taken into account every single gene in the DNA just a system that has taken into account the obvious ones. For example if a blond scandinavian character from a dynasty of blond-haired people marries a black-haired Italian from a dynasty of black-haired people the offspring should always be heterozygote black-haired. If these children then marry blond-haired or heterozygote black-haired characters then there is a chance to get a blonde-haired offspring.

Yeah. We need a real DNA system this time.
 
"Interracial marriage between Arab men and their non-Arab harem slave girls was common in the Arab World during the Arab slave trade, which lasted throughout the Middle Ages and early modern period. Most of these slaves came from places such as Sub-Saharan Africa (mainly Zanj) the Caucasus (mainly Circassians), Central Asia (mainly Tartars), and Central and Eastern Europe (mainly Slavs from Serbia - Saqaliba)."

"After the Umayyad conquest of Hispania in the early 8th century, the Islamic state of Al-Andalus was established in Iberia. Due to Islamic marital law allowing a Muslim male to marry Christian and Jewish females, it became common for Arab and Berber males from North Africa to intermarry with the local Germanic, Roman and Iberian females of Hispania. The offspring of such marriages were known as Muladi or Muwallad, an Arabic term still used in the modern Arab world to refer to people with Arab fathers and non-Arab mothers."

"As was the case in other regions conquered by Muslims, it was acceptable in Islamic marital law for a Muslim male to marry Christian and Jewish females in Sicily when under Islamic rule between the 10th and 11th centuries. In this case, most intermarriages were between Arab and Berber males from North Africa and the local Greek, Roman and Italian females of Sicily. Such intermarriages were particularly common in the Emirate of Sicily, where one writer visiting the place in the 970s expressed shock at how common it was in rural areas."
All from wikipedia (yes i know not the best source....)

So I think interracial marriages happened and we had mixed-race people, so why not good potraits of them? (But yeah only muslims admit this happening so... dont really know if this is too not relevant to the game)
 
Nice DD. ^^

The game sounds and looks pretty good so far.

I love the DNA system.
 
Because the audience for this historical game is particularly interested in history as such, and frankly doesn't much care about other kinds.

Lol what an argument is that? Why should they even try to improve the physics of, lets say battles then, if all you care about is how historical accurate characthers are?
 
Lol what an argument is that? Why should they even try to improve the physics of, lets say battles then, if all you care about is how historical accurate characthers are?

Mainly because there are finite development hours. If the game had an infinite budget for creation, you could do whatever you wanted. Given the limits of game development, they have to prioritize what to work on. The fact that the game will have ANY considerations for inheritance of appearance is good.

If the game was named "Biological Inheritance: Crusade of the Alleles," it might be a higher priority. ;)
 
Mainly because there are finite development hours. If the game had an infinite budget for creation, you could do whatever you wanted. Given the limits of game development, they have to prioritize what to work on. The fact that the game will have ANY considerations for inheritance of appearance is good.

If the game was named "Biological Inheritance: Crusade of the Alleles," it might be a higher priority. ;)

Yes I understand that, the devs must prioritize. But they should atleast care about the blond/black-haired effects in the first generation since that is the most obvious one, so that the offspring of blond and black will always give black-haired children regardless of gender.
 
Yes I understand that, the devs must prioritize. But they should atleast care about the blond/black-haired effects in the first generation since that is the most obvious one, so that the offspring of blond and black will always give black-haired children regardless of gender.

I don't really remember Biology lessons that well but isn't it possible for 2 black haired people to get a blond haired child (like 25% percent or something if the both have the Aa Aa alleles? (ie they inherited the recessive blond allel from one of the grandparents) Or is this only for eye color? This is probably off topic though so don't know if we should get into it :)
 
Yes I understand that, the devs must prioritize. But they should atleast care about the blond/black-haired effects in the first generation since that is the most obvious one, so that the offspring of blond and black will always give black-haired children regardless of gender.

So whenever you see hair-colour you deem impossible, just nod sagely.

There was infidelity, adoption, wigs, dyes, colour-blind portrait makers, or a miracle involved.

If lateral inheritance isn't in... then i don't see why they'd have to work out the genetic possibilities for comically large noses (the trait which would apparenlty be most in demand!).