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

### #21kordova  Members

Posted 06 October 2003 - 04:43 PM

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

### #22bishop_pass  Members

Posted 06 October 2003 - 04:59 PM

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]

### #23Tron3k  Members

Posted 06 October 2003 - 05:07 PM

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?

### #24bishop_pass  Members

Posted 06 October 2003 - 05:11 PM

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]

### #25Tron3k  Members

Posted 06 October 2003 - 05:32 PM

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.

### #26bishop_pass  Members

Posted 07 October 2003 - 04:08 PM

quote:
Original post by Tron3k
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.
Now you''re talking about characters'' histories entwined with each other - an altogether more difficult task.

### #27bishop_pass  Members

Posted 08 October 2003 - 04:07 PM

*sigh*

If I had my other machine in operation (the one with Lisp and other development tools installed on it) I''d work on this as a sideline project, just for the heck of it. But alas, that isn''t the case, so I thought it''d be interesting if someone else was just a smidgeon inspired to try something like this.

### #28kordova  Members

Posted 31 October 2003 - 04:56 AM

Has anyone gone anywhere with this thread? I've just begun to put some of my thoughts into code, albeit hideous at that. Though it won't exactly be beautiful, exactly what is called for or very clean I'll put it up in the hopes it revives this thread a bit. At least it'll be something!

Right now what I'm working with is pretty simple and straightforward, though I am beginning to see the ease with which it may be extended later on.

The entire process begins with a randomly selected (ethnicity last_name) set. Then are selected the mother and fathers (gender ethnicity first_name), with the father's ethnicity matching that of the orignal last_name set. I've toyed with have other attributes here, such as (gender ethnicity first_name attributes) where attributes might be occupation, whether the parent was an alcoholic as was mentioned, deceased etc. This part I'm leaving out until I have a better feel as to whether my initial design holds up or if I'll need to heavily redo (as I suspect). From here I determine the characters gender, ethnicity (based upon parents) and first name.

I haven't quite solidified the next part but what I just pumped out is when and why the main character left his home (which may tie into the parents "attributes" or what have you later on.

The more shady part that I've only scribbled so far is her present condition which includes but is not limited to the state, local geography and current occupation. As to whether or not this will include recent noteworthy events I'm not yet ready to take a definitive stance.

/ramble

Cheers.

(Edit: and it might do this thread some justice to move it somewhere other than the lounge, though that's most likely where 70+% of the sites activity can be found.)

[edited by - kordova on October 31, 2003 12:10:29 PM]

### #29DakeDesu  Members

Posted 31 October 2003 - 05:02 AM

I would try it, but I do not know Lisp well enough to try--and no, I cannot buy books, I am broke until December comes up, and then I will be broke again (otherwise, I would be more inclined).

### #30kordova  Members

Posted 31 October 2003 - 05:15 AM

quote:
Original post by DakeDesu
I would try it, but I do not know Lisp well enough to try--and no, I cannot buy books, I am broke until December comes up, and then I will be broke again (otherwise, I would be more inclined).

I consider myself pretty terrible with Lisp at this point. I''m still willing to try.

### #31Zul  Members

Posted 31 October 2003 - 05:22 AM

I'm willing to give it a shot, but I'm going to ramp up on my Lisp skills. Haven't programmed in it since university (about 3 years ago).

For those of you wanting to learn, ANSI common lisp by Graham is what I learned from, and is a terrific book. I still have it somewhere in my room. *reminds himself to go look for it when he gets home*

[edited by - Zul on October 31, 2003 12:25:52 PM]

### #32DakeDesu  Members

Posted 31 October 2003 - 05:26 AM

quote:
Original post by kordova
quote:
Original post by DakeDesu
I would try it, but I do not know Lisp well enough to try--and no, I cannot buy books, I am broke until December comes up, and then I will be broke again (otherwise, I would be more inclined).

I consider myself pretty terrible with Lisp at this point. I''m still willing to try.

Yeah, I seen a bunch of links myself--but I''ve never wrapped my mind around how cdr, car and their derivatives might be used in a useful manner.

### #33kordova  Members

Posted 31 October 2003 - 05:28 AM

Read the BP gamedev threads and perhaps some of Paul Graham''s articles on his webpage if you''re truly interested. It begins to make sense, albeit rather slowly at first.

### #34Zul  Members

Posted 31 October 2003 - 05:29 AM

btw, this topic didn''t really die, it evolved into this one and got moved to the AI forum.

Well, it''s a bit different, but similar.

### #35DakeDesu  Members

Posted 31 October 2003 - 05:30 AM

quote:
Original post by kordova
Read the BP gamedev threads and perhaps some of Paul Graham''s articles on his webpage if you''re truly interested. It begins to make sense, albeit rather slowly at first.

I''ve read the first few ones--until the point where people kept asking the same questions over again, and yes, Lisp rocks for handling data structures (as was some of the arguments against XML). However, I still do not know where something like "cdaddaar" might possibly be of any use.

### #36flangazor  Members

Posted 31 October 2003 - 05:31 AM

Unless you can interact with the character (directly or indirectly) in question there is, in my opinion:

a.) little point
b.) not much going on of interest

While the history might supplement a more in depth character system, when it is alone it is not all that intriguing.

Comically, writing it in Lisp wouldn''t be much effort except for the tables of information you wish to select from (names, ethnicities, diseases, occupations, etc).

You could turn this the other way and instead of generating a history, you generate offspring for people. This might be more simplistic than the history but somehow more interesting as the use could interact and perhaps guide the generation.

### #37kordova  Members

Posted 31 October 2003 - 05:31 AM

quote:
Original post by Zul
btw, this topic didn''t really die, it evolved into this one and got moved to the AI forum.

Well, it''s a bit different, but similar.

I think there are enough differences to warrant my investigation into the topic here alone first, though I''ve been informed of that thread''s move recently as well. Cheers.

### #38kordova  Members

Posted 31 October 2003 - 05:33 AM

quote:
Original post by flangazor
You could turn this the other way and instead of generating a history, you generate offspring for people. This might be more simplistic than the history but somehow more interesting as the use could interact and perhaps guide the generation.

That is similar to my intent, though I''ve always preferred the egg before the chicken myself.

### #39Zul  Members

Posted 31 October 2003 - 05:44 AM

quote:
Original post by DakeDesu

I've read the first few ones--until the point where people kept asking the same questions over again, and yes, Lisp rocks for handling data structures (as was some of the arguments against XML). However, I still do not know where something like "cdaddaar" might possibly be of any use.

Generally, functions like cdddr aren't something you want to use often (in the middle of your code) - makes for difficult to read code. There are built in functions, and you can write your own to say take the second, third, fourth, etc. element of a list.
(defun fourth (list)  (car (cdr (cdr (cdr list)))))

Which could be simplified to

(defun fourth (list)  (cadddr list))

Which is a lot less to type (and will give you less problems with matching your parens up - that can happen alot.

Of course, you'd really want to make sure the list isn't null first, so it should really be:
(defun fourth (list)  (if (not (null list))    (if (not (null (cdr list)))      (if (not (null (cddr list)))        (if (not (null (cdddr list)))          (cadddr list))))))

Which is pretty godawful.

Or you could iterate with a do and a counter, or recursion and a counter.
(defun fourth (list &optional (count 0))  (if (= count 3)    (car list)    (if (not (null (cdr list)))      (fourth (cdr list) (1+ count))      null)))

Ok, I'm going to stop now.

[edit: code tags are my friend]

[edited by - Zul on October 31, 2003 12:49:37 PM]

### #40Oluseyi  Members

Posted 31 October 2003 - 05:54 AM

What's the point?

(By the way, this is the same as pumping a list or sequence of events into an "AI" program called Author - can't find a link right now - which turns it into narrative. Take a look at this page for a syllabus, tools and reference material for a course on narrative AI.)

So a list of properties/events (a history) exists, and some fancy text processor turns it into something a cheap author might right. And? So far in the discussion (I read about 80% of the posts), the most advanced idea is random (perhaps modulated by statistical distribution info) selection of properties from domain-appropriate lists. Wow. Real mindblowin'.

I have a mid-term.

[Edit: Typeface.]

[edited by - Oluseyi on October 31, 2003 12:55:44 PM]

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.