Randomly created planet (or place) names

Previous topic - Next topic

MrTAToad

If you need a routine to create randomly generated planet names or even place names, then this routine is for you!

Code (glbasic) Select
WHILE TRUE
SEEDRND GETTIMERALL()
DEBUG createName$()+"\n"
SLEEP 1
WEND

END

FUNCTION createName$:
LOCAL name1$[]; DIMDATA name1$[],"Al","Bes","Both","Cal","Cer","Ch","Cor","Dan","Day","Ea","En","Enc","Er","Eur","Gam","Gan","Io","Jup","Kash","Ma","Mand","Mer","Mo","Na","Nept","Plu","Qua","Qo","Re","Rh","Ro","Rom","Ry","Sat","Sern","Sull","Tant","Te","Tran","Umb","Ur","Tund","Varl","Ven","Xi","Ya"
LOCAL name2$[]; DIMDATA name2$[],"a","an","ar","boo","brill","brin","do","ea","ee","el","ela","es","go","id","is","li","nos","on","or","ou","pi","ri","rr","rs","si","ti","to","ul","us","urn","ust","yme"
LOCAL name3$[]; DIMDATA name3$[],"an","aan","aari","bah","cant","cury","dal","de","dor","dra","dus","el","ine","ion","ious","iter","lag","lia","lore","loth","mir","mus","ndi","oar","on","opa","pin","rth","sha","sto","une","us","vin","wui","yyyk"
LOCAL temp$

IF RND(100)>=50
temp$=ProcessVowel$(name1$[RND(BOUNDS(name1$[],0)-1)],name2$[RND(BOUNDS(name2$[],0)-1)])
IF RND(100)>=74
temp$=ProcessVowel$(temp$,name3$[RND(BOUNDS(name3$[],0)-1)])
ENDIF
ELSE
temp$=ProcessVowel$(name1$[RND(BOUNDS(name1$[],0)-1)],name3$[RND(BOUNDS(name3$[],0)-1)])
ENDIF

RETURN temp$
ENDFUNCTION

FUNCTION ProcessVowel$:name1$,name2$
LOCAL one1$,one2$

one1$=LCASE$(RIGHT$(name1$,1))
one2$=LCASE$(LEFT$(name2$,1))

IF (one1$="a" OR one1$="e" OR one1$="i" OR one1$="o" OR one1$="u") AND (one2$="a" OR one2$="e" OR one2$="i" OR one2$="o" OR one2$="u")
LOCAL r%

r%=RND(100)
IF r%<5
RETURN name1$+"'"+name2$
ELSEIF r%<10
RETURN name1$+"-"+name2$
ENDIF
ENDIF

RETURN name1$+name2$
ENDFUNCTION

Wampus

Oh, awesome. Everyone needs a random name generator in their lives (if not their games) =D

MrTAToad

#2
Certainly do!

A database for names can be download from http://www.opensourcecf.com/1/2009/05/10000-Random-Names-Database.cfm

fuzzy70

Think I have one from a "Game Programming Gems" book, based on the Elite one if I remember right  =D

Lee
"Why don't you just make ten louder and make ten be the top number and make that a little louder?"
- "These go to eleven."

This Is Spinal Tap (1984)

erico

love for all random generators! :-*

fuzzy70

I do as well. The article in the book I mentioned was fascinating from the point of view on how they managed to create a near endless list of names on a machine that had 16kb of ram at the time & still have memory left for the game itself  =D

Lee
"Why don't you just make ten louder and make ten be the top number and make that a little louder?"
- "These go to eleven."

This Is Spinal Tap (1984)

Ian Price

Is that based on the routine that Braben and Bell used for Elite? I read a piece on that years ago - apparently it was a really small piece of code and generated an infinite variety of names (including some naughty ones). Elite does still contain some those, but the bigger swears were altered or  pushed into the deepest darkest areas of the universes that nobody could reach in a lifetime.

Anyway, nice one :)
I came. I saw. I played.