artificial intelligence in game design natural language understanding in games

25
Artificial Intelligence in Game Design Natural Language Understanding in Games

Upload: adrian-horn

Post on 11-Jan-2016

223 views

Category:

Documents


1 download

TRANSCRIPT

Page 1: Artificial Intelligence in Game Design Natural Language Understanding in Games

Artificial Intelligence in Game Design

Natural Language Understanding in Games

Page 2: Artificial Intelligence in Game Design Natural Language Understanding in Games

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.”

Page 3: Artificial Intelligence in Game Design Natural Language Understanding in Games

Natural Language in Games

• Only input in old school text based adventure games

Player commands

Page 4: Artificial Intelligence in Game Design Natural Language Understanding in Games

• 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

Uses of Natural Language

Page 5: Artificial Intelligence in Game Design Natural Language Understanding in Games

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

Page 6: Artificial Intelligence in Game Design Natural Language Understanding in Games

Eliza

User input

Eliza responses

Page 7: Artificial Intelligence in Game Design Natural Language Understanding in Games

Eliza

• Classified typically expected words into categories– Synonyms

– Words that should have same response

• Chose a corresponding response sentence at random• Example: “family” sentences

Page 8: Artificial Intelligence in Game Design Natural Language Understanding in Games

Eliza

• Often echoes back phrases entered by user to appear less canned– “can you ______” “You want me to be able to _______?”

Page 9: Artificial Intelligence in Game Design Natural Language Understanding in Games

Eliza

Key phrase to match

Echo back all words in sentence after the key phrase

Page 10: Artificial Intelligence in Game Design Natural Language Understanding in Games

Eliza

• Generated plausible “general prompts” if no keyword match– Much better than responding “I don’t understand”!

Page 11: Artificial Intelligence in Game Design Natural Language Understanding in Games

Colossal Cave Adventure

• Keyword analysis of first two words in sentence– First word: verb– Second word: object on which verb acts

Page 12: Artificial Intelligence in Game Design Natural Language Understanding in Games

Colossal Cave Adventure

• Keywords classified into categories

Page 13: Artificial Intelligence in Game Design Natural Language Understanding in Games

Colossal Cave Adventure

• Subroutines implemented for word categories• Text files contain appropriate responses

Page 14: Artificial Intelligence in Game Design Natural Language Understanding in Games

Starship Titanic

• Game primarily based on simple language understanding– Players could “converse” with shipboard NPCs

– Main purpose: “lead” player to tasks and goals

Page 15: Artificial Intelligence in Game Design Natural Language Understanding in Games

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”

Page 16: Artificial Intelligence in Game Design Natural Language Understanding in Games

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

Page 17: Artificial Intelligence in Game Design Natural Language Understanding in Games

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

“Greetings! Wouldyou like to buy

something?”

“We have wandsand potions.

What would you like?”

“Affirmative” keyword

Wand keyword Negotiation

Stage

Potion keyword

“Do you want a healingor a strength potion?”

Healing or strength keyword

Affirmative yes, ok, sure, …

Page 18: Artificial Intelligence in Game Design Natural Language Understanding in Games

Shortcuts

• If sentence contains multiple keywords, use them all to speed up conversation

• Example: “I’d like a strength potion”

Affirmative answer

NegotiationStage

“Greetings! Wouldyou like to buy

something?”…

Request for specific item

Page 19: Artificial Intelligence in Game Design Natural Language Understanding in Games

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 wandsand potions.

What would you like?”

Wand keyword

NegotiationStagePotion keyword

“Do you want a healingor a strength potion?”

Healing or strength keyword

Order = “wand”

Order = “strength potion” or “healing potion”

“A Order costs 10 gold pieces. Would you

Like to buy it?”

Page 20: Artificial Intelligence in Game Design Natural Language Understanding in Games

Memory

• Remember previous player interactions– Use to shortcut process and simplify play

– Makes NPC appear more intelligent• Done by some versions of Eliza

“We have wandsand potions.

What would you like?”

Wand keyword

NegotiationStagePotion keyword

“Do you want a healingor a strength potion?”

Healing or strength keyword

Order = “wand”

Order = “strength potion” or “healing potion”

“A Order costs 10 gold pieces. Would you

Like to buy it?”

Player enters shop

Order == null

“Welcome back! Wouldyou like another Order?”

Order != null

“Affirmative” keyword

“Negative” keyword

Page 21: Artificial Intelligence in Game Design Natural Language Understanding in Games

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)

Page 22: Artificial Intelligence in Game Design Natural Language Understanding in Games

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

Page 23: Artificial Intelligence in Game Design Natural Language Understanding in Games

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>

Page 24: Artificial Intelligence in Game Design Natural Language Understanding in Games

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!

Page 25: Artificial Intelligence in Game Design Natural Language Understanding in Games

• http://www.web-adventures.org/cgi-bin/webfrotz?s=Adventure