Download presentation
1
Artificial Intelligence in Game Design
Natural Language Understanding in Games
2
Natural Language in AI Goal: User types or speaks sentences AI “understands” well enough to Change its knowledge Formulate responses Extremely difficult! Requires understanding of: Sentence grammar Context provided by other sentences and world in general Motivation of speaker (are they lying, etc.) Examples: “Fred fired Joe.” “Fred fired the cannon.” “Fred fired Joe from the cannon.”
3
Natural Language in Games
Only input in old school text based adventure games Player commands
4
Uses of Natural Language
One possible goal: Providing players a “realistic” way to interact with human-type NPCs Key: Restrict to limited domain NPC has specific purpose in game Player understands that purpose Player specifically tailors sentences towards that specific purpose Example: “Shopkeeper” character Player wants to find out what they have Player wants to negotiate prices
5
Keyword Search Classify sentences based on certain words it contains
Produce appropriate response based on sentence classification Canned sentence Action Character state change First implementation: Eliza “automated therapist” Input sentences Response sentence produced Key: Limited domain Produced type of feedback people expected from “Counselor Troi” type of psychobabble
6
Eliza User input Eliza responses
7
Eliza Classified typically expected words into categories
Synonyms Words that should have same response Chose a corresponding response sentence at random Example: “family” sentences
8
Eliza Often echoes back phrases entered by user to appear less canned
“can you ______” “You want me to be able to _______?”
9
Eliza Key phrase to match
Echo back all words in sentence after the key phrase
10
Eliza Generated plausible “general prompts” if no keyword match
Much better than responding “I don’t understand”!
11
Colossal Cave Adventure
Keyword analysis of first two words in sentence First word: verb Second word: object on which verb acts
12
Colossal Cave Adventure
Keywords classified into categories
13
Colossal Cave Adventure
Subroutines implemented for word categories Text files contain appropriate responses
14
Starship Titanic Game primarily based on simple language understanding
Players could “converse” with shipboard NPCs Main purpose: “lead” player to tasks and goals
15
Starship Titanic Used keyword search
Had “random responses” if no match Mistakes made plausible by game situation Stated at beginning that all NPCs controlled by “damaged ship AI”
16
Shopkeeper Example Purpose: Sell potions and wands to player States:
Greet player and ask whether they would like to buy potion or wand Find out which one Haggle over price Sell if agreed Get angry if player leaves script or offers too low a price
17
Directed Conversation
Idea: Lead player into their role in the conversation Make it possible to answer with one word responses Make it clear what they are Accept as many synonyms as possible Basic structure like state machine “Affirmative” keyword Wand keyword “Greetings! Would you like to buy something?” “We have wands and potions. What would you like?” Negotiation Stage Potion keyword “Do you want a healing or a strength potion?” Affirmative yes, ok, sure, … Healing or strength keyword
18
“Greetings! Would you like to buy something?”
Shortcuts If sentence contains multiple keywords, use them all to speed up conversation Example: “I’d like a strength potion” Affirmative answer Negotiation Stage “Greetings! Would you like to buy something?” … Request for specific item
19
Confirmation Echo back phrases where possible
Makes things more interactive Helps confirm that character understands what player wants Example: “I’d like a strength potion” “A strength potion costs 10 gp” “We have wands and potions. What would you like?” Wand keyword Order = “wand” “A Order costs 10 gold pieces. Would you Like to buy it?” Negotiation Stage Potion keyword “Do you want a healing or a strength potion?” Healing or strength keyword Order = “strength potion” or “healing potion”
20
Memory Remember previous player interactions
Use to shortcut process and simplify play Makes NPC appear more intelligent Done by some versions of Eliza “Affirmative” keyword Player enters shop “Welcome back! Would you like another Order?” Order != null Order == null “Negative” keyword “We have wands and potions. What would you like?” Wand keyword Order = “wand” “A Order costs 10 gold pieces. Would you Like to buy it?” Negotiation Stage Potion keyword “Do you want a healing or a strength potion?” Healing or strength keyword Order = “strength potion” or “healing potion” 20
21
Responses Character side of interaction should also be at appropriate level of detail Descriptive when need to give player information Terse when player should already have most information Example: area descriptions in colossal cave (two different files)
22
Emotional States Can use conversation to change emotional state of character Example: Orc has “businesslike” and “angry” states Possibly fuzzy (memberships in both) Rules for changing membership: Sentences orc can’t understand increases membership in Angry by 0.1 Incentive to stay on script! Apologies increase membership in Businesslike by 0.1 Lowball offers in negotiations increase membership in Angry based on membership of offer in “low” Good offers increase membership in Businesslike based on 1 - membership of offer in “low” Businesslike Angry
23
Emotional States As with any emotional state, need way to express to player Can choose actions as before Membership in “Angry” > 0.8 Throw player out of shop Can choose words based on state Example: follow every response with “customer description” Customer description based on membership in “Angry” 0.0 – 0.25 Sir, valued customer, … 0.25 – 0.5 <nothing>, customer 0.5 – 0.75 Annoying one, foolish one, … 0.8 – 1 <thrown out of shop>
24
Alternatives and Problems
Big question: Is it worth it? Requires time Requires large dictionary of synonyms even for limited domains Requires handling of mistyped words “I’d like a poiton” Usual alternative: Choosing responses from menu Limits responses No haggling over prices!
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.