Human Name Generator

 It's been a while since I've posted to this blog, and there are a number of new things on the website for me to post about, but for this post I would like to focus on one specific addition to the website - the Human Name Generator. On the surface level this generator appears to simply select a single name from a large pool, and oftentimes that is most of what happens, but I would like to discuss the inner workings of it, and the intentions behind it.

The generator was originally conceived for a game I was developing, which has since been shelved in favor of a game that has proved far more successful thus far. The nature of the game's world lead to the name pool being quite odd - there are over fifty thousand names, from cultures all over the world and all across time, ranging from modern-day American names to those of Assyrian kings, in addition to fantasy names, sci-fi names, and names from numerous other sources. Some names even came from taking the list and feeding it into a Markov chain generator.

However, the process of generating a name is a little more complex than simply picking one from the 50k name list. To start, there is a 99.5% chance of selecting a name from the list, a 0.25% chance of using a nonsense word generator that I made for the game I'm currently developing, and a 0.25% chance of using the complete location name generator that I threw together as a bonus for my skulljhabit generators page.

When the generator selects a name from the 50k list, it actually performs two steps. Twine, the engine I program in, can only handle picking randomly from so many options at once. Because of this, the name list is split into eleven equally sized pools of names. The generator first picks a number between one and eleven, and then it selects a name from the target pool. Theoretically, this should be no different from selecting a name randomly from the 50k list itself as far as a user is concerned.

Once the name is generated, anti-Crawn measures are activated. You see, Crawn is a bug that haunts me. The generator picks this name extremely often, and I can not find any reason for it. It picks all other names randomly, with what as far as I can tell is equal probability. Because of this, I developed the anti-Crawn measures. When the generator is opened, it sets two variables: the Crawn cooldown, which is set to a random number from five to one hundred, and the Crawn count, which is set to one. Every time a name is generated, the cooldown decreases by one.

If the name Crawn is generated and the cooldown is greater than zero, a for loop beings. For those unaware, a for loop is essentially code where you begin with a number, typically zero, and then execute a piece of code. You then increment the number, usually by one, and execute the code again. You repeat this process until the number reaches a certain value (or something occurs which prematurely ends the loop), after which you continue to the rest of the code. This for loop starts at zero, and goes until it reaches nine hundred ninety-nine. Each time, it generates a new name, using the same 99.5-0.25-0.25% scheme as above. If the name is Crawn, the loop continues. If the loop exceeds nine hundred ninety-nine or a name that isn't Crawn is generated, the loop will immediately end. The cooldown does not change during this loop.

If the name Crawn is generated and the cooldown is equal to (or somehow less than) zero, the generator will pick a random number between one and the Crawn count variable. If it selects the number one, the Crawn cooldown will be set to one hundred, the Crawn count will increase by one, and the name Crawn will be served the player. If it selects a number other than one, the same for loop as described above occurs. This ensures that the name Crawn is still selectable, but each time it becomes rarer, and there is always one hundred names between each occurrence of Crawn.

After selecting a name and enacting the anti-Crawn measures, another for loop occurs. This for loop starts at zero and increments by one until it reaches nine hundred ninety-nine, like the others. Its code works as follows: there is a 1 in 144 chance of generating a second name, using the same 99.5-0.25-0.25% scheme as above, enacting anti-Crawn measures, and then concatenating that name to the original using either a hyphen or a space. If this 1 in 144 chance occurs, the loop continues, with an additional 1 in 144 chance of a third name being added. If at any point the 1 in 144 chance fails (or the loop exceeds 999), the loop will immediately end. Additionally, before the loop starts there is a 1 in 1728 (123) chance that the loop will not end when the 1 in 144 chance fails, and instead will only end when it exceeds 999.

Once all of this has happened, yet another for loop occurs. This for loop has the same values as all the others. During the loop, there is a 1% chance of a modifier being activated. There are three modifiers, each with an equal chance of being selected. The first modifier is the letter changer, which selects a random letter in the name and if it is a vowel it replaces it with another vowel, and if the letter is a consonant it gets replaced with any other letter. The second modifier is the letter inserter, which simply inserts any letter at a random position in the name. The third modifier is the letter remover, which picks a random letter in the name and removes it. If the 1% chance fails, there is then a 0.1% chance of the name being reversed. If both the 1% and the 0.1% chances fail or its value exceeds 999, the loop will end. However, similarly to the previous loop there is a 0.1% chance that the loop will only end if its value exceeds 999.

Afterwards, the name is printed for the user to see. Because most of this is chance-based, most users will likely get bored or get what they need before they encounter any alterations to names, or either of the alternate generators. And because there are so many names and most of them are unfamiliar to the majority of people, most users will be unaware that they are viewing a rare name when they encounter it. However, I do not care. The point of the alterations is that they're not common, and that they add practically endless possible combinations of names to the already massive generator. While I would love for other people to use this in some way (let me know if you do!), it was not made for other people. I create for the sake of creation, and as much as I love when people interact with the things I make, it does not define my creative process.

Comments