RPG AI

Report
RPG AI
Josh Westbrook
Ethan Harman
Elements of RPGs
•
•
•
•
•
•
Exploration
o
Dungeons, World Map
Combat
o
Select Actions from Menu
Experiences Points and Leveling
o
Become Stronger, Better Abilities
Story
Single Character/Party
Setting
Common RPG Ideas
•
Enemies
Provide XP, Gold, Items
o Endless Supply
o Scripted vs Dynamic
o
•
•
Statistical Data
o
HP, Strength, etc.
Behavior Patterns
o
o
Attack, heal, run away
Changes for singular vs group
Common RPG Elements
•
Bosses
Stronger
o Better AI
o Heavily Scripted
o Dialogue
o
Common RPG Ideas
•
Non-Player Characters (NPCs)
o
o
o
o
From zero to millions
Allows player interaction
 Reputation system
 Dialogue
Party Members
 AI Controlled
 Often can be scripted by player
Intelligence can range from nothing to incredibly
high as party member
However...
You DO get RPGs with very different elements:
•
•
Harvest Moon
o Farming Game
o Role playing a farmer's life, including crops,
animals, marriage, festivals, etc.
The Sims
o Life simulation
Early History: PC
•
•
•
Based off of Tabletop RPGs
o
Text-Based
o
Zork
Dungeon Crawlers
o
o
•
Dungeons and Dragons
o
Rogue
Ultima
The Bard's Tale
Turn-Based
NetHack
Early History: Console
•
•
•
Dragon Quest
o
Standard for JRPGs
Final Fantasy I & II
o
Story Elements, Character Development
The Legend of Zelda
o
Action-RPG
Mid-History: West/East Split
•
PC RPG -> Western RPGs:
Open-World
o Character Customization
o Dialogue Choices
o Examples:
 Baldur's Gate, Diablo
o
•
Console RPG -> Eastern RPGs;
Linear Story
o Cinematic
o Character Development
o Examples:
o
Modern RPGs
•
Massively Multiplayer Online RPG
Thousands of players together
o Persistent World
o WoW, The Old Republic, Guild Wars
o
•
Hybrid RPGs
Often contain elements of another genre
o Many games today include some RPG elements
o Action RPGs: Mass Effect, COD Multiplayer
o Sports RPGs: Single Player Modes
o Life-Simulation: The Sims
o
Scripting
•
•
Earliest games contained little to no AI
Linear Stories allowed heavy scripting
o
o
o
o
•
Set
Set
Set
Set
attack patterns
dialogue
item drops from enemies
story direction
Example from FF7 at 1:55
Casts Big Wave right before he dies
•
Scripting
•
Real-Time Party Members:
Gives AI parameters to check and how to react
o Gives NPC feel of intelligent behavior
o Sometimes can be written by player
o
•
•
NPC Scripting Example: Dragon Age at 3:00
Visible in many genres where NPCs assist
the player
Scripting
•
Great for linear RPGs, controls:
Dialogue
o NPC Behavior
o Cinematic occurrence
o
•
•
However, for open-world, dynamic RPGs
cannot be used to drive game direction
But: Elder Scrolls: Skyrim uses scripts to
control basic, unique NPCs
Combat
•
Contains multiple uses of AI
o
Damage control
o
Enemy Behavior
o
NPC Behavior
Combat
•
Damage is calculated using :
o
o
o
o
Character Level/Stats
 Strength, Magic, Agility, Luck, etc.
Enemy Stats
 Defense, Speed, etc.
Status Effects
 Poison, slow, etc.
Elements of Chance
 Based off of Table-Top Games
 Dice Rolls, Coin Flips, etc.
Combat
•
Enemy Behavior
o Personality
 Defined with specific traits used to specify how
enemy reacts to actions
o Attack Patterns
o Targeting
 Go after healer
Combat
•
•
NPC Behavior
o
Could be friend or enemy
Methods of Control
o
o
Scripted
Planning Algorithms
 Given a goal, try to reach goal
• Example: Fallout 3, Enemies who run out of ammo will pick
up weapons off of dead NPCs
o
o
State Machines
Mixture of these methods
NPC Behavior
•
Scripted
Attack same enemy as player
o Attack closest enemy
o Avoid combat, heal/support player
o
•
Can run great, but can't adjust
o
o
May not have NPC cure poison even though item is
cheap and readily available
May waste powerful abilities/weapons on weak
enemies
NPC Behavior
•
Planning Algorithm
Broader than scripting
o Example:
 Goal is to kill enemy who has 10 hp
 Use weakest spell that will still cause 10 hp
 Save stronger spell for boss
o Can adjust tactics:
 Focusing on spells, gets muted
 Can adjust plan to attack with weapon
o Can use scripts once plan is created
o
Level of Detail
•
Graphic Engine
Problems rendering large numbers of objects
o Draws too many triangles
o Slows down game
o
•
•
Solution: Reduce amount of detail in
objects that are further away
Why not do this with AI?
LOD Example
AI Issues
•
Trying to run AI for all creatures in a large
dungeon will slow down game
o
•
Multiplayer: Baldur's Gate vs Neverwinter Nights
 "You must gather your party before venturing
forth"
If an enemy is far enough away, does it
matter if it is using clever AI?
AI Level-of-Detail
•
1: PCs and Allied NPCs
o
o
•
Always on screen assisting player character
Need to have the best AI
2: Creatures fighting PC/Party
o
o
Need to have the best enemy AI
Need to be worthy foes
AI Level-of-Detail
•
3: Creatures within 30 Meters
o Visible by PC
o Need to be ready to battle quickly
o But don't need the best AI, save CPU
•
4: Creatures in same large-scale area as PC
o AKA Same Dungeon Level, Same Building, etc.
o Need to have some intelligence, but not much
AI Level-of-Detail
•
5: Creatures in areas without PC
o
o
•
Within entire dungeon, town, etc.
Only need to know they exist and to be able to
increase AI ability if necessary
By using AI Level-of-Detail, multiplayer
RPGs can allow free movement without
worry of slowing game
Reputation
•
Cause and Effect
•
NPC ESP
•
Memory Usage
Reputation System
•
Event Template
o
o
o
o
Who did what to whom?
Who cares about this action?
 NPCs are placed in groups
Magnitude
Known By?
Reputation System
•
Master Event List
Central Location vs Individualized
o All important events witnessed by any NPC
o Deletes duplicate events unless a change of
magnitude occurs
o Deletes events not referenced by any NPCs
o Larger memory usage for multi-player games
o
Reputation System
•
Long-Term Memory
o
o
o
All NPCs have one
Stores IDs from Master Event List, magnitude it
knows, and time it learned of it
 Prevents under-reacting
Can forget events
Reputation System
•
Reputation Table
o
o
List of groups with standings
Like and Hate variables
 If Like and Hate both low: ambivalent
 If Like and Hate both high: mistrust and fear
Reputation System
•
Learning
Event Announcer
 Spawns at event location (full and partial
events)
o Sharing information (depends on reputations)
o NPCs check their memories
o NPC tries to find match in Long-Term Memory.
Updates if there or adds as new event.
 Larger magnitude, know player (assumptions)
 If new, increments events "known by" counter
o
Side Quests
•
•
•
•
Open-world feeling (not just main story)
Varies gameplay, creates escalating
challenges
Adds story without complicating main story
Reward exploration
•
More work to develop all these side quests
Side Quests
•
Many side quests follow certain patterns
which make them easier to generate
automatically.
o
o
o
o
Talk Chain, Acquire Item, Deliver Item, Kill
Antagonist, Assassinate Antagonists, etc.
Combine many of these patterns to create quest
chains.
Given a list of items, locations, and NPCs, can
generate simple or complex quests.
Have to be verified to ensure they don't interfere
with the main storyline or become too repetitive.
Side Quests
•
Quest Points
o
o
o
Can be disabled, enabled, or reached.
Controls the order in which the quest is done: talk
to quest giver, perform task, return to quest giver.
Allows for optional points, and doing quests in
different orders (perform task without first talking
to quest giver)
Intelligent Story Direction
•
•
•
•
Storytelling usually comes second to
gameplay.
Players have little effect on what happens
in the story.
Games should be immersive, responsive,
and engaging.
The Next Generation holodeck: ideal
model.
Intelligent Story Direction
•
•
•
Story Representation - need language to
describe desired gameplay.
Realistic Characters: all realistic behaviour.
Important Role: player's character must be
the main focus of the story.
Intelligent Story Direction
•
Story Coordination
Everyone must be on same page.
o Adjusts NPCs and story events to player actions.
o Hard to provide a large number of choices (verbs)
 Player interaction with environment
 NPC behaviour
 Coordinating a story the player actually affects
o Boundary problems where current story and current
action don't agree (outside story space)
o
Intelligent Story Direction
•
Story Direction
o
o
o
o
Changes NPC behaviour or the environment.
Given a user action, uses a heuristic to search
through possible storylines.
Pushes player towards story points.
If player action will cause a boundary condition
 Accommodate: plan around the action
 Intervention: somehow change effects of action
Intelligent Story Direction
•
Interactive Drama Architecture (IDA)
Author writes structured story content.
o NPCs who perform
o Environment house NPCs and other objects
o Director coordinates story and NPC
o Player provides input and interacts
o
Intelligent Story Direction
•
Author creates story content and story
structure. (Who, what where, why and how
though not when)
o
•
•
Story is represented as plot points with preconditions and actions.
With a plot point selected, the director
gives NPCs new goals or changes the
environment.
NPCs have their own AI, so they aren't
completely controlled by the director.
Intelligent Story Direction
•
Director must take care of knowledge
maintenance, plot monitoring, story
direction, reactive direction, and predictive
direction.
o
o
o
Knowledge Maintenance - omniscient observer
Plot Monitoring - sees if plot pre-conditions are
fulfilled (status can change back and forth)
Story Direction - tells NPCs and environment what
to do when a plot point is being performed.
Intelligent Story Direction
•
•
•
Reactive Direction - taking the story from
where it has wound up to where it should
be, sometimes forcibly.
Predictive Direction - less obvious than
reactive direction. Examines patterns in
behaviour.
o
Needs an accurate model of the player.
Inverse relationship between immediacy
and subtleness.
Intelligent Story Direction
•
Affecting Story Content
o
o
When multiple plot points are open, the director
either waits for the player to chose or applies a
heuristic.
 Heuristic could be Brevity or Tension
Can instantiate variables for later use (the
character you befriended at the beginning of the
story).

similar documents