More than a variable, actually
A typical game variable might simply return a number, a skill or item name, or another stored value. Kenshi’s variables are named word swaps, and can either be a simple number or one of several pieces of text depending on one or more in-game conditions.
This makes them considerably more interesting (and problematic) from a localization perspective.
From where I’m sitting, here’s the set of gotchas Kenshi has in store for us:
- NPC gender is mostly random, and plurality is also variable;
- Ditto for the player character;
- Wordswaps can return nouns of any gender, and those nouns are often the subject or object of a sentence;
- In Polish, the forms surrounding a noun may depend on its gender, number, and grammatical case;
- And the dialogue system has no concept of grammatical gender, case, or agreement.
From a conventional localisation-production standpoint, the sensible thing to do is to drop wordswaps from most lines and replace them with generic, predictable descriptions. Any wordswaps we do keep, we restrict to a single, predictable grammatical context.
In Part 1, we did just that, and saw how localisation compromises turned a reactive line into a static phrase.
“Just translating it” cost us its specific weapon, its insult, and even its theft.
Time to bring those details back.
Making character writing reactive in Polish
Thankfully, translators can define their own wordswaps, which means we can create a wordswap that reacts to the speaker’s gender or the target’s gender. But creating a wordswap for every word we need to mutate in this way would get unwieldy very quickly.
But we don’t have to swap entire words. Many words have a “main” bit (the stem), with other bits attaching to it from the front (prefixes) and back (suffixes), modifying their meaning. How that happens is literally a university-level subject, and so we won’t be getting into that here.
Instead, let’s give our thief back the narrative bits we hacked off and unmake the twisted bonsai of Polish we’d forced to grow into the shape of English grammar:
Fool! I stole your /WEAPON/!
A man who stole something would say I stole|ukradłem♂️, while a woman would say I stole|ukradłam♀️. Let’s separate the part that doesn’t change from the endings that modify the meaning of the word:
🇵🇱 · ♂️ speaker
🇵🇱 · ♀️ speaker
Those two small bits will become our morphological wordswap, or morphswap for short. We will attach it to any suitable base that needs to react to a person, and it will return either em or am depending on their gender designation.
Building a morphswap
Labels such as /WEAPON/ or /BATTLECRY/ are pretty self-explanatory. Labelling a morphological construct is a bit trickier.
In our example, the form of the localized word depends on the speaker (I stole), so let’s mark it as a first-person construct with the number 1.
Since the wordswap consists of suffixes em and am, let’s expose them in the label, so that the word remains somewhat readable in the editor.
For clarity, let’s use some sort of separator between components. A pipe character | would make the most sense, but the game’s parser disagrees, so we settle on an exclamation mark !.
This gives us /1!em!am/ – first person, masculine form em, feminine form am.
Because inflection often follows patterns, we can reuse the morphswap with other verbs in the past tense — I repaired, I ran, I fought, and so on:
🇬🇧
- I repaired
- I ran
- I fought
🇵🇱
- Naprawił
/1!em!am/ - Pobiegł
/1!em!am/ - Walczył
/1!em!am/
The label is designed to show the purpose of the wordswap and preview the final forms of resolved words at a glance. I like to think it remains usable within the constraints of the system.
The label is also reusable. For second-person morphswaps, we start with 2. For third-person, we use 3.
Plural morphswaps are a separate concept due to in-game logic, and are denoted as 11 and 22.
Morphswaps in practice
We can now restore the gender- and number-dependent parts of the sentence. If we address just the player character, we can have the insult and possessive stay singular. If we want to address their group, we can use swaps that respond to the target’s number:
🇵🇱 · Singular target
/2!cze!ia/! Ukradł/1!em!am/ twój oręż!🇵🇱 · Plural-aware target
/22!cze!cy/! Ukradł/1!em!am/ /22!twój!wasz/ oręż!If we want the thieves to speak as a group, the verb needs a plural-aware speaker form:
🇵🇱 · One speaker, plural-aware target
/22!cze!cy/! Ukradł/1!em!am/ /22!twój!wasz/ oręż!🇵🇱 · Plural-aware speaker and target
/22!cze!cy/! Ukrad/11!łem!liśmy/ /22!twój!wasz/ oręż!Forcing the system to accept Polish grammar
That leaves the /WEAPON/, whose Polish form depends on the grammatical context.
Morphswaps work because the engine understands game state — we can “see” gender and number of the line’s participants.
Grammatical case, on the other hand, isn’t a property of the game world; it’s a property of the sentence I’ve written.
In English, this is not a concern. In the dialogue corpus, a /WEAPON/ is referred to in multiple different contexts, but a crossbow always stays a crossbow, regardless of what you’re doing with it.
In Polish, characters might be talking about the weapon, your weapon, that weapon, or doing something with the weapon. The /WEAPON/ may need to become crossbow|kuszę♀️, crossbow|kuszy♀️, or crossbow|kuszą♀️ instead of the base form crossbow|kusza♀️.
Worse still, to properly translate your /WEAPON/, the possessive your must be in sync with the gender, number, and case of the noun.
🇬🇧 · Possessive phrases
🇵🇱 · Accusative phrases
🇬🇧 · Possessive phrases
🇵🇱 · Accusative phrases
The dialogue engine is not equipped to deal with that. Developers have their hands full as it is. Let’s stay in our lane and work with what we have.
Building a caseswap
In Part 1, we saw how the possessive your has to agree grammatically with nouns returned by /WEAPON/.
The least complicated solution to this is to supply the appropriate grammatical accoutrements with the /WEAPON/ wordswap. But if we put them into the base /WEAPON/, the swap will break it in other contexts.
We take the existing wordswap and create a clone. The new name should make clear what the replacement does. Let’s name it /WEAPON-POSSESSIVE/.
We force the agreement by inserting the variable part of the possessive pronoun into the weapon wordswap. Because the weapon is the direct object of I stole, it also has to be in the accusative: /WEAPON-POSSESSIVE-ACC/.
Instead of sword|miecz♂️, crossbow|kusza♀️, and blade|ostrze, we’ll make this wordswap return ój miecz, oją kuszę, and oje ostrze — incomplete phrase fragments designed to pair with the possessive stems tw-, m-, and sw- — for your, my, and one's own, respectively.
Which means we can finally restore the original line’s specific weapon:
🇬🇧 · Original
/WEAPON/!🇵🇱 · Morphswaps and caseswap
/2!cze!ia/! Ukradł/1!em!am/ tw/WEAPON-POSSESSIVE-ACC/!Assuming it’s Mrs. Thief accosting a lone masculine player character, we get:
🇬🇧 · Original
🇵🇱 · Morphswaps and caseswap
The base /WEAPON/ targets the player character’s weapon, so the player character can then respond using the same wordswap:
🇬🇧 · Player's reply pattern
/WEAPON/!🇵🇱 · Player's reply pattern
/WEAPON-POSSESSIVE-ACC/!🇬🇧 · Original
🇵🇱 · Morphswaps and caseswap
What’s in a name?
A caseswap is therefore a context-specific clone of the original wordswap, but modified for a particular grammatical purpose. Unlike morphswaps, caseswaps are meant to assemble noun phrases instead of single words. But just like morphswaps, they have a structured, albeit more complex naming scheme, many elements of which are optional.
The full form is NN!NAME-CONTEXT-CASE. For the curious, here’s how it unpacks:
Read the full caseswap naming convention
NN!- An optional mark of plurality. This accommodates source forms such as
/WEAPON//S/, which together producesword/swords. From our perspective, every noun is amouse: plurality can change the word itself, so when an English writer appends/S/to a wordswap, I often end up spawning a corresponding plural caseswap. NAME- The name of the original wordswap, from which the caseswap is cloned.
CONTEXT- Describes the contextual function of the wordswap in one of the three categories:
POSSESSIVE- accommodates possessive constructions (yours, mine) - as we’ve seen.DESCRIPTIVE- accommodates adjectives (fancy sword, nice crossbow) - e.g.:fikuśn/WEAPON-DESCRIPTIVE-NOM/:fikuśny miecz,fikuśna kuszaINDICATIVE- accommodates pointing at something (that sword, this crossbow) - e.g.:t/WEAPON-INDICATIVE-NOM/:ten miecz,ta kusza
CASE- Specifies one of 7 Polish grammatical cases.
Localisation engineering in service of creative writing
With those two systems, we’ve done away with all four compromises of the original example. Both effectively solve complex localization problems throughout the script.
But once they existed, I also started finding less utilitarian uses for them — small ways to give the Polish more character. Most of those stories can wait for another time.
Creative writing with caseswaps
For now, we’ll make do with one theoretical example. The caseswap system is intended to improve the stylistic breadth of localization writing. But it also unlocks dialectal options that would otherwise have been harder to implement. Say /WEAPON/ returns stick|kij♂️. A villager wants you to hand them a weapon:
Gimme dat stick!
A standard Polish line conveys the request, but loses the villager’s voice. Changing the verb gets closer to Gimme dat:
🇵🇱 · Standard register
/WEAPON/! → Podaj mi kij!🇵🇱 · Mixed register
/WEAPON/! → Dej kij!The colloquial verb and standard noun form still clash. A genitive-shaped form makes the whole line sound like this villager:
🇵🇱 · Mixed register
/WEAPON/! → Dej kij!🇵🇱 · Colloquial register
/WEAPON-GEN/! → Dej kija!That single letter immediately creates atmosphere.
Practicing restraint
The predictable naming schemes make the system fairly painless to use while writing. If a swap doesn’t exist yet, I can still type out its label — the label itself tells me what it needs to do — and keep going. I’ll build the actual wordswap later.
But overuse it, and you risk following the English sentence structures to a tee. You may end up with lines that are grammatically correct and reactive but still read like translations. If you write for effect, sometimes a compromise and a rewrite are the better options.
Which is why I treat every swap like a tool in a very cramped kitchen. You know, when your kitchen drawers are overflowing with crap, you have to really ask yourself — do I really need that melon baller? Same principle applies here.
If a sentence can be rewritten naturally and elegantly without spawning another grammatical wordswap, I’m doing that instead.
But I’m no longer doing this because I have to.
Licking our wounds
For now, we’ve solved the linguistic problem: the dialogue can remain reactive without forcing Polish into the grammatical shape of English. But in doing so, we’ve created two more:
- How do you maintain a system like this?
- How do you QA a line that can resolve into hundreds or thousands of different utterances?
We’ll sort these out in Part 3.
