View more

View more

View more

### Image of the Day Submit

IOTD | Top Screenshots

### The latest, straight to your Inbox.

Subscribe to GameDev.net Direct to receive the latest updates and exclusive content.

# Using Lisp (or another language) to generate fictional characters

Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

126 replies to this topic

### #1bishop_pass  Members

Posted 03 October 2003 - 05:07 PM

Let's imagine, for the sake of exercising our brains, the way that we could code a program where its purpose is to create a dossier on a fictional character. Essentially, it is the program's task to contrive, imagine, and flesh out a character and a little bit of his history. I'll lay out some basic ideas. In my example, I'll assume that depth is more important than breadth with regard to the program's abilities, therefore, in my example, I'll restrict the domain to a particular region and period. If you wish to elaborate on this whole idea, then explore the idea how you might. For my example, let's assume that domain is the Old West. The first thing we want is a name. Since I'm not up on Native American culture, I'll limit my program to having knowledge of European and Hispanic names. So, we'd provide a database of names. We might create a list of lists like this: ((Smith English) (Sanchez Hispanic) (Bierstadt German) ...) and so on. And for first names, we might create a list like this: ((John English Male Johnny) (Carlos Hispanic Male) (Mary English Female) ...) and so on. Now, first the program decides on an ethnic background and gender, and then proceeds to find a suitable surname, first name, middle name, etc. Notice that a provision can be made for marriages between individuals of different ethnic backgrounds, allowing for leeway in the choosing of first names. From here, the program can recursively create parents of the individual, receving information regarding the birthdate, the surname, etc. Speaking of birthdates, the program will choose a birthdate and age for the character. Also, the program can decide if the character is an orphan or not, and if so, create a guardian who raised the character, or an institution, such as an orphanage, school, etc. After that, the program can create a medical history for the character, based upon any knowledge the program has on common ailments, etc. If there exists knowledge about any disfiguring attributes of any diseases, then such characteristics can be created for the character, such as a limp, etc. Then come accidents. If there were any accidents which caused permananet scarring or some other such maladies, these are recorded. Again, note that such embellishments of character require knowledge with respect to the event. As an example, we might have a list which lists things such as muggings or carriage driving accidents, and the possible resulting wounds which might have happened. Note that we not only create a physical description of the character, but a history which explains how such physical traits were acquired. I'll leave it at that, but obviously there is more to say... [edited by - bishop_pass on October 3, 2003 12:09:49 AM]

### #2mtw  Members

Posted 03 October 2003 - 05:32 PM

So would this character generator be most useful for something like a computer game, or do you have something else in mind?

### #3Tron3k  Members

Posted 03 October 2003 - 05:58 PM

I think that in order to generate each character''s life story, you would have to take into account all the other characters'' life stories. Basically, you would have to evolve all the life stories together. That would be quite an interesting project - something like The Sims except more global in nature.

### #4Xtremehobo  Members

Posted 03 October 2003 - 06:00 PM

This is an interesting idea. I''ve got nothing better to do, so I might as well get to work on this

I don''t know Lisp and I''m not really up to learning it, but I''ll give it a try in c++.

### #5bishop_pass  Members

Posted 04 October 2003 - 04:55 PM

quote:
Original post by Tron3k
I think that in order to generate each character''s life story, you would have to take into account all the other characters'' life stories. Basically, you would have to evolve all the life stories together. That would be quite an interesting project - something like The Sims except more global in nature.
I don''t think it''s necessary to do such a thing, unless you''ve defined a set of criteria requiring just that. I would consider it a sufficient problem to tackle it as I originally put forth, whatever the context might be, and whatever depth and breadth you wish to add to the domain.

### #6bishop_pass  Members

Posted 04 October 2003 - 04:57 PM

quote:
Original post by Xtremehobo
I don''t know Lisp and I''m not really up to learning it, but I''ll give it a try in c++.
Hmmm. I''d like to point out that Lisp is better suited to focusing on the problem at hand - that is to say, the actual domain knowledge, rather than a language like C++, where you''d have to spend time developing the infrastructure for such domains before actually tackling the domain knowledge itself.

Posted 04 October 2003 - 05:02 PM

But all you are left with is the equivalent of an RPG hero with generated statistics and some kind of physical description. You still don''t have a REAL character with personality, attitudes, vices, fears, goals, dreams, etc.

I guess you could just take the same approach even farther to get all this, but all you''ll still have is just a character with a bunch of flags set. Then again, I guess technically that''s all we are.

### #8bishop_pass  Members

Posted 04 October 2003 - 05:06 PM

quote:
But all you are left with is the equivalent of an RPG hero with generated statistics and some kind of physical description.
I don't even recall focusing on a physical description or statistics. I think I was more focused on a history for the character.
quote:

You still don't have a REAL character with personality, attitudes, vices, fears, goals, dreams, etc.
I thought that was more the direction that I was taking.

[edited by - bishop_pass on October 4, 2003 12:06:26 AM]

### #9Naaga  Members

Posted 04 October 2003 - 05:08 PM

Do you have any ideas on giving the characters personalities? I think this is an important aspect because it can affect different traits that a person can have. Someone who loves excitiment and adventure might be more likely to have one of those accidents that lead to disabling diseases.

Posted 04 October 2003 - 05:18 PM

It sounded to me sort of like a character would look something like this (btw, I don't know Lisp (which may have something to do with me not understanding), so this is pseudo C):
injury i0i0.date_received = 20031004i0.type = LIMPi0.bitterness_weight = 3.5i0.depression_weight = 1.2i0.happiness_weight = -0.2character.injuries[0] = i0character.eye_color = "blue"character.hair_color = "brown"character.outgoing = 3.0character.neatness = -3.0character.friendliness = 0.8

Something like this.

Edit: syntax error in my pseudo code!

[edited by - BradDaBug on October 4, 2003 12:19:04 AM]

### #11bishop_pass  Members

Posted 04 October 2003 - 05:30 PM

Well, I'd have to say that a stat describing a character's depression is pretty dull. Wouldn't it be more interesting if the program spit out a transcript describing him?

Bill 'Billy' Thomas was born in Laredo, Texas on March 14th, 1866. His father was Albert Thomas, his mother Lucille Brown. They were married in 1863.Billy despised his father, who was an alcoholic, and he left home on April 10th, 1877, at the age of 15. A year later, he settled in Williams, Arizona. He found employment as an apprentice to a blacksmith.

So, to reproduce that, you might want to focus on encoding knowledge of such concepts as names, first and last, male and female, marriage, leaving home, drinking, towns, professions, etc.

No need to get too in depth - just focus on giving enough rules to fabricate characters.

The purpose of such a program isn't nearly as important as the purpose of creating it. It's the act of creation which can inspire and create a purpose.

[edited by - bishop_pass on October 4, 2003 12:36:35 AM]

### #12Naaga  Members

Posted 04 October 2003 - 05:44 PM

I think something like BradDaBug suggested is necessary to get the type of output you''re looking for, bishop_pass. The program would need to know that Billy hates his father and why in order to generate something like this:

Six years later, Billy returned home to find that his father had mended his ways and sobered up. He was hesitant at first, but after a while Billy realized that his father really had changed, and then he joyfully welcomed his father back into his life.

### #13bishop_pass  Members

Posted 04 October 2003 - 05:48 PM

quote:
Original post by Naaga
I think something like BradDaBug suggested is necessary to get the type of output you''re looking for, bishop_pass.
Sorry, but you''re wrong. Knowledge encoding does not need a list of silly stats, with shades of an RPG.

### #14bishop_pass  Members

Posted 04 October 2003 - 05:51 PM

quote:
Original post by Naaga
Six years later, Billy returned home to find that his father had mended his ways and sobered up. He was hesitant at first, but after a while Billy realized that his father really had changed, and then he joyfully welcomed his father back into his life.
And furthermore, I don't think for a minute that any program created by anyone here is going to come up with that (the above quote). It's just too much. Unfortunately, by proposing such a thing, you're making the whole idea seem more intractable.

However, if you delve a little deeper into symbolic programming and knowledge bases, and look for templates in fiction, you can see that simple biographies within limited domains are possible, and can be fun and tractable.

[edited by - bishop_pass on October 4, 2003 12:52:41 AM]

### #15bishop_pass  Members

Posted 05 October 2003 - 01:58 PM

The point here is that when you decide to fabricate a story or history, you don''t create a list of stats. There''s no need for such methods in a program designed to do the same.

### #16Forcas  Members

Posted 05 October 2003 - 02:25 PM

I don't claim to be an expert on LISP. I've only recently started learning. I curious, though, instead of representing a person using a list, why don't you define a class?

Also, how would you go about generating a description if you don't have any statistics to base it off of?

[edited by - Forcas on October 5, 2003 9:26:09 PM]

### #17bishop_pass  Members

Posted 05 October 2003 - 02:32 PM

quote:
Original post by Forcas
I don''t claim to be an expert on LISP. I''ve only recently started learning. I curious, though, instead of representing a person using a list, why don''t you define a class?
Why? I don''t see the point. First of all, we''re talking about the history of a person. I personally don''t think the constrained notion of a class comes close to the flexibility of s-expressions for storing knowledge about a history/story.
quote:

Also, how would you go about generating a description if you don''t have any statistics to base it off of?

You''re thinking is truly stuck within a very constrained programming methodology. Make up a person''s history in your mind. Now, did you use a list of statistics?

### #18DakeDesu  Members

Posted 05 October 2003 - 03:08 PM

I am going to have to agree with Bishop Pass here on this one. Stats mean nothing in this sort of project.

I did an extremely watered down sort of thing that Bishop Pass is suggesting, you can find the PHP Source on the Evil Twin (just note that the Demo link is not working).

### #19bishop_pass  Members

Posted 05 October 2003 - 03:19 PM

In the example I created above, we see that Billy left home because his father was an alcoholic. I made that story up in my head based on knowledge I have, for example, I know that family troubles, abusive fathers, etc. are reasons that one would leave home.

It stands to reason that in describing a person''s history, one of the things that they almost universally do is leave home at some point or another. Given that, we draw on our knowledge of reasons why someone might leave home.

So, our program should have some knowledge of reasons why people leave home. In a quick and dirty way, (by no means comprehensive) we might encode it like this:
(LeavingHome Reasons (IsA Father Alcoholic) (Died Parents) (Desired Protaganist SeeTheWorld) (Offered Protagonist Job) (Attended Protaginist College))

Each of those examples are of course rough and dirty with regard to implementation, but you get the idea. Appended to each reason should be a name of the reason, where another list can contain other information about the event, such as how to write it out, what dependencies it might have, and what things it can lead to cause in the future.

### #20bishop_pass  Members

Posted 06 October 2003 - 04:00 PM

Well, all I can say, is that it appears that if many of you can''t use a list of RPG stats, suddenly your thought processes have stopped dead in their tracks.

Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.