A downloadable class

This is a utility class I made to name stuff in multiple projects. The strength of it is its flexiblity, allowing for more than just a short set of character names to be cycled through.

The big feature is that this is expandable in your own projects without editing the class, if you want to see the example of AddWordSet below for details on how.

This code is made available as public domain under the CC-0 license.

Example use:

var results = NameGenerator.GenerateName("{adjective} {animal} {number}")
print(results) # something like "Hungry Wolf 24"

var results = NameGenerator.GenerateName("{firstName} {lastName}")
print(results) # something like "Larry Landbert"

var nameset = "scientist"
var names = ["Einstein", "Curie", "Newton"]
NameGenerator.AddWordSet(nameset, names)

var results = NameGenerator.GenerateName("{firstName} {scientist}")
print(results) # something like "Larry Curie"


Settings:

maxNumberResult: the highest number can be dropped in place of the {number} value. Defaults to 9999.
TitleCase: If true, each word in a generated name is capitalized. Defaults to true.

Documentation

The following pre-built sets of words are available for use:

{adjective}  1,338 descriptive words, include {colors}
{animal} 126 animal types
{color} 9 colors.
{consonant} 20 letters
{femaleFirstName} 3,973 usually-female first names across various cultures
{firstName}  7,488 first names, combines male and female sets.
{lastName} 21,985 last names across various cultures
{maleFirstName} 3,515 usually-male first names across various cultures
{noun} 1,004 nouns, including animal, place, plant, and thing lists.
{place} 49 place types
{plant} 58 plant types
{syllable} 101 random English syllables
{thing} 771 uncategorized nouns
{vowel} 6 letters (A,E,I,O,U,Y)

The following special tags are available:
{number} - create a number between 1 and NameGenerator.maxNumberResult.
{makeword} - Creates a randomized word, from randomly generated English-looking syllables. This does not use the {syllable} list!

Published 5 days ago
StatusReleased
CategoryAssets
AuthorCerol
TagsGodot, namegenerator, random

Download

Download
name_generator.gd 350 kB

Development log

Leave a comment

Log in with itch.io to leave a comment.