What I do is have patterns like "consonant, vowel, consonant, vowel"
and plug in values from lists of consonants and vowels. Obviously it
could go a lot farther, but this way is easy and always produces
something at least marginally pronounceable.
I just use it to generate a couple of things like random quest
objects. Sometimes it comes up with pretty comedic names. The best
was probably an object named "the unholy staff of Penis".
char *rand_proper()
{
static char buf[127];
char *p;
static char *vowels[] =
{
"a", "e", "i", "o", "u", "ae", "ou", "ia",
"ee", "ie", "y"
};
static char *consonants[] =
{
"b", "c", "d", "f", "g", "h", "j", "k",
"l", "m", "n", "p", "r", "s", "t", "v",
"z", "dr", "st", "sh", "ch", "gr", "gw", "br"
};
static char *patterns[] =
{
"cvc", "cvcv", "cvcvc", "cvcvcv"
};
buf[0] = '\0';
for (p = patterns[number_range(0, sizeof(patterns)/sizeof(char *))]; *p; p++)
{
if (*p == 'v') // random vowel
strcat(buf, vowels[number_range(0, sizeof(vowels)/sizeof(char *))]);
else if (*p == 'c') // random consonant
strcat(buf, consonants[number_range(0,
sizeof(consonants)/sizeof(char *))]);
}
buf[0] += 'A'-'a'; // capitalize first letter
return buf;
}
--Palrich.
On 12/2/05, Erir Stormgald <[EMAIL PROTECTED]> wrote:
> Ive been trying to write a name generator for a Rom24 mud for awhile and
> haven't had much success at it. And i'm wondering if anyone has any
> examples on how this can be accomplished.
> Any help would be great.
>
>
> Thx,
>
> Eric.
>
>
> --
> ROM mailing list
> [email protected]
> Unsubscribe here ->>> http://www.rom.org/cgi-bin/mailman/listinfo/rom
>
--
ROM mailing list
[email protected]
Unsubscribe here ->>> http://www.rom.org/cgi-bin/mailman/listinfo/rom