Wednesday, July 15, 2015

npc - Name generation


I'm making a game (or planning to, at least) and to do that, I need a way to automatically generate names for the NPC "bosses" (long explanation and irrelevant here). Something like this is a good example of what I mean.


I have an idea that I can just build a database of names by nationality, maybe first/last pairs, and assign them randomly, with an ignored names list so I don't get something like Homer Simpson and get sued or something.


The problem with that is that I'd need to build up a massive database of names for that to work. It would either take forever or cost money, unless someone has a list of names available for free already.



I have another idea where I make random pairs of vowels and consonants, flip a few, and add them together, but a quick program that does that generated names like these:




  • Seermeecpa

  • Cime

  • Ofmiahwumafi

  • Gozidi

  • Effawided




(For anyone interested in the code, you can see it here)


These are... kind of a mouthful. Well, except "Gozidi" -- that one could work. Still, the success rate is clearly not very good.


Is there anything I could do to make the names sound nicer (see below), or should I start making that list? Can I somehow mimic the way humans decide if a name is decent or not, with at least some accuracy? I'd much prefer something like this to a lookup in a big list.


What I mean by "nicer" is that, instead of random combinations of characters (which it is, to be fair), things that sound like actual names. They can be from any culture (or sound like they are), real or imaginary, anything at all, so long as your stereotypical dumb, monolingual American like me can say 'em without too much trouble.


If you need extra clarification, go ahead and ask. I'm not really sure what to put here.


Addendum: So far as I can tell, there really aren't tags that fit this question all that well. If anyone who's been here longer can recommend some, that'd be awesome.



Answer



Most name generators work via some variation of Markov Chain, which are fairly remarkable (remarkovle?) constructs that have many uses in games, as well as other domains.


The basic approach does invoke a list of some kind. These do not need to be fairly huge. The purpose of this list is merely to inform the algorithm what syllables are likely to be paired together for a given category of name.


This allows you to put together different lists for e.g. male names, female names, family names, or names for different cultures/regions/species.



The time you'll spend tweaking an algorithm that randomly assembles made-up syllables into a pleasing fashion is likely going to be more than you'd spend just generating a list of names that you think sound good and fit a common theme.


There are many lists of names available. Download the latest US census database for modern day names easily separated by age, gender, and ethnicity, or grab lists of old Norse names or the like. These are all quite easy to find via Google; that last link was literally my first hit for "list of norse names."


No comments:

Post a Comment

Simple past, Present perfect Past perfect

Can you tell me which form of the following sentences is the correct one please? Imagine two friends discussing the gym... I was in a good s...