# RPG Name Generation

Role-playing and adventure games often require a considerably high number of names to describe characters, locations, items, events, abilities, etc.

Humans are very awful generators of randomness, especially upon request. Writers and designers can come up with a handful of well devised names for important identifiers, but having a human generate 100 character names will likely result in many duplicates or boring derivatives.

There are a few approaches to this problem:

• Pattern substitution of a data set with explicit rule-based probability.
• Using Markov chains to synthesize new results from a data set.
• Training a neural network to synthesize new results from a data set.

## Data Sets

All methods require some form of data set or “corpus”, and structured in a manner suitable to the algorithms using it - such as organization based on syllable count, commonality of a certain name, class and hierarchy rules, etc.

The data set needs to be large enough to produce a wide variety of new names, otherwise the results will have duplication and predicability. In the case of a neural network, this would result in underfitting, where the network cannot model the training data, nor synthesize new results. On the other hand, if a data set is too large then overfitting will occur, and the neural network will contain more parameters than can be justified by the data. Finding the right balance is important here.

For my experiments I was sourcing from a variety of locations - especially historical, religious, scientific, and fantastical references.

Some useful sources for names:

• Theological Angels
• Theological Demons
• Egyptian Deities
• Roman Emperors
• Ancient Greek Cities
• Planets and Satellites
• Iron Age States
• Food, Animals, Places, Monsters, etc.

An excellent source of names is to find a compiled “onomasticon”, which is a collection of names or places, usually with etymologies. The best onomasticon I have encountered is Kate Monk’s Onomastikon.

Another great source is Gary Gygax’s Extraordinary Book of Names.

Additionally, there are plenty of pen and paper resources out there which can be useful (just make sure to respect copyright!).

Special thanks to Alexandre Giraud - some of the patterns and Markov training data used in my examples are from his Heroku app.

Data Sets:

## Method: Pattern Substitution

### Basic Replacement

For the pattern substitution method, essentially we replace tokens within a pre-determined pattern or “template”, and the values for the replaced tokens must follow a set of rules and probabilities.

Military Unit:

patterns = [
"<commander>'s <group>",
"<description> <group>",
"<description> <description> <group>",
"<group> of the <location>",
]


Tavern:

patterns = [
"<noun> & <noun>",
"<noun> & <noun> <title>",
]


Mystic Order:

patterns = [
"<group> of the <entity>",
"<group> of the <description> <entity>",
"<description> <group> of the <description> <entity>",
"<description> <group>",
]


Thieves & Assassins:

patterns = [
"<role> of <goal>",
"<description> <group>",
]


As an example, lets generate a tavern name. To start off, we randomly choose a pattern for a tavern name:

/// Convenience macro that can randomly choose an entry in a vector
macro_rules! random_choice {
($self_:ident,$a:ident) => {
if $self_.$a.len() > 0 {
let choice = rng.gen_range(0, $self_.$a.len());
$self_.$a[choice].to_owned()
} else {
String::default()
}
};
}

pub fn random_pattern(&self) -> String {
random_choice!(self, patterns)
}


Now we end up with a tavern pattern like the following:

The <adjective> <noun>


Once a pattern is chosen, we can replace tokens in the pattern text with the appropriate randomly selected substitution:

let result = re.replace_all(&pattern, |caps: &Captures| {
let token = &caps[0];
let result = match token {
"<noun>" => self.random_noun(),
"<title>" => self.random_title(),
_ => "INVALID_PATTERN".to_string(),
};

if result.is_empty() {
"INVALID_PATTERN".to_string()
} else {
result.trim().to_string()
}
});


In this case, random_adjective() returns Lonely and random_noun() returns Wyvern, producing The Lonely Wyvern as our new tavern name!

Here are some results of pattern substitution with basic replacement:

mystic order: Black Apostles
tavern name: The Hiding Lodge
military unit: Gold Lords
thieves and assassins: Disbursers Of Symmetry

mystic order: Indigo Sisterhood
tavern name: The Daring Den
military unit: Silver Eagles
thieves and assassins: Arrangers Of Correspondence

mystic order: Yellow Convocation
tavern name: Arrow Boat Pub
military unit: Benalath's Veterans
thieves and assassins: Fog Rat


### Language Structure

Some forms of pattern substitution need a specific decomposition of language structure to produce correct results.

Structure Examples:

• One Syllable
• Two Syllables
• Three Syllables
• Many Syllables
• Vile and Crude
• Small
• Medium
• Large
• Primitive
• Names
• Suffixes
• Doughty
• Syllables
• Male Suffixes
• Female Suffixes
• Homely
• Syllables
• Male Suffixes
• Female Suffixes
• Family Name
• English
• Scottish
• Fair and Noble
• Elf Prefixes
• Elf Prefixes (Alternative)
• Middle
• Male Suffixes
• Female Suffixes
• Faery Kind
• Prefixes
• Male Suffixes
• Female Suffixes
• Faery Kind (Alternative)
• Prefixes
• Male Suffixes
• Female Suffixes
• Elegant Evil
• Dark Elf Prefixes
• Dark Elf Prefixes (Alternative)
• Middle
• Male Suffixes
• Female Suffixes
• Malevolent
• Prefixes
• Male Suffixes
• Female Suffixes
• Draconic
• Prefixes
• Suffixes
• Infernal
• Softs
• Dulls
• Sharps
• Empyreal
• Prefixes
• Male Suffixes
• Female Suffixes
• “Ar” Titles
• “Al” Titles

The substitution must also respect whatever rules are required. Some species are gendered (male or female), and some have alternative forms (different castes, etc.).

Species Gender Alternative
Goblins NO NO
Orcs NO NO
Ogres NO NO
Dwarfs YES NO
Halflings YES NO
Gnomes YES NO
Elves YES YES
Cavemen YES NO
Faerykind YES YES
Dark Elves YES YES
Half-Demons YES NO
Dragons YES NO
Demons NO NO
Angels YES NO

When all of the substitutions and rules are evaluated, the results can be quite decent. Here are some results of pattern substitution with language structure.

First run:

generic fantasy name: Tervaën
goblin: snaglat
orc: bagdug
ogre: barshhai
caveman [male]: naoh
caveman [female]: khee-pogh-soh
dwarf [male]: grim-vi
dwarf [female]: born-bis
halfling [male]: ferdo Luff
halfling [female]: fulbily
gnome [male]: thrur-o
gnome [female]: thror-wisa
elf [female]: imthalril
elf alternative [male]: rindesor
elf alternative [female]: aegolsil
dark elf [male]: jeglevvim
dark elf [female]: tulraliln
dark elf alternative [male]: orelrim
dark elf alternative [female]: olglenlin
faery [male]: glimaron
faery [female]: dexanel
faery alternative [male]: histmist
faery alternative [female]: heltiss
half demon [male]: nidarag
half demon [female]: guzlyrr
dragon [male]: abraboros
dragon [female]: malachozuthraxis
demon: hragchru
angel [male]: valantath


Second run:

generic fantasy name: Leoptrin Broxus
goblin: sligsnag
orc: ugmuz
ogre: dushthrag
caveman [male]: haogh-burh
caveman [female]: dum-mih
dwarf [male]: brod-lin
dwarf [female]: horn-na
halfling [male]: samo
halfling [female]: marka Fremlin
gnome [male]: storn-fast
gnome [female]: burl-ina
elf [male]: mareldir
elf [female]: arthonian
elf alternative [male]: thaelemrond
elf alternative [female]: therilrial
dark elf [male]: morerriv
dark elf [female]: noelvra
dark elf alternative [male]: mabdylild
dark elf alternative [female]: ollavvra
faery [male]: minallo
faery [female]: glanefer
faery alternative [male]: jostbrix
faery alternative [female]: histree
half demon [male]: kharkull
half demon [female]: rulkdusla
dragon [male]: orgracalchax
dragon [female]: bhakrizzemalis
demon: bubmat
angel [male]: asanathal
angel [female]: varamet


Third run:

generic fantasy name: Favaijeness
orc: bakhblag
ogre: urghmurk
caveman [male]: giree-pugh-hani
caveman [female]: gunri-rifoo-fah
dwarf [male]: bromi
dwarf [female]: sturl-dis
halfling [male]: falcert
halfling [female]: droga
gnome [male]: dral-ert
gnome [female]: throl-ily
elf [male]: elemdil
elf [female]: aremiel
elf alternative [male]: sindthonras
elf alternative [female]: feanarel
dark elf [male]: mezlinuld
dark elf [female]: imlivira
dark elf alternative [male]: dollenvim
dark elf alternative [female]: thallinene
faery [male]: rillondo
faery [female]: twissamer
faery alternative [male]: mistlewin
half demon [male]: saagnal
half demon [female]: kargjiul
dragon [male]: baracordax
dragon [female]: marmoraneriaxis
demon: juumat
angel [male]: kavalath
angel [female]: jasarmes


### Probabilities and Weights

Some of the substitutions have equal weighting:

pub fn random_title(&self) -> String {
random_choice!(self, titles)
}


Some of the substitutions have biased weighting:

pub fn random_name(&self) -> String {
let d30 = rng.gen_range(0, 30);
match d30 {
0..=5 => format!("{} of {}", self.random_role(), self.random_goal()),
6..=10 => format!(
"{} {} {}",
self.random_directive(),
self.random_title()
),
_ => format!("{} {}", self.random_descriptive(), self.random_group()),
}
}


And some of the patterns can be an alias for aggregating multiple data sources:

pub fn random_group(&self) -> String {
let d4 = rng.gen_range(0, 4);
match d4 {
0 => self.random_weapon(),
1 => self.random_item(),
2 => self.random_creature(),
_ => self.random_action(),
}
}


The results are impressive, but the technique is simple. Therefore, it is quite easy to fine tune the frequency or probability of certain patterns based on the desired outcome.

Another improvement would be to filter out results based on similarity to other previously generated names. To accomplish this, I would recommend the Damerau-Levenshtein distance algorithm for computing similarity.

## Method: Markov Chain

Wikipedia: “A Markov chain is a stochastic model describing a sequence of possible events in which the probability of each event depends only on the state attained in the previous event.”

When given a set of words as training data, this approach calculates the probability of a character appearing after a sequence of characters thus far. Models are maintained that look up to N characters prior, where N is the configurable order property of the generator. The generator starts at a model with the highest order, falling back to the lower order models, if necessary. This is an approach called Katz’ back-off model.

NOTE: The higher the order value, the larger the chunks of training data will appear in the results.

For the Markov chain data sets, decomposition of language structure is unimportant, as the algorithm can synthesize against the full name list. Similar to the other data sets, we can source from historical, religious, and scientific references.

[[datasets]]
name = "Theological Demons"
values = [
"aamon",
"amon",
"apollyon",
"abezethibou",
"abraxas",
// ...
]

[[datasets]]
name = "Theological Angels"
values = [
"abathar",
"ahriman",
"ambriel",
"amesha",
// ...
]

[[datasets]]
name = "Egyptian Deities"
values = [
"aker",
"ammit",
"amenhotep",
"am-heh",
"amun",
"amunet",
// ...
]

[[datasets]]
name = "Planets & Satellites"
values = [
"moon",
"phobos",
"deimos",
"io",
"europa",
"ganymede",
// ...
]

[[datasets]]
name = "Ancient Greek Cities"
values = [
"abdera",
"abila",
"abydos",
"acanthus",
"acharnae",
"actium",
// ...
]

[[datasets]]
name = "Iron Age States"
values = [
"aethiopia",
"alashiya",
"alba",
"ammon",
"anarta",
"anga",
// ...
]

[[datasets]]
name = "Roman Emperors"
values = [
"achilleus",
"aelianusca",
"aemilianus",
"aemilius",
"albinus",
"alexander",
// ...
]


By using a Markov chain, we can synthesize nearly endless names where many are plausible.

First run:

Data Set: Theological Demons
result [0] is Namalthus
result [1] is Halphegorias
result [2] is Amdusion
result [3] is Kalion
result [4] is Vapuloman

Data Set: Theological Angels
result [0] is Kerubim
result [1] is Netzachael
result [2] is Seraphqiel
result [4] is Metatrones

Data Set: Egyptian Deities
result [0] is Neferty
result [1] is Hedemak
result [2] is Pakhen
result [3] is Seshezmu
result [4] is Sekhbethetet

Data Set: Planets & Satellites
result [0] is Jarnaq
result [1] is Ganymedeimos
result [2] is Erriapetus
result [3] is Karissa
result [4] is Ferdita

Data Set: Ancient Greek Cities
result [0] is Rhypetro
result [1] is Antinion
result [2] is Tauros
result [3] is Amaizinion
result [4] is Cnidonia

Data Set: Iron Age States
result [0] is Sparsua
result [1] is Param
result [2] is Kosalaya
result [3] is Tocharyanka
result [4] is Sogdiana

Data Set: Roman Emperors
result [0] is Leolus
result [1] is Artinax
result [2] is Amanus
result [3] is Aemiliscus
result [4] is Lascarus


Second run:

Data Set: Theological Demons
result [0] is Kalion
result [1] is Penex
result [2] is Merit
result [3] is Xezbethin
result [4] is Belphar

Data Set: Theological Angels
result [1] is Kaman
result [2] is Hahalik
result [3] is Penemuel
result [4] is Nakiramael

Data Set: Egyptian Deities
result [0] is Ateneg
result [1] is Hesatenen
result [2] is Atenet
result [3] is Banebet
result [4] is Weretseger

Data Set: Planets & Satellites
result [0] is Aoedeia
result [1] is Besto
result [2] is Taygetebos
result [3] is Bestlassa
result [4] is Erissa

Data Set: Ancient Greek Cities
result [0] is Messo
result [1] is Halopeion
result [2] is Antinion
result [3] is Pavlopoli
result [4] is Elatanos

Data Set: Iron Age States
result [1] is Coris
result [2] is Xinga
result [3] is Tartu
result [4] is Avantia

Data Set: Roman Emperors
result [0] is Chlorinus
result [1] is Pescens
result [2] is Saturninus
result [3] is Comenianus
result [4] is Herius


## Method: Neural Network

For the neural network approach, there is a lot of similarity between the NN and the Markov approach. Essentially the network is trained on probabilities of certain patterns of characters following other patterns of characters. I would argue that the main difference is that the neural network will be much more unpredictable than a tuned Markov chain (which is both a good and a bad thing).

Nearly all of the neural networks related to text synthesis will be LSTM-based (long short-term memory). I have some experience with RNN, but I am very far from being an expert. Therefore, I’m referencing a few decent looking examples of this approach, rather than providing my own implementation (at least for the moment).

After fiddling around with the pattern subtitution method, I remembered the old AD&D Dungeon Master’s Design Kit, and how it had some pretty amazing templates for structuring adventure narratives.

The structure and order of events is as follows:

• Theme
• Goal
• Hook
• Plot
• Climax
• General Setting
• Specific Setting 1
• Specific Setting 2
• Master Villain
• Minor Villain 1
• Minor Villain 2
• Ally / Neutral
• Monster Encounter
• Character Encounter
• Death Trap
• Chase
• Omen / Prophecy
• Secret Weakness
• Special Condition
• Moral Quandry
• Red Herring
• Cruel Trick

NOTE: Based upon tables from the Dungeon Master’s Design Kit by TSR, Inc.

For some extra fun, I decided to create a data set based on these tables, and write an adventure generator.

An example of results produced:

Theme: Horror
This type of adventure is designed to scare both the characters and the players. Just having a monster
attack is not enough for a horror theme; the monster must first frighten the characters.

Goal: Clear Name
The name of one of the characters or an NPC has been sullied and the characters must clear it. The characters
must find out a) why the name has been smeared, b) who is responsible, and c) why the responsible party is
doing it; then they must find evidence to convince everyone they're telling the truth.

Hook: Hero Offended
Someone greatly offends the hero, so much so that he'll pursue his offender right into the adventure.
(Note that this usually means that the offender is a minion of the Master Villain. You'll have to decide
whether the minion offended the hero precisely to bring him into the adventure or just as a side-effect of
his ordinary villain activities.)

Plot: A-B-C Quest
This is an epic sort of plot. In it, the heroes are given (or undertake) a task to perform: The taking of
a city, the rescue of an innocent, the destruction of a monster, the creation of a magical item, the defeat
of a Master Villain, etc. But the path to victory is not a simple one. To get to their goal, Event A, they
find that they must first accomplish some other task -- Event B. But when they undertake the task of
accomplishing Event B, they find that they must first accomplish Event C. This goes on for several encounters,
until the heroes accomplish all the obstacle events which prevent them from returning to Event A, their
original goal.

Climax: Natural Disaster
Maybe the Master Villain has been tampering with the delicate forces of nature. He may, for instance, have
been powering his master spell with the energies of a volcano. When the heroes attack the scene of his
spellcasting, the spell goes out of control and so does the volcano. The villain is consumed in the eruption
and the heroes must escape or be consumed themselves.

General Setting: Hero's Home Town
The action takes the heroes back to the home territory of one of them. Note that this usually means that this
hero's family or old friends are deeply involved in the adventure.

Specific Setting 1: Temple/Church
This can be either the church of some lofty and good deity, or the dark and grisly temple of some horrid
deity (doubtless filled with evil soldiers and monsters), or even the temple that the madman villain has
dedicated to himself for when he becomes a god.

Specific Setting 2: Mansion of a Lord
This can be the home of a villain -- the characters may have to break in and rescue someone or steal evidence
or break out if they've been captured -- or of a heroic ally, in which case it may be used as the headquarters
for the heroes' plans and activities.

Master Villain: Conqueror
This character is moving his army in to take over; that's what he lives for. He's been the enemy of your
characters' nation's ruler and has launched a full-scale invasion of your characters' favorite nation. The
heroes have to beat their way through or elude his hordes of soldiers in order to get at him; better yet, they
might lead their own nation's troops against his and outthink him in military fashion.

Minor Villain 1: Corrupted Hero
This villain was once a hero, possibly one known to the players. He was seduced by the dark side of the dungeon
master. Because of his own weakness, or of a curse, he has become a villain, a pawn of the Master Villain.

Minor Villain 2: Misguided Moralist
This fellow has been convinced that only by helping the villain achieve the Master Plan can he improve the world.
He tends to be encountered all through the adventure's plot, usually escaping from the heroes and taunting them
for their wrong thinking. Fortunately, he's no more effective as a villain than he is as a thinker.

Ally/Neutral: Grumpy Old Professional
Again, the heroes need an expert in a certain field -- this time a craft or art, such as blacksmithing, engineering,
horse-training, or whatever. The only or best professional they can find is an aged expert. He's grumpy, cranky, and
sharp-tongued; he constantly complains about the food, the weather, his companions, the decline in skill of his
co-workers since he was a young man, the road conditions, the rotten pay he's receiving, and so on.

Monster Encounter: Reconnaissance Monster
At some point in the adventure, the Master Villain will become aware of the heroes' activities against him. If he
has magical abilities or a magical servant, he will send some sort of quiet, clever monster to spy on the heroes.
The heroes should have an opportunity to realize they're being spied upon, leading them to a mad scramble as they
try to capture or destroy the spy.

Character Encounter: New Enemy
In the course of his ordinary activities, one of the heroes can make a New Enemy. Hurrying along the street, he can
bump into a disagreeable fighter for whom an apology isn't enough; in a tavern, he can make some innocuous remark
that you deliberately have the irritable fellow misconstrue as an insult. The New Enemy will only exchange heated
words with the hero at this point but will appear again later in the adventure and will eventually have to fight
the hero.

Death Trap: Rock and a Hard Place
This trap starts out as an Animal Pit, Pit and the Pendulum, or Tomb Deathtrap, but an obvious escape suggests
itself very early on. Trouble is, it leads into even worse danger. The hole out of the animal pit may lead to the
lair of an even worse animal; it may lead through a succession of dangers (collapsing old catacombs, into an
underground river, into a den of zombies) before the heroes reach the light.

Chase: Endurance
The Endurance Chase is not some sort of climactic chase -- it's a rugged, tiring, persistent pursuit that tests
the characters to their limits. In this chase, the heroes and villains are pursuing one another across a lot of
territory and they're not catching up with one another very fast. This may be a horseback pursuit across a hundred
miles of savannah, a camel chase across several days' worth of desert, or a chase across arctic tundra.

Omen/Prophecy: Hero Fulfills Prophecy
This is the most useful sort of prophecy. In the early part of the adventure, one of the heroes discovers that he
fulfills some ancient prophecy.

Secret Weakness: Holy Symbol
The villain may have the traditional weakness to a specific holy symbol -- but don't choose just an ordinary one.
It may be a holy symbol no longer used by the church or may be some forgotten variation of the current symbol.
(For instance, the cross may not work, but a variation -- such as the Roman cross -- might; alternatively, it might
have to be a holy symbol which has undergone some unfamiliar ritual.)

Special Condition: No Lawbreaking
For some reason, at one point in the story, the heroes cannot allow themselves to break the law -- even when it would
help them greatly to do so. For instance, the heroes may be asking for the help of a king whose word is law and whose
power is immense. When they arrive for their audience, an emissary of the Master Villain is making a similar plea for
help. If the heroes attack and kill that emissary, they will lose any chance at the king's help -- in fact, he may
order their execution.

Moral Quandary: Ally Quandary
You set up the situation so that the heroes have a good chance at defeating the Master Villain if they get the aid of
two specific individuals, probably experts in fields relating to the villains' activities. But the two experts hate one
another and refuse to work together, even if it costs them their world.

Red Herring: Lying Rumor
This is the worst and most useful type of red herring -- the interesting rumor which just happens to be false.
In adventures of this sort, the best Lying Rumor concerns the Master Villain; it gives the heroes some "important"
information about him which later turns out to be useless.

Cruel Trick: Villain Accompanies Party
In this distressing situation, the Master Villain, in disguise or his secret identity, accompanies the heroes for much
of their quest. He gets to know them, learns their strengths and weaknesses, learns their plans, and just as soon as it
is most efficient for him, he thwarts their current plans and leaves. Alternatively, the Master Villain might be with
the heroes all along, up to the very end; the heroes know that one of their companions is the villain, and the whole
thrust of the story is finding out who he is. This is the whole purpose of most Mystery-type adventures.


Another example:

Theme: Revenge
In this adventure, some villain has so offended one or more of the characters that he cannot be suffered to live.
(Alternatively, the injured party could hire the characters to avenge his honor.) The villain must be found or otherwise
gotten at, setting up the final duel or showdown between villain and characters.

Goal: Rescue Someone
The characters must rescue one or more kidnapped people, probably from the stronghold of the kidnapper. Obviously, they
must get to said stronghold, break in, rescue the kidnapped, break out, and escape back to safety; this usually requires
careful and clever planning and a large dose of luck.

Hook: Mystery Woman
Create an NPC "mystery woman" sure to be fascinating to your hero and have her keep appearing inexplicably in his life.
As he becomes interested and investigates her, he keeps stumbling across the villain's plans and becomes inextricably
mired in the plot. (For female player-characters, the Mystery Man is just as useful.)

Plot: Event
For this plot, choose some sort of event -- a tournament, a holiday, a celebration called by the king, a masked ball,
or whatever -- and set the commencement of the Master Villain's plan against that backdrop.

Climax: Chase to Ground
First, you have the Heroes Chasing the Villain. The villain, after a series of encounters with the heroes, is running
to safety, to some place where he can acquire more power, or to somewhere he can accomplish some dread purpose such as
assassination or mass murder. The heroes chase him, must deal with the obstacles he leaves behind, and finally catch up
to him before or just as he reaches his goal. Here, we have the final duel between the villain’s forces and the heroes.
Second, you have the Villain Chasing the Heroes. Often, in a story like this, the heroes have found out how to defeat
the villain -- such as getting to a particular temple and conducting a particular ritual. The villain chases them all
through their quest, catching up to them just as they're commencing their ritual; they must, with heroic effort, conclude
the ritual while suffering his attacks. Third, you have the Master Villain's Sudden Escape Attempt. This takes place in
adventures where the Master Villain's identity is unknown until the end. His identity is revealed, and he makes a sudden
bolt for freedom; the heroes give chase. This usually results in a dangerous foot-chase through nasty terrain -- such as
across rooftops, through the dungeons, or across an active battlefield.

Most of the adventure takes place on the road, as the heroes are travelling from place to place. This is especially good
for adventures where heroes are investigating a wide-ranging mystery, are part of a caravan, or are being pursued by
loathsome villains.

Specific Setting 1: Demi-human Community
In wilderness areas, this will be a large community of demi-humans -- elves, dwarves, halflings, whatever -- or intelligent
nonhumans such as orcs. If your action is taking place in a city, this could be a hidden community (such as a secret
underground dwarf community) or a section of the city inhabited mostly by demi-humans.

Specific Setting 2: Laboratory
This can be alchemical lab of a friendly wizard, or the horrible experimental chamber of the villain where new monsters
are created and released upon the world.

Master Villain: Lovable Rogue
This Master Villain isn't really evil -- he's just chaotic and fun. Cheerful bandits in the forest who rob from the rich
and give to the poor, singing and rope-swinging pirate kings, and romantic, sophisticated duelists all belong to the
category of the Lovable Rogue. Often, the Rogue will not be behind the nastiness the heroes are encountering; he may be
in competition with them for the prize they're seeking. Often the heroes and the Rogue (and his minions) will have to team
up to succeed at their task. Just as often, the Rogue will try to get away with the whole treasure.

Minor Villain 1: Single-Minded Soldier
This most trustworthy of villain minions is the experienced, competent, persistent soldier -- a field-trained officer who
serves the villain with military precision. He is usually encountered in the field as leader of the villain's field
operations. He is not encountered directly until the middle of or the latter part of the adventure; until then, the
heroes encounter only his subordinates.

Minor Villain 2: Inquisitor
This villain is the one who interrogates the heroes and NPCs captured by the villains. He accompanies the other
Minor Villain out into the field and works on anyone captured; he enjoys inflicting pain and suffering.

Ally/Neutral: Arrogant Snob
For some reason, the heroes have to accompany or escort an arrogant nobleman or craftsmaster. They can't afford to
abandon or kill this person; he or she may be their employer, an expert on the place they're going to, one of their
relatives, or a relative of the royal family. And this person makes their life hell with sniping comments, haughtiness,
and other unbearable traits.

Monster Encounter: Ravager
This is another classic monster encounter; the monster which is bedeviling a community or local area and will continue
to do so unless the heroes destroy or defeat it. Yes, this is like the Master Villain of the same name, but the Ravager
usually has no master plan -- it just wants to kill, destroy, or eat.

Character Encounter: Old Friend at the Wrong Time
One of the characters' old friends recognize him and loudly renews their acquaintance in full view of the guards looking
for the characters. This usually leads to an exciting chase as the heroes must escape.

Death Trap: Framed
One or more of the heroes is accused and convicted of a capital crime -- one for which the mandatory punishment is death.
The heroes must escape or die, and they're escaping from the well-built, well-protected prison of the local authorities.

Chase: Horseback
This is a relatively short chase -- it only needs to go on for a mile or so before even the best horses are winded.
If it goes on longer than that, the horses may collapse and perhaps die.

Omen/Prophecy: Comet's Progress
Events during the adventure may be enlivened by a large and menacing comet which appears in the night sky for several
days during the scenario; the locals take it for an omen of doom. The comet may be the result of magic being used by
the Master Villain, or the comet's appearance can pertain to an old legend involving the Master Villain.

Secret Weakness: Love
The Master Villain possesses the "weakness" of genuine affection or love -- probably for some person, though it could
be very intriguing if the object of his affections is a player-character. The heroes can then defeat the villain by
holding his loved one hostage or proving that his loved one will be seriously harmed, betrayed, or killed if the villain
keeps up with his activity.

Special Condition: Omnipresent Observer
If a wizard, demigod or god has forced the heroes to undertake this quest, he may be with them continually -- in spirit.
He can't help them but does magically watch everything they do. And when they do something he doesn't like, he tells them
about it -- loudly and nastily. (This is distressing when they're trying to break into a fortress or sneak through enemy
lines.)

Moral Quandary: Ally Quandary
You set up the situation so that the heroes have a good chance at defeating the Master Villain if they get the aid of two
specific individuals, probably experts in fields relating to the villains' activities. But the two experts hate one another
and refuse to work together, even if it costs them their world.

Red Herring: Extraneous Details
When giving the heroes details on their enemy -- for instance, details they are learning from investigations and readings
-- you can give them just a few details too many. This may prompt the heroes to investigate the "extra" (i.e., irrelevant)
details in addition to the relevant ones, thus losing them valuable time.

Cruel Trick: Someone Turns Traitor
He may alert the enemy when the heroes are planning a raid; he may steal the artifact and take it to the villain; he may
stab a hero or important NPC in the back (literally) before departing.


This approach could then be combined with the name generator to replace placeholder tokens like “Master Villain” with a randomly generated name. Taking it further, the story framework could then be passed into a neural network (or some other algorithm) to generate a world and scripting based on the story and locations.

## Grue

It is pitch black. You are likely to be eaten by a grue.

Further investigation will reveal more about their nature:

> what is a grue?

The grue is a sinister, lurking presence in the dark places of the earth.
Its favorite diet is adventurers, but its insatiable appetite is tempered
by its fear of light. No grue has ever been seen by the light of day, and
few have survived its fearsome jaws to tell the tale.


I have released a new rust crate called grue where I’ve been implementing various algorithms and utilities that are useful for role-playing and fantasy games.

Some of the currently implemented functionality includes name generators using pattern substitution and Markov chains.

Pattern substitution can be run with:

cargo run --release --example namegen


Markov chain synthesis can be run with:

cargo run --release --example markov


Random adventures can be run with:

cargo run --release --example adventure


This crate is still very early and incomplete, but the name generators are quite feature rich now (and provide a complete working example of the methods in this blog post).

If interested, check it out!.