Archived

This topic is now archived and is closed to further replies.

Using Lisp (or another language) to generate fictional characters

This topic is 5143 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

Recommended Posts

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]

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

Share on other sites
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.

Share on other sites
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++.

Share on other sites
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.

Share on other sites
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.

Share on other sites
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.

Share on other sites
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]

Share on other sites
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.

Share on other sites
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]

Share on other sites
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]

Share on other sites
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.

Share on other sites
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.

Share on other sites
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]

Share on other sites
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.

Share on other sites
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]

Share on other sites
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?

Share on other sites
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).

Share on other sites
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.

Share on other sites
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.

Share on other sites
quote:
Original post by bishop_pass
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.

I can see what you''re saying, and I feel like I''m standing just outside of fully grasping the first step in the right direction but in the meantime I''ll stick with my Lisp books. (Which my school has a whole 14 of)

[paralogist] [Lisp is King] [Support Codesprout]
Part of the Lisp revolution since 03.30.03

Share on other sites
We might create a history as a sequence of events, each with a symbol name for the title of the event, a date, a reason, etc.

This sequence is in a list.

We might have a template for each possible event, giving the required semantics, and whether it is required or not:

((Name First Last Middle Required)(Born Month Day Year City State Required)(Father First Last Middle Required)(Mother First Maiden Middle Required)(LeftHome Month Day Year Reason Optional)(MovedTo Month Day Year City State Optional)(Employed Employer Month Day Year Occupation Optional))

((William Johnson Bernard)(Born November 3 1864 Jackson Wyoming)(Father Francis Johnson)(Mother Lucille Smith)(MovedTo July 10 1870 Cheyenne Wyoming))

And we might have for each semantic slot, a list of possible entries. A more complex and robust version would have constraints for each entry, maintaining dependencies.

(Month(January February March April May June July August September October November December))

[edited by - bishop_pass on October 6, 2003 12:00:54 AM]

Share on other sites
While stats are by no means necessary, we need to think of a method to achieve a description of the character''s personality in some way. After all, a person''s life history is shaped by his/her actions, which depend on his/her emotions, personality, bringing up, etc. This system must have some random element in it, since we are simply creating a single stand-alone story. Perhaps one way to do this would be to have a probability matrix, where each event influences the probability of another event happening down the line. For example, a "death in the family" event could increase the chance of a "suicide", "homicide", or "drop out of school" event. Again, perhaps I''m thinking too mathematically. Any ideas?

Share on other sites
Yeah, you are thinking too mathematically. Think like you think, not like you think your computer thinks. What do you do when you think up a story?

Chances are, you have a set of defined slots or roles to be filled, and you pluck from your mind plausible fillers for those roles (as I outlined in my prior post) and you base your choices on maintaining dependencies and satisfying constraints, often selecting one item over another because one thing fits better than other, which is based on knowledge, not a number.

I'm going to suggest again that you forget about stats and numbers.

[edited by - bishop_pass on October 6, 2003 12:24:11 AM]

Share on other sites
Yes, I had the feeling that my idea was flawed.

I like the idea of having pre-defined archetypes, as you say. Perhaps you could have two separate systems, one for creating the personality sketch based on the archetype, and the other for generating plausible archetypes. The second would probably be more difficult. Or do we really need more than the basic set?

Perhaps they could be divided into Heroes, Villains, and Side Characters, making it something like a novel.