dcsimg
A Flash Developer Resource Site

Results 1 to 9 of 9

Thread: emulating conversation

  1. #1
    Senior Member
    Join Date
    Feb 2002
    Posts
    147

    emulating conversation

    I'm working on a game that should have a significant amount of conversation between characters, and I'd like to make the conversation model more complex than a simple tree of possible conversation paths--something where the dialog is dynamically generated based on language rules.

    The best approach I can think of is to use an XML file that basically simulates a character's mind including all the facts that they know, and then somehow have this triggered by keywords. But given that Flash isn't really that fast at working with huge XML files, I think there's got to be a better way.

    Does anybody have any links to discussions or tutorials on this? Doesn't necessarily have to be for Flash--even reading the theory behind developing something like this on another system would be extremely helpful. Thanks;

  2. #2
    Senior Member kendude's Avatar
    Join Date
    Sep 2003
    Location
    Hartford, CT USA
    Posts
    877
    If you remember the old Sierra games, they used a text parser. This is javascript emulating that, you can rework it easily for Flash, it's been on my "to do list". Peep the sources:
    http://goodoldadventures.com/index.html
    Play the game, then peep the source, the.js files, They show how the text parser works.

  3. #3
    jtnw's Avatar
    Join Date
    May 2002
    Posts
    1,328
    Some intersting threads, one and two .

    Good luck,
    jtnw

  4. #4
    foxy ninja extraordinaire PENGUINDICTATOR's Avatar
    Join Date
    Jun 2003
    Posts
    137
    Hmm that sounds cool, I would be very interested with how that turns out.

    you would also need a database of facts they would know, like if you told them that you were, say, 14 years old it would remember that.

  5. #5
    Senior Member jbum's Avatar
    Join Date
    Feb 2004
    Location
    Los Angeles
    Posts
    2,920
    My site has source for a basic eliza-style engine, which is helpful if you want to talk to someone and have them irritate the hell out of you.

    Psychoanalysis with Sigmund Freud

    In general I think scripted dialog is going to be far better than any kind of pseudo-AI-based approach.

    The pseudo-AI stuff tends to be fun for the programmer (cause it's a challenge) but not so fun for the player, and never as good as intelligent and witty dialog written by a human.

    You could script about 20 minutes of conversation between various character types and then plop yourself down in the middle of the conversation.

    The Max Payne games do this very well. As henchmen walk by, you'll overhear them talking about their girlfriends, the Henchmen's union, and so on...
    Last edited by jbum; 04-30-2004 at 08:46 PM.

  6. #6
    Member
    Join Date
    Mar 2004
    Posts
    80
    yes, i was actually gonna suggest the same thing ^

  7. #7
    Senior Member
    Join Date
    Feb 2002
    Posts
    147
    Thanks for the replies, all!

    I understand what you're saying about pseudo-ai conversations, jbum, but this is a project that's more for my own interest than satisfying any users; if anyone else gets any entertainment out of it, great.

    Kendude, the sierra games were a good starting-place.

    I'll explain a bit about the appraoch I'm taking, and if anyone has any commments/feedback, I'd love to hear it.

    Right now I'm building a database of language rules, which is intended to be a range of sentences that the parser understands. So if you were to ask the system 'are you female?', it would go through a list of possible sentence structures, comparing the sentence with sentence rules, until it finds a match:
    Code:
     <rule desc="prop" rule="'am/is/are' + noun + adj"/>
    it then looks up the noun and adjective, and finds these two entries:
    Code:
     <word spell="you" type="noun" special="listener"/><word spell="female" type="adj" prop="gender"/>
    For the purposes of this model, every adjective is actually part of a property. So the system knows that 'female' is an adjective that describes the 'gender' property. It then checks this against what it knows about the world, and finds
    Code:
    	<person name="anne"><trait name="gender" value="female"/></person>
    Since the tested condition matches the condition in the question, it replies, constructing a response based on another set of rules:
    Code:
    <rule desc="true" rule="'yes'+noun+'am/is/are'+adj"/>
    And reconstructs it to 'yes I am female'.

    In addition to being able to understand 'are you female?', it can also understand the question if it is phrased as 'what gender are you?' However, it doesn't yet understand 'are you a female?', or 'what is your gender?'. So I've got a lot more rules to put in.

    And right now, it's really just a language-parser, there's no AI involved yet.

    When I get something a little more useable I'll post up a link to it. Thanks again for the suggestions.

  8. #8
    lemontastic Bouncinglemon's Avatar
    Join Date
    Jan 2001
    Location
    lemontopia
    Posts
    233
    I recently did a project on intelligent dialog for university. The best website I found was this one

    www.personalityforge.com

    It lets you create your own bot from scratch - building keyphrases for it, etc. The thing you will probably find most interesting is the debugger, which shows you every stage of breaking down what some one has typed in, and how the bot looks up a response for it. There is also something called the book of AI, which goes through building up your bot through different stages. Although it is not directly related to flash, I think you could apply at lot of the same concepts, its definitly worth checking out.

  9. #9
    Senior Member
    Join Date
    Feb 2002
    Posts
    147
    Thanks BL, that's a great link! The model used for processing language there is kinda similar to the model I was creating for my own parser, but much more advanced, obviously. I hadn't thought about all these issues like storing anticedents. Anyway, I'm seeing now that the biggest thing I'll have to do is creating the dictionary. Even for basic conversation I'll need several hundred words.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center