Adversary System: An Introduction

Half of any RPG experience takes place inside the player’s head. All I do is plant the seeds and leave you to figure out the rest.

The Adversary system is one that allows for recurring characters to have deep personalities and, crucially, memory. It transforms generic encounters to memorable events by using multiple layers of abstraction, a bunch of ‘event tags’, and a lot of cleverly-written dialogue.

Let’s get into the nitty-gritty.

Above you see a colourful array of characters. These are the unique NPCs who represent the command structure of each of Kenshi’s major factions. There are a lot of them, sure – that’s because they are grouped into ‘line-ups‘; that is, pre-selected combinations of NPCs who are prevalent characters in each faction. They lead their forces on the battlefield, command sieges, are semi-permanent roaming characters in the game world.

In total, there are 54 of these unique NPCs. In practice, 11 of them are present in any given playthrough. It would be possible, but far, far too complicated to truly randomise the selection of these characters, so instead the line-ups are predetermined. The selection of a line-up is one of multiple factors that are randomised for the overall ‘seed’ whenever you start a new game. Grouping them in this fashion allows me not only to save a mountain of work, but also to balance the line-ups against each other. You won’t end up in a playthrough where every general is a bloodthirsty lunatic.

These characters determine tactics on the battlefield, grand strategy, and special unit types available to a faction. The inspiration for special units came from the RTS genre, in which you’ve frequently got different types of squad or division available based on nation, faction, whatever. Here’s an example unit, the Samurai Yodoka, an elite commando type for the United Cities:

Each faction has 4 of these special units, and which are present (and which are not) is dependent on the general line-up. For instance, the United Cities may have access to mercenary armies; the Holy Nation to massive conscript forces; the Shek to suicidal berserker units who patrol alone and cause havoc wherever they roam. Yet all depends on the line-up that has been selected by a roll of the die.

Each general has a personality tag. These tags are present, but largely unused, in the base game. They allow for the random (or purposeful) assignment of a personality to any given NPC, which in turn allows for dialogue and AI decision-making to vary based on a character’s tag. For the generals, the most common are ‘brave’, ‘honourable’, ‘smart’, ‘traitorous’, and ‘maniacal’. The personalities influence their dialogue enormously, their situational decision-making, and more broadly, their strategic decisions. A brave general will never run from a fight and will act recklessly in deploying their forces. A traitorous general will abandon their men and run at the first sign of trouble.

At the head of each faction’s command structure is the top dog. These NPCs live in the capital to defend it (Blister Hill, Admag, and Heft) and can be visited there, assuming they’re not on patrol or out campaigning. On top of everything else, these characters have a broader effect on gameplay – the overall strategy of a faction is based heavily on their personality. If it’s a brave character, the faction will act aggressively. If they’re smart, they’ll prefer to defend and lure their enemies onto their home turf. And if they’re maniacal, they’ll focus on torching farms to the ground and slaughtering the innocent.

“Our enemies to the west are relentless. There is dissent among the peasantry and the trade routes are as dangerous as ever. And now, our power structure is fractured. Longen commits only the bare minimum to the war effort and won’t sit through half a war council without drinking himself into a stupor. If ever a man had an obsession, it was Longen with Tinfist. And bloodrum… vile piddle.”

General Tycho, United Cities, cf. ‘Our Fractured Leadership’

How do your interactions with them look in practice?

That depends on you. How you play, what choices you make. Each general has a collection of tags that are saved, permanently, that allow them to develop a relationship with you over time. Since these tags use world states, they can be cross-referenced between characters – so betray one and the others may well know about it.

Some tags are highly specific, such as ‘DEF’ (defeated player), ‘FFR’ (friendly, freed by player) and ‘KID’ (kidnapped). These describe a specific event. Others are far more generic, such as ‘ANG’ (angry) or ‘ALLY’. There is a crucial difference in the tag approach to more traditional alternatives. Consider for a moment the NPC relation system from Mount & Blade:

Your relationship with any given NPC is defined as a value that ranges from -100 to +100, 0 being neutral. While this allows for emergent relationships with any character, it’s ultimately a flat, boring, one-dimensional approach. You could go from blind hatred to sworn ally and nobody will care. All that matters is your present relationship, a number.


With tags, and some clever stuff behind-the-scenes (not all tags are activated by a single event), I can have NPCs who understand in greater detail the nature of their relationship with the player. Take, for instance, the ‘betrayed’ tag. This is only activated if you betray a character after winning their trust. Now they understand that, not only do they not like you, but that they once did. You’ve betrayed them and they take that personally.

“[…] The red desert is no longer our own, cut into pieces and appropriated by deserters, renegades and exiles. The Hub refuses to die, a bastion for craven Okranite rejects, yet little more than a pile of sun-baked rubble. Our two remaining cities rupture at the seams as they fall into ruin, to be reclaimed by the shifting sands in the generations to come. And as I gaze upon the dilapidated Stenn panorama, I cannot help but wonder how we came to fall into such a state of neglect and destitution.”

Wulan Battleborn, Shek Kingdom, cf. ‘The Crumbling Fort’

This allows me to write interactions and dialogue in such a way that makes these characters feel truly intelligent. They remember your interactions, hear about what you’ve been up to elsewhere, react naturally as events unfold. Their reactions aren’t based on an arbitrary number system, but on specific, important events that they remember for all time.

So, how about a look at the dialogue itself?

Reduced to its inner workings it’s a clever juxtaposition of event reactions, their associated tags, random chance, and enormous ‘word-swaps‘, many of which are cleverly-written to allows me to string them together. For those of you who are unaware, a word-swap is a dialogue trick used by Kenshi to allow for extensive vocabularies. By and large, the vanilla game uses them for minor variations in dialogue – yet their potential is massive.

Here is an example wordswap that plays when you betray a general.

On the right is the ‘base’ event. However, if the player has a substantial ‘good’ relationship with this character, it can call the dialogue event on the right. Which in turn constructs more dialogue based on previous interactions.

This is a reaction to an event such as an out-of-the-blue attack, or assassination attempt. Word-swaps can be nested, enabling me to create complex structures with shifting contexts. The ‘generaleventgood‘ word-swap looks up a series of previous events and strings together a sentence that sums up the player’s history with that character. ‘You would betray me, even after busting me out of jail and saving my life?!’

This means that these characters can monologue on the battlefield. If a general suddenly finds themselves on the other side of the conflict with you; once sworn allies, now fated to clash; then you can bet they’ll know about it and pause to call you out. ‘It seems that fate has turned against us, <yourname>… A shame, for I had once considered you my greatest champion.’

Generaladversarypt2 can change the context of the first sentence.

I mentioned in passing that these world states are cross-referenced. Which, in turn, means that your relationship with one character can influence that of another. If you’re a hated enemy to one, then another will treat you with suspicion or disdain. If you’ve done something truly dastardly, such as throwing somebody into a skin peeler?

Well, you’ll just have to wait ‘n’ see…

“[…] Our greatest enemy is the infertile land beneath our feet. 

Land so barren, so uncooperative in its cultivation, that our way of life necessitates misery, bondage, cruel labour that we prop ourselves up on and call progress. Our enemy, the true nemesis, is the sand we walk on and the sadist sun that bears down on us from above.”

General Stormclaw, United Cities, cf. ‘The Demon in the Dunescape’

There’s a lot more detail to be unpacked and I’ve barely scratched the surface.

For example, every one of these characters has two underlings who use a scaled-down iteration of the same system owing to the fact that their longevity is… well, rather short.

Another aspect I’ll touch on is that each general has their own, unique weapon and will react if you steal it and are still using it later on. They probably won’t take too kindly to your nimble fingers, either.

Huh, would you look at that. A new weapon manufacturer. It’s almost written as though you could… visit them… and order a custom weapon… Nah, that’s just hearsay. Right?!

For now, that’s all. I hope to have whetted your appetite and sparked your imagination. Kenshi’s dialogue system has enormous potential, and I fully-intend to unleash it. Stay tuned for more details on the finer elements of this and other systems.

“[…] Temptation curdles and corrupts the minds of unoccupied soldiers, bored to tears with mindless duties. Temptation hides in every corner, watches voicelessly from every shadow, waits patiently for a moment of absent-mindedness wherein one might succumb to base desires. It is always there, lurking. Biding its time. Temptation is her weapon. Temptation perverts idle hearts and debases the minds of men. May Okran deliver us from such an insidious opponent.”

High Imperator Valos, The Holy Nation, cf. ‘The Curse of Temptation’

2 thoughts on “Adversary System: An Introduction

  1. Hi there! This post could not be written any better! Reading through this post reminds me of my previous roommate! He always kept preaching about this. I’ll send this article to him. Pretty sure he’ll have a good read. I appreciate you for sharing!


  2. This is really great I am so excited about future updates for this mod. The personal interactions with the npcs and the uniqueness of each general is just amazing. And the unique weapons and actual living manufacturer, mwah, chef’s kiss.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s