Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DarkBASIC Professional Discussion / Lightweight Procedural Name Generator

Author
Message
Libervurto
17
Years of Service
User Offline
Joined: 30th Jun 2006
Location: On Toast
Posted: 6th Feb 2013 13:15 Edited at: 6th Feb 2013 13:53
I tried to make a very economic name generator. My idea was to make one long string of the entire alphabet in a particular order and select a random character from part of its length, depending on the last character selected.

[edit: optimized]
Code:


I think this produces some nice names, and while they don't follow any recognisable culture they do all seem to be pronounceable if you give it a bash.

Here's some examples:


If you have any name generator code please post it here, I'd be interested in seeing different methods.

^ That's what she said.
mr Handy
16
Years of Service
User Offline
Joined: 7th Sep 2007
Location: out of TGC
Posted: 6th Feb 2013 13:46
I have a bionical name generator - just let my dog tap the keyboard for a while.

*** Merry Chuckmas! ***
Libervurto
17
Years of Service
User Offline
Joined: 30th Jun 2006
Location: On Toast
Posted: 6th Feb 2013 13:59 Edited at: 6th Feb 2013 13:59
That would actually have more structure to it than you think, since your pooch would rarely be able to press one key independently it would produce groups of letters near each other on the keyboard. Let's try!


Hmm, there is a certain "cultural" pattern that's distinct between the two. Maybe if you created a more suitable character map this could work! Now we just need an unlimited supply of dog biscuits...

^ That's what she said.
BMacZero
18
Years of Service
User Offline
Joined: 30th Dec 2005
Location: E:/ NA / USA
Posted: 6th Feb 2013 23:42 Edited at: 7th Feb 2013 19:14
Haha, that's cool. The Dvorak one actually does seem somewhat reasonable.

You inspired me - here's my attempt at using a two-level Markov chain. It should keep some kind of cultural similarity to the words you seed it with, which is cool.


Some sample words using this list of English female first names as seeds:

English male first names:

Mineral names:


zeroSlave
14
Years of Service
User Offline
Joined: 13th Jun 2009
Location: Springfield
Posted: 7th Feb 2013 00:51 Edited at: 7th Feb 2013 04:36
Howdy! This is something I threw together a few weeks back:


It basically just uses random letters while mostly alternating consonants and vowels. letterMod() is kind of a set of rules for what to do with the current random letter.

It gets some decent results:


But also some weird ones:


Everybody is a genius. But if you judge a fish by its ability to climb a tree, it will live its whole life believing that it is stupid.
Libervurto
17
Years of Service
User Offline
Joined: 30th Jun 2006
Location: On Toast
Posted: 7th Feb 2013 10:35 Edited at: 7th Feb 2013 10:37
@ZeroSlave
That's quite similar to the name generator they used in Elite.

The part where you generate a character and then check it follows the vowel-consonant-vowel pattern after the fact is a bit wasteful since it inevitably slows things down. I've made a few edits that should speed things up but produce the same output. (Except for capitalisation, which I feel should be done outside the function.) I've thrown some strings in there to replace some of the logic, it can be very useful to use strings as arrays in this way, which is really what they are of course.


^ That's what she said.
Libervurto
17
Years of Service
User Offline
Joined: 30th Jun 2006
Location: On Toast
Posted: 7th Feb 2013 12:16 Edited at: 7th Feb 2013 12:25
@BMac
Interesting code. I'm not entirely sure how it works, it's quite hard to follow. I changed it to run multiple passes using the output as the next seed, which could act like generations within a culture. Unfortunately, some blanks keep appearing for some unknown reason.

(I'm on DBC atm so I had to butcher your code slightly to make it work.)


Here's my starting seed:


Pass 1:
2:
3:
4:
5:
... 20:


Funny how popular names come and go.
And even stranger how lost names can pop up again after several generations! See "Shannon" as an example.

^ That's what she said.
mr Handy
16
Years of Service
User Offline
Joined: 7th Sep 2007
Location: out of TGC
Posted: 7th Feb 2013 12:24
@OBese87

Iv'e tried the russian layout, chances are: 50% to produce elvish name like Impaolro and 50% orc name like Oshshzolsh

*** Merry Chuckmas! ***
BMacZero
18
Years of Service
User Offline
Joined: 30th Dec 2005
Location: E:/ NA / USA
Posted: 7th Feb 2013 19:14 Edited at: 7th Feb 2013 19:24
Neat idea. I think your seed size might be a bit too small, since you're sometimes getting the exact same word in the same iteration, which indicates that the chain doesn't have enough branches (for example, maybe once it gets to "sha" there aren't any options to follow that other than "shaywood").

The blanks must mean that you have a blank line in your seed data - because then the program is reading a seed that begins with an ENDWORD symbol, and so now it thinks it can select that symbol to start off a word.

Basically what it's doing is building a list of probabilities for certain characters to appear based on the pair of characters that appeared immediately before. So when building a word, if it had previously selected the characters "na", it looks in the table under markov("n", "a") to see what letters can possibly follow this combination, and what the probability of each is.


The debug output can be pretty interesting. It shows which pairs of characters actually occur in the data. When you see the vertical column under 'q', that shows which letters can precede 'q'. In this data set, only 'a', 'm', 'r', 'u' or BEGINWORD can precede 'q'. And naturally, looking at the horizontal rows, the only letter that can follow 'q' is 'u'.

I tried to clean up my code a bit and add comments . I also added a switch to use 1st or 2nd-order chains (switching it to 1 means it will only use the immediately preceding character, rather than the pair, which will make things much less patterned).

Attachments

Login to view attachments
mr Handy
16
Years of Service
User Offline
Joined: 7th Sep 2007
Location: out of TGC
Posted: 9th Feb 2013 08:06
@BMacZero

That's awesome picture! I think it can be modified to work with short strings, like "iel", to make special style names, like elvish.

*** Merry Chuckmas! ***
Ortu
DBPro Master
16
Years of Service
User Offline
Joined: 21st Nov 2007
Location: Austin, TX
Posted: 10th Feb 2013 02:09 Edited at: 10th Feb 2013 10:00
The most important thing in creating identifiably distinct cultures in a name generator is the repetition of patterns unique and common to that culture. Each culture should have a different rule and pattern set.

Here's the method I'm using in an rpg. It's not 100% procedural as it relies on a seeded data set, though there are some advantages to this, especially when the cultures themselves are not procedural and the name sets need to fit with the existing overall cultural definition that's been created.

The interesting thought is that you could build the components (generally 2-4 letters) procedurally with randomized parameters to the ruleset to define common small patterns for a new culture.

I think you'd have better results in building smaller blocks of 2-4 letters at complete random and getting something intelligible than trying to build entire names of say 3-10 letters.
Then use something like this to create the larger names. It would give a good repetition of patterns within patterns I think.

Anyway, using a manually seeded set of components for 3 cultures, my generator gives results like this:

typical western fantasy rpg theme:

male:



for this culture, masculine names will commonly start with consonants, and masculine vowels U, O, while others can appaer with varying frequency, its rare for a male to start with Y
endings are usually a shorter, sharper, harder sounds ic, oc, ot, in, on, an

female:



feminine will more often start with vowel, commonly A, E, Y, and rarely with a masculine U, O
endings are longer, softer, more breathy, often vowel a, ia, ea, eigh, ese, el

eastern theme:

male:



for this culture as a whole, I've introduced the ' character as a short sharp pause marker, as well as allowing a space to break a name into further pieces.
The uncommon for western consonents X, Q, Z, W etc have been made far more common on the whole while G, H, J and such are less
masculine will rarely begin with a vowel, and Y is treated more as a consonant, with endings not as sharp and hard as the western culture but still following a U, O masculine theme as well as setting an, in to masculine

female:



feminine more often starts with a vowel, and O in the front is considered feminine while o at the end is still masculine and uncommon.
endings are still commonly a vowel, though here it is shorter, much less breathy. frequently e, i, as well as setting en, un to feminine opposite the masculine an, in

desert theme:

male:



for this culture, double letters are common, rr, ii, ee, dd, mm, zz etc, and breathiness is prevailant throughout.
for masculine starters, Z, S are common consonants, while A, U, I appear for the vowels. masculine names tend to start a bit softer than males of other cultures moving to harder at the end, somewhere in the breathy mid ranges id, on, ek, un, um, iz

female:



for feminine starters Z, S are still common as with the males, though S a bit more so here. Y also appears much more frequently. endings are softer and somewhat breathier than the males, in, ahd, ahn, ah, oh, eh

and here is the code, it's quite compact and simple i think:



part of the seed file as example:



project and seed file attached to post.

using 10 options for each part for each gender, this gives possible names:
first component & last component: 10*10 = 100
first component & middle component & last component 10*10*10 = 1000
so 1,100 possibilities per gender per race

In my full seed file, i'm using 100 options per part per gender per race giving 1,010,000 possibilites for each gender/race.
As far as randomality goes, it is a small data set with a relatively small range of possibilities, however, names are not unique. There are many Johns, Mikes, Toms etc.

An important part of defining a cultural pattern is actually the repetition of common names, and so it becomes desireable to have a large enough data set that every third name isnt the same, but that you might expect to find a couple of duplicates in 1,000.

Attachments

Login to view attachments
Libervurto
17
Years of Service
User Offline
Joined: 30th Jun 2006
Location: On Toast
Posted: 10th Feb 2013 16:10
Thanks Ortu. I think a blend of all three methods could work really well: mine would produce the first set of name fractions, Ortu's would build names from them and Bmac's would dissect them into new fractions for the next generation of names. Then we have culturally unique names that also alter over time.

^ That's what she said.
Ortu
DBPro Master
16
Years of Service
User Offline
Joined: 21st Nov 2007
Location: Austin, TX
Posted: 10th Feb 2013 18:29
agreed, its a bit beyond my needs right now but i would be interested to see the results such a system would give.

Login to post a reply

Server time is: 2024-03-29 04:53:01
Your offset time is: 2024-03-29 04:53:01