How Crusader Kings 2 Makes People Out Of Opinions

This is The Mechanic, where Alex Wiltshire invites developers to discuss the inner workings of their games. This time, Crusader Kings 2 [official site].

Meet Domnall, Earl of Osraige. He’s a pretty affable guy. He’s friends with his neighbouring rulers, and all seems peaceful. But he’s also ambitious and a just little crazy, and he’s about to make a big mess of the Emerald Isle.

Domnall is one of the hundreds of characters across Europe, the Middle East and North Africa that Crusader Kings 2 is simulating here in the year 1066. Whether the player is interacting with them or not, they’ll be vying with each other, allying, marrying, dying, giving birth, and generally doing all of the things that your ruler can do. Crusader Kings 2 is a game all about people. It’s about marriages and dependencies, accordances and kinship. And at the heart of how it models all these dense and messy human complexities is a single value that governs the way its little computer aristocrats behave:

THE MECHANIC: Opinions

To the computer, Domnall is long list of opinions: those he has of every other ruler in the game, and those every other ruler has of him. Each is recorded on a scale that goes from boiling hatred at –100 to dumbstruck love at 100, and at any time each might change according to how he acts and how he changes over the course of his life. And they affect everything that he decides to do to other rulers, and what they’ll do to him. This simple idea, that characters’ opinions of each other can differ and that they inform what they’ll do to each other, is a large part of how Crusader Kings 2’s medieval world feels so analogue, so human, despite comprising simply of numbers.

Now, our Domnall really likes three of his neighbours. His opinion of all of them is over 50. His opinion of the Earl Diarmait of Laigin is 25, a lower value but still pretty friendly. In normal circumstances he wouldn’t consider attacking him, since the standard threshold for an AI to consider attacking another ruler of the same religion and culture is an opinion below 20.

But Crusader Kings 2 is never this simple, and opinion is not the only characteristic that makes up Domnall. He also has a set of several traits, just like every other character. Traits cover such positive and negative peculiarities as Flamboyant Schemer, which grants bonuses to a ruler’s ability to scheme and set plots, and Leper, which makes a ruler more or less infertile and reduces their ability to conduct diplomacy.

All these characteristics are visible to the player, but every computer-controlled character also has another set of five hidden personality values. They’re the result of developer Paradox imagining what might influence the behaviour of medieval people: there’s zeal, the extent to which the ruler hates heretics and members of other religions. Honour is about sticking to deals. Greed affects a ruler’s tendency to try to accrue money. Aggression is a ruler’s propensity for warmongering and realising its ambitions, and rationality is how straightforward the ruler behaves.

Domnall has the Ambitious trait, which gives his internal aggression score +40, and the Arbitrary trait, which gives his rationality score –20. These two values are critical for his future. They upend Domnall’s friendly attitude, because the way the game works is to add half of each to the threshold for his willingness to go to war with people. This means that rather than having an opinion threshold of attacking others when his opinion on them is under 20, he’ll happily attack anyone with an opinion he holds of under 50.

Perhaps the Earl Diarmait of Laigin detected a certain drive burning in Domnall’s eye when they went out drinking one time. If he did, perhaps he thought that since their forces are evenly matched, Domnall wouldn’t actually act on it. Too bad for Diarmait, he didn’t factor in Domnall’s irrationality. Most rulers will only go to war against forces that they overpower by 20%. But Domnall’s low rationality tally means he has no such qualms, and now he presses for a Casus Belli: a justification for going to war.

This kind of scenario is being resolved by Crusader Kings 2 all the time across the entire map, whether you’re there to notice (perhaps you’re playing as Diarmait?) or not. Its AI isn’t omniscient, though – while the game is played in realtime, AI actions are taken in pseudo realtime to keep the speed of the game smooth. The game determines which day each character in the game will get its processing time, adding an element of chance, spreading out the load so it will work on lower spec computers.

When it’s time to process a ruler, the game first looks at its long-term strategic goals, and then various sub-systems begin managing different areas of its affairs in order to achieve them. One looks at the council and considers whether there are better candidates available. One commands military matters, setting up plans for armies and executing them. Others evaluate diplomatic actions with other characters and make choices for special events that might affect the ruler, applying its personality values to determine what happens. Some systems don’t fire every time – they might instead only run every year, or when the situation that relates to them changes.

One of those is the system that determines the ruler’s strategic goals, something that’s only invoked when its personality changes – characters sometimes receive new traits as they grow older – or if they marry, their liege is replaced, or someone nearby dies. They assemble a list of provinces they wish to take, characters they’d like to have assassinated, decide to get an heir, develop the size of their army: projects that tend to take months of planning. They have to constantly check these goals against their opinions, though; just as Domnall did, they will only aim to take provinces that their opinion thresholds will support.

For a ruler without an heir, other factors set in. If a woman, age is important because her fertility won’t last. Culture, religion and government are important, too, affecting whether the ruler can have concubines or multiple spouses. Perhaps the ruler is Christian and married, in which case they may ask the pope for a divorce.

Something very interesting about Crusader Kings 2, though, is that despite the apparent complexity of its model of human behaviour, its AI is not as deep as that in strategy stablemate Europa Universalis IV, which uses the same engine. “CK in many ways has the simplest AI of all of our games,” game director Henrik Fåhraeus tells me. As with any game AI, Crusader Kings 2 is routinely criticised for having its characters make apparently stupid or bizarre decisions that tend to lose them dynasties or simply appear ridiculous. But smartness isn’t really the point. “It’s a very conscious decision on our part to prioritise acting in accordance with personality and opinions rather than to be rational and just political about everything,” says Fåhraeus. Look back at history, and decisions are clearly made by actual people. “It should be personal, basically, it’s a game about people and their flaws.”

Scripts are a whole other side of how the game works. Written by Fåhraeus and his team, they pop up and tell stories, giving players and game characters choices to act on as they progress. Some are associated with specific and significant historical figures, such as Charlemagne, recounting his life and events of the period, but as Fåhraeus says, “I think that was probably not a very good decision on our part, because the early game doesn’t last for that long.” A game of Crusader Kings 2 tends to last hundreds of years, and all that special content is soon left in the past, so now the plan is to note and develop interesting archetypical relationships between people, such as that between Charlemagne and his controlling mother, and making procedural stories based on them available all the time.

Another thing Fåhraeus would like to develop is the game’s ability to build stories. He’s been exploring the idea of building a system that can detect the natural emergence of a story in the game (though he admits it’s very hard to do) and guiding emergence, trying to make it happen in a more directed and focused way, a little like a game master. As a first step on that he’s working on a system that maintains special relationships between the player and other characters, such as a nemesis that keeps coming back. “He shouldn’t be immune to death, but the random numbers should be in his favour, because it keeps him around and giving him comebacks and you will feel as a player, ‘Why won’t this guy ever die?!’ That’s what I’m after.” Similarly there might be mentor figures or comic sidekicks, attempting to make some of the hundreds of characters around you stand out and stick around.

Something else he’s working on is breaking down archetypal stories into their essential component pieces in such a way that should they be scattered in the game you’ll notice their pattern. “Like vengeance: how can we break that down into pieces? If we manage to do this correctly at least, you will get a picture when you pour your pieces on the floor. That’s what we’re hoping,” he says.

These are fine ideals which will only make Crusader Kings 2 richer, but all of it is built on the underlying network of relationships that span the gameworld. Opinion is a single figure, making it simple enough for the computer to use, but you can also imagine so much based on the behaviours around that figure – jealousy, admiration, wariness, love, hate, disinterest – because you’re able to colour it with context, personality traits, local and international politics. Domnall, our Irish earl, seems hell-bent on destroying his relationships with his friends. His ambition seems to have made him self-destructive, but maybe this is the start of a powerful dynasty? You can’t help but be curious as to what this bunch of numbers will do next.

From this site

26 Comments

  1. Superpat says:

    I love the systems at play in ck2, but the one flaw I’ve noticed in the opinion system is that fear is poorly handled.. You’d think there was a tyrant modifier that makes characters much more carefull about pissing you off.

  2. Baines says:

    “He shouldn’t be immune to death, but the random numbers should be in his favour, because it keeps him around and giving him comebacks and you will feel as a player, ‘Why won.t this guy ever die?!’ That’s what I’m after.”

    I’m not sure how I feel about that. Emergent stuff like that is special because it is emergent. It is chance and happenstance and the user applying meaning where said meaning might not apply.

    When such elements are directly coded into the game, it isn’t anything special, they are just another mechanic that shows up. That guy (or gal) is no longer “special” in the same way, they are just your designated nemesis.

    • Shinard says:

      You say that, but I think there’s a sweet space between the two extremes. Shadow of Mordor, for all of its flaws, absolutely nailed it for me. Yes, the orc was singled out and given special powers, but the reason he became my nemesis was because of my interactions with him. The battles, the deaths, the last minute getaways.

      There’s this one moment I remember the most from all of my time playing it. I’d been killed by this guy twice already (once when I dived in on another captain and didn’t notice he was there, allowing him an easy kill, once when I hunted him down for revenge and greatly underestimated him). It was night-time, and a storm was raging. I was stalking him from the top of this half-finished ruin, and just as I was about to attack, a lightning bolt split the sky. He looked up, saw me and looked me dead in the eyes, to yell “Back for more, are you? I’ll enjoy watching you die all over again.”.

      I mean, damn, that’s good emergent gameplay, right there. I know it was a pre-selected line, I know he killed me when other orcs weren’t a challenge because he had special powers, I know his name was Douche (seriously). But that moment, and our entire rivalry, that was special to me, more memorable than most other games I’ve played. He has a place in my heart, Dush Frog-Blood.

      • Premium User Badge

        Captain Narol says:

        That nemesis system in Shadow of Mordor was indeed a flash of genius, I really hope many games will get some inspiration from it !

        As you said, emerging gameplay at its best !

  3. FrenchTart says:

    Disappointed that my helpful comment was removed… :)

  4. JazzTap says:

    Anyone interested in the raw emergent dynamics of large agentsets like this may wish to investigate NetLogo.

    Admittedly, for only 100s of agents, any language with collections and decently robust output will do.

    Cryptic statements aside, I remain in awe of how simple dynamics may yield rich behavior, in the manner of simple brushstrokes yielding lovely images. My thanks for the reminder.

    (I’ve fallen behind on the DLC again and not actually played CK2 in years. The spot of vicarious experience is likewise welcome.)

  5. Musket Squid says:

    Bought this game forever ago…. oh, how I wish I knew how to play it. Youtube has failed me on this one.

    • napoleonic says:

      Start as a Count in Ireland in 1066. It is basically easy mode. There is no one nearby who is going to come and crush you within the first twenty years.

      Then set intermediate goals. Decide you want to become Duke of your local Duchy. Then Get another Dukedom. Then become King of Ireland. Then take over Wales. And Scotland. And the rest of Britannia … and now you are the Emperor Domhnall and you are ready to play with the big boys.

      • n0m0n says:

        Another way to get into the game is to play as a vassal (duke or count) under a larger, more powerful liege (king or emperor). As long as you don’t upset your liege you can fabricate on some of his/her other minor vassals and consolidate your position while relatively well protected.

        The benefit of this approach is that when you finally feel ready to gain independence (or overthrow your liege) is that you may have a slightly better understanding of what your vassals may be up to. Starting out as independent it is a bit trickier to get a feeling for how to keep your vassals in check once you start having a few of them. Dealing with mayor uprisings every few years can start getting tedious and is mostly avoidable if you learn how to build a stable realm.

    • Von Uber says:

      It’s actually one of the simpler paradox games to play. If you start small, say as a count (Ireland is usually a favourite) then it’s fairly easy to pick up.
      You can’t go wrong by just playing and see what happens to be honest.

    • Premium User Badge

      Captain Narol says:

      Don’t let the game intimidate you, it’s not that difficult…

      Pick a character (preferably a king, in my opinion) and just dive in… Things will happens, do what you can and learn from your mistakes. Losing is fun in CKII and the best way to learn !

    • Premium User Badge

      Grizzly says:

      There’s really only two things you have to do: Hold on to a stretch of land and have a relative that inherits that land. That’s all there is to it. There’s a lot of more things that you can do, that can happen to you, etc. but even if you get utterly crushed and subjegated you still have lots of options to manouvre politically. It’s worth playing it just to see what happens, really.

    • wodin says:

      there isn’t a right or wrong way to play..you set your own goals..it’s all down to you and I think some people have trouble with this aspect..you just either really try and roleplay your character looking at his traits etc and then just see what happens for abit..then if you feel more confident you can start to have more input until it gets to you plotting for the long term..the only really major No1 thing you HAVE to try and do is have an heir..

      Edit: WHoops should have read the replies first..yes what they all say:)

    • DodgyG33za says:

      I had a day with nothing planned today, and after reading this article fired up a youtube “let’s play” by DasTactic. He can be pretty slow, but by part 8 I had enough to get right into it.

      Now 4 hours of tuts is a long time to invest in learning game mechanics. But this game has been in my collection since 2012 and I am a history buff, so it was begging to happen. I still don’t know half what is going on, but I am loving what I do know, and winging the rest. One day I hope to be knowledgeable enough to allow the Byzantines to flourish rather than wither.

  6. Premium User Badge

    Captain Narol says:

    My favorite game ever…

    I take even more pleasure watching the events of the world happening outside my kingdom than from expanding it.

    It’s a fascinating breathing world that Paradox gave us, great job guys !

  7. Musket Squid says:

    Thanks for all the replies guy. Have had a hard time wrapping my head around what is going on in the game and I play DF a lot. I know it’s not as hard as DF (maybe) just might be that I have no clue where to start. I try again with a lil of all the advice given, thanks again

    • EvilMonkeyPL says:

      You might also want to check out Arumba on yt. He’s done an Ireland newbie tutorial series. Might be a bit outdated at this point since quite a few DLCs came out overhauling many systems and changing many things but it was what I used to get a grip on the game.

      Edit: actually, forget Arumba’s LP, it is so out of date now it would probably be more confusing than anything else.

  8. xyzzy frobozz says:

    The -100 to 100+ relationship scale is actually one of the features I like least about the game.

    It reduces relationships to a rather sterile number, which can then be easily manipulated once you know how various effects work.

    In my opinion, a better and more immersive system would be to have a scale that runs say Hate-emnity-hostile-dislike-indifferent-like-friendly-friend.

    The underlying system could remain the same, but it would make decisions more difficult and “lifelike” if you don’t know exactly where someone sits, even if you have a guide.

    As it stands, I know that donating money to someone will take them from -21 to -1. Still not enough to have all vassals have a lositive opinion of me. So I don’t take the decision and pursue other strategies.

    A less arbitrary system would introduce some ambiguity into the system, thereby increasing immersion and difficulty.

    You could even blur the borders of these relationships with personality modifiers.

    • Premium User Badge

      Captain Narol says:

      Good point, I totally agreed. The mechanism is great, but some blur would make it even more enjoyable as you wouldn’t know exactly the numbers and would have to take risks.

    • EvilMonkeyPL says:

      I really like the idea. Should be relatively easy to mod in.

      • RosyGlow says:

        This. Yes. Please. If I could mod I would.
        Anybody up for it?

        • Blackfish says:

          Not quite what you’re looking for, but I remember there was a mod a while back that hides the stat values of all characters. It does make you rely more on the traits of a character to get a feel for how good they are at something. But because the base stats which the traits modify are also extremely variable, it becomes somewhat unpredictable.

          It’s an interesting experience but overall I think I still prefer the transparency.

  9. Shinard says:

    …brb, off to play CK2 again.

  10. Misha says:

    Curse you, RPS!

    Just when I think, for the umpteenth time, that I’ve finally managed to break free of my CK2 addiction, you write another article about it and I’m going right off the deep end again. ;-)

  11. chromedbustop says:

    I really wish this game had a proper journal for recording your legacy. I know they have a family tree and added a chronicle some time ago, but both are rather vague and cumbersome.

    It’s still tricky to remember who did what and when, and I feel like that could easily be solved by giving us a simple interface to write our own entries. This is something I’ve wanted from Paradox for awhile. That, and the ability to name things like wars or mark particular battles.

    • Blackfish says:

      I like the in-game text editor idea. I already use a notebook to note down important events and trends, it would be cool to have that be something integrated in-game.

      Paradox has tried the chronicle thing a bunch of times (I think first in EU3?), and it never works that well.

Comment on this story

XHTML: Allowed code: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>