PenUltima Online

It is currently Tue Oct 07, 2008 6:15 pm

All times are UTC - 8 hours




Post new topic Reply to topic  [ 3 posts ] 
Author Message
 Post subject: NPC Name Generator
PostPosted: Thu Nov 09, 2006 9:25 am 
Offline

Joined: Wed May 10, 2006 5:15 pm
Posts: 113
I've gotten into the habit of altering every bit of code I touch, and when I came across the NPC packages, I decided that having a list of 3000+ names was more hassle than I care to deal with; so I wrote a small package to handle it for me.

There are two invocations of the system (which I'll go into later) but they all perform the same operations, with slightly different foci. After recieving their parameters, they read a config file to find:

  1. The nameset corresponding to the one passed to the script.
  2. The user-defined algorythms to form the name.


The algorythms can be very simple, if you wish to simply write a new command for every sound-set; or very complex if you wish to make use of the subcommands. Each command is seperated by a period (.)

I highly reccomend that you stay away from the subcommands. They can be used more-than-one at a time, but the wrong ordering or placement can yeild unexpected results.

The simplest command in the package is the "Escape" command. This works much like it does in POL or just about any programming language, but instead of just the letter after it, it interprets the entire command that follows as a literal. This way, a default can be put in:

Code:
   Formula   \Lizardman


This would simply yeild "Lizardman" as the result. If it were broken up into chunks, ( \Liz.\ard.\man ) it would still yeild the same result, because it's still a literal. This is pretty useless on its own, but can ease the process later.

A good example is a lizardman:
Code:
NameGen ConfigList
{
   ...
   CF   v,f,th,z,s,zh,sh,ck,x,h
   V   a,au,ae,e,ea,ee,ew,i,ie,o,oo,ou,u,ow
   VH   ai,i,oo,au
   ...
   Cu   c,ch,f,h,k,p,q,s,sh,t,th
   Vf   a,ae,ai,e,ee,ei,i,ea
   ...
}
NameGen lizardman
{
   ...
   Formula   VH[f].CF.CF[u].\s
   ...
}


First, the possibilities are mapped out:
Code:
   V:   {a,au,ae,e,ea,ee,ew,i,ie,o,oo,ou,u,ow}
   VH: {ai,i,oo,au}
   CF: {v,f,th,z,s,zh,sh,ck,x,h}


This would give unsatisfactory results by itself (Oockckoo doesn't sound very snake-like, now does it?)

So, the subcommand filters are applied:
Code:
   VH => {ai,i,oo,au}
   [f] => {a,ae,ai,e,ee,ei,i,ea}
   VH[f] => {ai,i}
   ...
   CF => {v,f,th,z,s,zh,sh,ck,x,h}
   [u] => {c,ch,f,h,k,p,q,s,sh,t,th}
   CF[u] => {f,th,s,sh,h}


This leaves us with the possibility of:
Code:
   {ai,i}   {v,f,th,z,s,zh,sh,ck,x,h}   {f,th,s,sh,h}   \s


This, alone, yeilds 100 unique names, similar in sound and structure to: Aisths. However, you still get "ck" and "x" in the list, so this is where "Replace" filters come in.

Code:
NameGen lizardman
{
   ...
   Replace   ck>h,x>h
}


Will replace "ck" and "x" with h. It could also be done as "ck>x,x>h". However, ck>x>h is invalid at this time.

Replace filters can be placed globally inside the main section, or specific in the name category where it would be applied to. In the case of a "Space", ^s is used instead, and replaced with a space just before the name is leaves the script.



The two easiest methods to invoke the package are:
Code:
NG_NameGen( [UObject] )
NG_NameGenerator( [UObject] , [Name Group] )


NG_NameGenerator is the more complex script. This is the script that does the bulk of the work for NameGenerator.ECL, and can be called by itself to perform similar functionality; the main difference being that NG_NameGenerator returns a string for the name, whereas NameGenerator.ecl simply names the UObject that is passed to it by using:
Code:
include ":nameGen:nameGen";

This should be the only file you require, since it includes all other .INC files in the package.

The other command, NG_NameGen(), is just a convenient way to call the main script. You pass it the object you want renamed, and the name-group to use; and the object is automatically given the name to match. Included in the command is an error-check, and a log-to-file, should a problem arise. Other than that, it is identical to "Start_Script".

A seer-command is also included in the package, .namegen [Name Group]. This command allows the seer to target an object, and give it a name abiding by [Name Group] algorythm.

I don't know how useful anyone else might find this, but I'm sure there's someone here who'd like to use it.


Attachments:
File comment: NameGen package.
nameGenerator.v1.0.zip [5.57 KiB]
Downloaded 58 times
Top
 Profile  
 
 Post subject:
PostPosted: Thu Nov 09, 2006 12:11 pm 
Offline

Joined: Thu Feb 02, 2006 1:41 pm
Posts: 1154
Location: Southern Central USA
Looks like you gave this some thought. It appears, from the snake example atleast, that you tried to give names based on our (man's) interpretation of what we believe the creatures speech abilities are rather than words we can produce with our speech structures. If that's true it would add more realism to the game. Even if it isn't we shouldn't assume that an ophidian would have a name that we can pronounce comfortably.

I'll look into using this in my shard. Thanks.

_________________
Sincerely,
Yukiko

I know you think you understand what you thought I said but what you heard is not exactly what I meant.

Titus 2:13


Top
 Profile  
 
 Post subject:
PostPosted: Thu Nov 09, 2006 1:10 pm 
Offline

Joined: Wed May 10, 2006 5:15 pm
Posts: 113
Something I forgot to note about the SubCommands:

[!X] does the opposite of [X] where X is any subcommand. So, rather than limiting the command to X, it expands it to all that aren't X.

If you find any bugs and/or fixes, I'll put them in and re-upload. Thanks for liking it enough to use it! ^.^


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC - 8 hours


Who is online

Users browsing this forum: No registered users and 0 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
Style based on FI Subice by phpBBservice.nl