[FREQ] DonJon Name Generator Function

If you have an idea for a new feature, please discuss it in the main MapTool forum first, then post a summary of the discussion here. Use the first Sticky as a template.

Moderators: dorpond, trevor, Azhrei, giliath, jay, Mr.Ice

User avatar
Full Bleed
Demigod
Posts: 4736
Joined: Sun Feb 25, 2007 11:53 am
Location: FL

[FREQ] DonJon Name Generator Function

Post by Full Bleed »

DonJon has a public domain java script name generator available that uses MarKov Chains (https://donjon.bin.sh/code/name/).

It would be pretty sweet if we could use it to generate easy, contextualized random names inside MT.

A basic function like this that would spit out a random name using a custom list would be really useful:

nameGen(Name List)
Maptool is the Millennium Falcon of VTT's -- "She may not look like much, but she's got it where it counts."


Phergus
Deity
Posts: 7132
Joined: Fri May 12, 2006 8:56 pm
Location: Middle of Nowhere, NM
Contact:

Re: [FREQ] DonJon Name Generator Function

Post by Phergus »

I would think that you could use the code in a dialog5() or frame5().

User avatar
Full Bleed
Demigod
Posts: 4736
Joined: Sun Feb 25, 2007 11:53 am
Location: FL

Re: [FREQ] DonJon Name Generator Function

Post by Full Bleed »

Phergus wrote:
Mon Jul 20, 2020 12:14 pm
I would think that you could use the code in a dialog5() or frame5().
I tried. But I don't think I understand what the syntax needs to look like.

Maybe if someone who does know puts it together it would make for some good sample code on the wiki since there isn't really anything on the subject right now.
Maptool is the Millennium Falcon of VTT's -- "She may not look like much, but she's got it where it counts."

Phergus
Deity
Posts: 7132
Joined: Fri May 12, 2006 8:56 pm
Location: Middle of Nowhere, NM
Contact:

Re: [FREQ] DonJon Name Generator Function

Post by Phergus »

I tried. But I don't think I understand what the syntax needs to look like.
I definitely don't. Someone that knows about javascript/HTML5 stuff can probably figure out however.

User avatar
wolph42
Winter Wolph
Posts: 9999
Joined: Fri Mar 20, 2009 5:40 am
Location: Netherlands
Contact:

Re: [FREQ] DonJon Name Generator Function

Post by wolph42 »

i had some work decoding it and will need to some work understanding it, but here's a script with three name databases for the markov chains that are used to generate. First is eqyptian, second is male dutch names and third female dutch names. The attached file uses the latter.
name 2.zip
(8.44 KiB) Downloaded 51 times
you can just run this in a web browser (i used chrome) to test.

User avatar
Full Bleed
Demigod
Posts: 4736
Joined: Sun Feb 25, 2007 11:53 am
Location: FL

Re: [FREQ] DonJon Name Generator Function

Post by Full Bleed »

wolph42 wrote:
Tue Jul 21, 2020 6:55 pm
i had some work decoding it and will need to some work understanding it, but here's a script with three name databases for the markov chains that are used to generate. First is eqyptian, second is male dutch names and third female dutch names. The attached file uses the latter. name 2.zip

you can just run this in a web browser (i used chrome) to test.
I've worked out how to use the html they provided to create custom HTML like you have, but what I don't know how to do is use the included JS inside MT so that I can build my name databases and generate random names on the fly there.

What I've done so far:

1) Created a Token Type called "NameGen." It houses lists of names for various culture types in properties. For starters it includes all of the language/culture types that DonJon uses.

Code: Select all

[h: commonFantasyList = "Human, Dwarvish, Elvish, Halfling"]

[h: fantasyList = "Draconic, Drow, Orcish, Clestial, Fiendish, Modron, AirElemental, EarthElemental, FireElemental, WaterElemental"]

[h: ancientWorldList = "Babylonian, Celtic, Egyptian, Greek, Roman, Sumerian"]

[h: medievalList = "English, French, German, Italian, Norse, Saxon, Slavic, Spanish"]

[h: asianList = "Arabic, Chinese, Hebrew, Hindu, Japanese, Mongolian, Persian"]

[h: africanList = "Congolese, Ethiopian, Malian"]

[h: newWorldList = "Algonquin, Aztec, Inkan, Inuit, Navajo, Sioux"]
If a culture type has a male and female option I created two properties (i.e. CelticMale and CelticFemale).

2) I then created an input macro ("Add New Names") to more easily enter new randomly generated names from the DonJon site generator. Unfortunately, I can only generate 10 names each time so it's unnecessarily time consuming creating lists of 100-200 names ahead of time (though I can easily enter them into my MT db now.) The benefit of using custom HTML like you did is that you can do hundreds at a time. But you need good lists to work with and DonJon doesn't show us the lists it's using.

3) And I have a "Gen Random Name" macro that allows me to select the culture/sex (and whether I want to use a True name list if it exists) and pulls from the previously randomly generated names and applies them to selected tokens.


Thus, after generating a few hundred of each type I'll have a limited database to pull from... but I'm not actually generating any new names in MT. So it's a finite db reliant on me generating names outside MT (at various sites)... though I have accounted for the possibility that we will get native MT support for the DonJon random name generator JS and then I'll be able to use the built in "True" lists to generate names on-the-fly (and append them to what would be a growing internal DB of previously generated names that I think are good enough to keep using.)


I don't have an entry for Dutch names yet... but I will take them from the HTML you included and add them. ;) How do you think I should categorize them? Should it go under a Modern European category?
Maptool is the Millennium Falcon of VTT's -- "She may not look like much, but she's got it where it counts."

User avatar
wolph42
Winter Wolph
Posts: 9999
Joined: Fri Mar 20, 2009 5:40 am
Location: Netherlands
Contact:

Re: [FREQ] DonJon Name Generator Function

Post by wolph42 »

The Dutch names are modern european names, and they're 'actual' Dutch names in use, not 'historical correct dutch names', so I would expect a strong mix of other languages through that list, with names like Owen, Amber, John etc. The drawback so far of the markov chain generator is that although its fun to use and you get more or less the 'feel' of Dutch names they really dont make sense, some do a bit. So my conclusion is that for 'real' names your better of with a DB and just randomly pick, while for fantasy names (or names most of us can't pronounce) you can safely get away with markov chains.

as for use in MT, you'll have to do use it through a frame5 form in order to use the js. Ive understood that the devs are working on a 'standalone' implementation of js as well, as I would like to use it for the more hefty calculations, like this.

Although I guess that you could use MT to generate json objects of 3 or 4 tuplets chains of all databases and then use MT script again to randomly cretae a name based on the json construct.

There are roughly two methods I currently envision:

every unique 3 letter combo you find you create a json key for, and then simply add a list of ALL 3 letter combo that follows on that (so you will have duplicates).
OR
same thing but count the duplicates and keep track of those in a key:value pair.

I think the first method is way more efficient and most likely in a limited set also less spacey.

e.g, lets sasy the database is: "owen, wendy, gwenevyr"
you get the following keys:

Code: Select all

owe: (wen)
wen: (., end,ene)
end:(ndy)
ndy:(.)
gwe:(wen)
ene:(nev)
nev:(evy)
eny:(vyr)
START:(owe, wen, gwe)
where . is 'end of string'
given any tuplet you can randomly pick is successor from its corresponding list, until you hit a .

Doesnt sound too heavy on MT.

edit: looking at this I guess that just storing the next letter in the list is actually enough as you can construct the next tuplet from what you have. So e.g. 'wen' can be simply stored as: wen:{., d, e}

User avatar
wolph42
Winter Wolph
Posts: 9999
Joined: Fri Mar 20, 2009 5:40 am
Location: Netherlands
Contact:

Re: [FREQ] DonJon Name Generator Function

Post by wolph42 »

ok that was easy and it works WAY better then the js version. The names are much more realistic.

Anyhoot:https://www.dropbox.com/s/lfw358l0tgibg ... cmpgn?dl=1 if you want to check it out
(generate chain macro, the analyze builds the construct, but that has been done.)

User avatar
Full Bleed
Demigod
Posts: 4736
Joined: Sun Feb 25, 2007 11:53 am
Location: FL

Re: [FREQ] DonJon Name Generator Function

Post by Full Bleed »

wolph42 wrote:
Wed Jul 22, 2020 9:06 am
ok that was easy and it works WAY better then the js version. The names are much more realistic.

Anyhoot:https://www.dropbox.com/s/lfw358l0tgibg ... cmpgn?dl=1 if you want to check it out
(generate chain macro, the analyze builds the construct, but that has been done.)
In your Analyze Chain macro you have "src_namesNL_S" and "src_namesNL_M" lists. But when I run that macro I get a prompt for src_namesNL. If I ignore the included lists and assign a list to src_namesNL I do get new nameObject and startObject data. Are the nameObjectS and startObjectS properties to be used for something?

I tested with some true historical Ancient Sumerian names (males) and the results look pretty good to me (not that I'd know if I was naming someone something absurd like "Cricket Scrotum.") :shock:

Here are the Sumerian names if you're interested:
Spoiler
Akalamdug, Eannatum, Ekur, Enmebaragisi, Mesanepada, Meskalamdug, Shulgi, Nammu, Alulim, Alalngar, Dumuzid, Ubara, Jushur, Nangishlishma, Babum, Puannum, Kalibum, Kalumum, Zuqaqip, Atab, Mashda, Arwium, Etana, Balih, Kish, Zamug, Tizqar, Ilku, Iltasadum, Aga, Gasher, Enmerkar, Lugalbanda, Dumuzid, Gilgamesh, Nungal, Kalama, Kitun, Pada, Elulu, Balulu, Susuda, Dadasig, Mamagal, Kalbum, Tuge, Nuna, Ishtar, Lugalngu, Hadanish, Dudu, Lugal, Argandea, Nanni, Mundu, Anbu, Anba, Bazi, Zizi, Limer, Sharrum, Kubaba, Unzi, Undalulu, Urur, Ishu, Puzur, Zababa, Suen, Zimudar, Eshtar, Shamash, Nanniya, Urukagina, Sargon, Rimush, Manishtushu, Naram, Irgigi, Imi, Nanum, Ilulu, Durul, Ningin, Kuda, Sarlagab, Zarlagab, Shulme, Yarlagash, Silulu, Silulumes, Elulmes, Inimabakes, Duga, Igesaus, Yarlagab, Ibate, Yarla, Yarlangab, Kurum, Apilkin, Irarum, Ibranum, Hablum, Yarlaganda, Tirigan, Shulgi, Suena, Erra, Ilishu, Dagan, Ninurta, Zambiya, Magir
I removed all of the hyphenated elements of those names because I wasn't sure how the randomizer would respond. How will your method handle them? There are a bunch of two letter hyphenated bits in true Sumerian names... Here is where I got most of those names: https://en.wikipedia.org/wiki/Sumerian_King_List
Maptool is the Millennium Falcon of VTT's -- "She may not look like much, but she's got it where it counts."

User avatar
wolph42
Winter Wolph
Posts: 9999
Joined: Fri Mar 20, 2009 5:40 am
Location: Netherlands
Contact:

Re: [FREQ] DonJon Name Generator Function

Post by wolph42 »

the link i gave you was an active file, so depending on the time you donwloaded it its fairly possible that i was editing it and saved it ever so often. Can you provide me with the list of names WITH the hyphenation, 'my' method should deal with those correctly as it works on basis of tuplets (bits) of 3 so IF no name every starts nor ends with hyphen (which I presume to be the case) then the hyphen will show up in the middle and they *should* end up (at least in most of the cases) in a logical place as this is inherent to the method.

Where things get a bit shaky is whith double vowels with the meaning of one. Iike in the words 'double' and 'meaning', although most names I saw so far went good.

here's a link to a stable version:
https://www.dropbox.com/s/u818ui5oe7ky9 ... cmpgn?dl=1

note, all analyzations have been done, should you consider redoing the 'female' group....thats quite a bit of coffee I could drink while it was ploughing through the 5000!! names.

User avatar
Full Bleed
Demigod
Posts: 4736
Joined: Sun Feb 25, 2007 11:53 am
Location: FL

Re: [FREQ] DonJon Name Generator Function

Post by Full Bleed »

wolph42 wrote:
Thu Jul 23, 2020 9:24 am
Can you provide me with the list of names WITH the hyphenation, 'my' method should deal with those correctly as it works on basis of tuplets (bits) of 3 so IF no name every starts nor ends with hyphen (which I presume to be the case) then the hyphen will show up in the middle and they *should* end up (at least in most of the cases) in a logical place as this is inherent to the method.
Some of these names have 3 hyphens. ;)
Spoiler
Aanepada, Akalamdug, Amar-Sin, Eannatum, Ekur, Enmebaragisi, Ishme-Dagan, Mesanepada, Meskalamdug, Naram-Sin, Shulgi, Ur-Nammu, Alulim, Alalngar, En-men-lu-ana, En-men-gal-ana, Dumuzid, En-sipad-zid-ana, En-men-dur-ana, Ubara-Tutu, Jushur, Kullassina-bel, Nangishlishma, En-tarah-ana, Babum, Puannum, Kalibum, Kalumum, Zuqaqip, Atab, Mashda, Arwium, Etana, Balih, En-me-nuna, Melem-Kish, Barsal-nuna, Zamug, Tizqar, Ilku, Iltasadum, En-me-barage-si, Aga, Mesh-ki-ang-gasher, Enmerkar, Lugalbanda, Dumuzid, Dumuzi, Gilgamesh, Ur-Nungal, Udul-kalama, En-nun-tarah-ana, Mesh-he, Melem-ana, Lugal-kitun, Mesh-Ane-pada, Mesh-ki-ang-Nuna, Elulu, Balulu, Susuda, Dadasig, Mamagal, Kalbum, Tuge, Men-nuna, Enbi-Ishtar, Lugalngu, Hadanish, En-shag-kush-ana, Lugal-kinishe-dudu, Lugal-ure, Argandea, Nanni, Mesh-ki-ang-Nanna, Lugal-Ane-mundu, Anbu, Anba, Bazi, Zizi, Limer, Sharrum-iter, Kubaba, Unzi, Undalulu, Urur, Puzur-Nirah, Ishu-Il, Shu-Suen, Puzur-Suen, Kug-Bau, Zimudar, Usi-watar, Eshtar-muti, Ishme-Shamash, Shu-ilishu, Nanniya, Urukagina, Lugal-zage-si, Sargon, Ur-Zababa, Rimush, Manishtushu, Naram-Sin, Shar-kali-sharri, Irgigi, Imi, Nanum, Ilulu, Shu-Durul, Ur-ningin, Ur-gigir, Kuda, Puzur-ili, Ur-Utu, Lugal-melem, Sarlagab, Zarlagab, Shulme, Yarlagash, Silulu, Silulumes, Elulmes, Inimabakes, Igesaus, Yarlagab, Ibate, Silulu, Duga, Ilu-An, Yarla, Yarlangab, Kurum, Apilkin, La-erabum, Irarum, Ibranum, Hablum, Puzur-Suen, Yarlaganda, Tirigan, Utu-hengal, Ur-Namma, Shulgi, Amar-Suena, Shu-Suen, Ibbi-Suen, Ishbi-Erra, Shu-Ilishu, Iddin-Dagan, Ishme-Dagan, Lipit-Eshtar, Ur-Ninurta, Bur-Suen, Lipit-Enlil, Erra-imitti, Enlil-bani, Zambiya, Iter-pisha, Ur-du-kuga, Suen-magir, Damiq-ilishu
How about special characters (like umlauts and accents)? I've avoid using those in token names in the past.

And I suspect that names with apostrophes would be a be a bad idea...
Maptool is the Millennium Falcon of VTT's -- "She may not look like much, but she's got it where it counts."

User avatar
wolph42
Winter Wolph
Posts: 9999
Joined: Fri Mar 20, 2009 5:40 am
Location: Netherlands
Contact:

Re: [FREQ] DonJon Name Generator Function

Post by wolph42 »

ive removed all special character, MT chokes on those.

its interesting that even with a massive DB like the female names, the generation is still fairly swift (a bit less than a second on my old laptop)

User avatar
wolph42
Winter Wolph
Posts: 9999
Joined: Fri Mar 20, 2009 5:40 am
Location: Netherlands
Contact:

Re: [FREQ] DonJon Name Generator Function

Post by wolph42 »

first generation:

Amar-Suen-nuna
Usi-watar-Suen
Ishme-bani
En-men-dur-Suena
Lugal
En-men-nuna
Yarlangab
Kalbum
Eshtaram-Sin
Etana

one thing i haven't realy experimented with but mostly likely will have an ineresting impact, is the tSize. This is now set to 3 which means that the next letter is based on the last 3 letters of the string so far, changing that to 2 or 4 or even 1 and 5 will have an impact I just dont know what.

Note that you need to both:
- analyze and generate with the same tSize !!

User avatar
wolph42
Winter Wolph
Posts: 9999
Joined: Fri Mar 20, 2009 5:40 am
Location: Netherlands
Contact:

Re: [FREQ] DonJon Name Generator Function

Post by wolph42 »

its interesting btw to check out the created database e.g.:

Code: Select all

"en-":["n-l","n-g","n-d","n-n","n-m"],
"n-l":["-lu"],
"-lu":["lu-"],
"lu-":["u-a","u-A"],
"u-a":["-an"],
"-an":["ana","ana","ana","ana","ana","ang","ana","ana","ang","ana","ang"],
"ana":[".",".",".",".",".",".",".",".","."],
"n-g":["-ga"],
couple of things to optimize:
- you can only store the last character of the next tuplet (as the rest is known)
- you can cycle through the entire database and for each tuplet do a 'json.unique()' if the length of the outcome is 1 (e.g. for the case of 'ana', which apparently is something quite a few names end with, whether you randomly pick from ". . . . . ." or randomly pick from "." will generate the exact same result.
- you could even consider doing a further optimization in case of json.unique != 1, which is whether the unique values are all represented in the same amount in which case you can do the same (again: "112233" and "123" will yield the exact same result when you randomly pick from them)
- and finally you could consider to find the common demeaner amongst the number of present strings and divide by that... e.g. "11112233" is the same as "1123".

Post Reply

Return to “Feature Requests”