Send Mail To:Steve Register

Random Names - Gero Kunter.
This article was originally written for Darren Hebden's RLNews

One of the typical features of a roguelike game is that as many features as 
possible have random appearances. So it may seem a logical conclusion to add 
random names to the inhabitants of your virtual world as well. 

However, you should consider to which extend you want to give names to NPCs. 
Is it really necessary to have a name for every single orc, every single rat 
and every single bandit? But then again, powerful creatures, such as dragons, 
certainly deserve a well-sounding name. And of course, every shopkeepers would 
dishonour their profession without one. I think it is a good idea to have 
names for important and unique characters - people who give quests to the 
player, or potential companions. But your opinion may vary, of course.

But how do you generate random names?

You can employ powerful algorithms which will use a given set of data strings 
to generate random strings that are similar to the initial data. But there are 
simpler ways. In my project, I used two approaches, which I will outline 

    Combinations of given first and surnames

This method is quite simple. It uses three seperate lists with strings: one 
with male and one with female first names, and one with surnames. The 
following pseudo-code algorithm retrieves a new, random name. 

    switch Gender { 
        case male   : S = male_firstnames [random]
        case female : S = female_firstnames [random]
    RandomName = S + " " + surnames [random]

If you need "Nordic" names like "Kunt Barnesson" or "Gudrun     
Ingridsdotir"., you could use a variation of this:

    switch Gender { 
        case male   : S = male_names [random] + " " + male_names [random] + 
        case female : S = female_names [random] + " " + female_names         
                        [random] + "sdotir" 
You could add a control structure in which you keep track of the names that 
have already been generated, to prevent the algorithm from returning the same 
name twice:

    for i = 0 to 15 {
        for j = 0 to 15 {
            combination_given [i] [j] [male] = FALSE
            combination_given [i] [j] [female] = FALSE


        i = random
        j = random
    until combination_given [i] [j] [Gender] = FALSE
    combination_given [i] [j] [Gender] = TRUE

    switch Gender {
        case male   : S = male_firstnames [i]
        case female : S    = female_firstnames [i]
    RandomName = S + " " + surnames [j]

In a proper program, you would probably use a bit-coded flags to check which 
combinations have been generated.

    Completely random names

The second algorithm described here doesn't use combinations of given names, 
but generates them completely from scratch. The idea is to put together 
combinations of vowels and consonants to generate words that might be names. 
By using specific sets of sounds, you can control the "flavour" of the names, 
and you can combine it with gender endings.

First, you should define the vowel and consonant set:

    vowels = "aeiou"
    consonants = "bcdfghjklmnpqrstvwxyz"

Then, you generate a word, alternating between random vowels and random 

    S = ""
    for i = 1 to random {
        S = S + vowels [random] + consonants [random]
    switch Gender {
        case male   : S = S + 'us'
        case female : S = S + 'a'

If you want to add a surname, just repeat the above snippet without the gender 

In this crude version, the algorithm will return rather ugly, artificially 
sounding names. You could alter this by changing the probability for some 
sounds, by using different vowel and consonant sets:

    vowels = "aaaeeeiiou"
    consonants = "bbbcdddffgghjkllmmmnnnppqrrssstttvwxyz"

These sets would make "a" and "e" three times and "i" two times as likely as 
"o" and "u", with the corresponding values for the consonants. You could also 
completely leave out some sounds.

The method above always returns names beginning with a vowel and ending in a 
consonant (forgetting about the gender endings for now). To change this, you 
could add after the first line a structure like the following:

    switch random {
        case 1  : S = consonants [random]
        case 2  : { do nothing }

If properly implemented, the algorithm will give quite good - and sometimes 
even funny - names. I'll give you a list of random samples of names my 
implementation has come up with:

    Salopatan Dolot
    Lucara Vanibo
    Xyxelan Ubem
    Irabon Seboribal
    Abasixi Abubodul
    Sasipabi Itatop
    Latanybor Ocifil
    Obi Onu
    Laso Pubyl

But my absolute favourite was Eri Fuzibidusi!


For a fantasy world, you may also want to add impressive titles. For example, 
your player might meet a veteran soldier in some tavern. It would be nice if 
he would be called something like "Olaran Ozatar, the Ogreslayer", wouldn't 

This can be easily done, with a modification of the first method described 
above. Let's define a list of suffixes:

    suffixes = ("slayer", "hunter", "friend", "hater", "seeker")

Assuming that you have your creature names stored in a similar list, you can 
simply generate a title by

    title = "the " + creaturenames [random] + suffixes [random]

If you combine the methods as described here, it shouldn't be a problem to 
come up with as many exciting names as your roguelike game will ever ask for!
Copyright 2001 Steve Register.