RPG AI
E N D
Presentation Transcript
RPG AI Josh Westbrook Ethan Harman
Elements of RPGs • Exploration • Dungeons, World Map • Combat • Select Actions from Menu • Experiences Points and Leveling • Become Stronger, Better Abilities • Story • Single Character/Party • Setting
Common RPG Ideas • Enemies • Provide XP, Gold, Items • Endless Supply • Scripted vs Dynamic • Statistical Data • HP, Strength, etc. • Behavior Patterns • Attack, heal, run away • Changes for singular vs group
Common RPG Elements • Bosses • Stronger • Better AI • Heavily Scripted • Dialogue
Common RPG Ideas • Non-Player Characters (NPCs) • 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 • Farming Game • Role playing a farmer's life, including crops, animals, marriage, festivals, etc. • The Sims • Life simulation
Early History: PC • Based off of Tabletop RPGs • Dungeons and Dragons • Text-Based • Zork • Dungeon Crawlers • Rogue • Ultima • The Bard's Tale • Turn-Based
Early History: Console • Dragon Quest • Standard for JRPGs • Final Fantasy I & II • Story Elements, Character Development • The Legend of Zelda • Action-RPG
Mid-History: West/East Split • PC RPG -> Western RPGs: • Open-World • Character Customization • Dialogue Choices • Examples: • Baldur's Gate, Diablo • Console RPG -> Eastern RPGs; • Linear Story • Cinematic • Character Development • Examples: • Final Fantasy Series, Pokemon
Modern RPGs • Massively Multiplayer Online RPG • Thousands of players together • Persistent World • WoW, The Old Republic, Guild Wars • Hybrid RPGs • Often contain elements of another genre • Many games today include some RPG elements • Action RPGs: Mass Effect, COD Multiplayer • Sports RPGs: Single Player Modes • Life-Simulation: The Sims
Scripting • Earliest games contained little to no AI • Linear Stories allowed heavy scripting • Set attack patterns • Set dialogue • Set item drops from enemies • Set 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 • Gives NPC feel of intelligent behavior • Sometimes can be written by player • NPC Scripting Example: Dragon Age at 3:00 • Visible in many genres where NPCs assist the player
Scripting • Great for linear RPGs, controls: • Dialogue • NPC Behavior • Cinematic occurrence • 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 • Damage control • Enemy Behavior • NPC Behavior
Combat • Damage is calculated using : • 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 • Personality • Defined with specific traits used to specify how enemy reacts to actions • Attack Patterns • Targeting • Go after healer
Combat • NPC Behavior • Could be friend or enemy • Methods of Control • 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 • State Machines • Mixture of these methods
NPC Behavior • Scripted • Attack same enemy as player • Attack closest enemy • Avoid combat, heal/support player • Can run great, but can't adjust • 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 • Example: • Goal is to kill enemy who has 10 hp • Use weakest spell that will still cause 10 hp • Save stronger spell for boss • Can adjust tactics: • Focusing on spells, gets muted • Can adjust plan to attack with weapon • Can use scripts once plan is created
Level of Detail • Graphic Engine • Problems rendering large numbers of objects • Draws too many triangles • Slows down game • Solution: Reduce amount of detail in objects that are further away • Why not do this with AI?
AI Issues • Trying to run AI for all creatures in a large dungeon will slow down game • 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 • Always on screen assisting player character • Need to have the best AI • 2: Creatures fighting PC/Party • Need to have the best enemy AI • Need to be worthy foes
AI Level-of-Detail • 3: Creatures within 30 Meters • Visible by PC • Need to be ready to battle quickly • But don't need the best AI, save CPU • 4: Creatures in same large-scale area as PC • AKA Same Dungeon Level, Same Building, etc. • Need to have some intelligence, but not much
AI Level-of-Detail • 5: Creatures in areas without PC • 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 • 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 • All important events witnessed by any NPC • Deletes duplicate events unless a change of magnitude occurs • Deletes events not referenced by any NPCs • Larger memory usage for multi-player games
Reputation System • Long-Term Memory • 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 • 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) • Sharing information (depends on reputations) • NPCs check their memories • 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
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. • 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 • 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. • Adjusts NPCs and story events to player actions. • Hard to provide a large number of choices (verbs) • Player interaction with environment • NPC behaviour • Coordinating a story the player actually affects • Boundary problems where current story and current action don't agree (outside story space)
Intelligent Story Direction • Story Direction • 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. • NPCs who perform • Environment house NPCs and other objects • Director coordinates story and NPC • Player provides input and interacts
Intelligent Story Direction • Author creates story content and story structure. (Who, what where, why and how though not when) • Story is represented as plot points with pre-conditions 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. • 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. • Needs an accurate model of the player. • Inverse relationship between immediacy and subtleness.
Intelligent Story Direction • Affecting Story Content • 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).