AI Game Programming Wisdom 2 Chapter 3.3

Slides:



Advertisements
Similar presentations
STRUCTURES & STRATAGIES
Advertisements

Artificial Intelligence: Knowledge Representation
Wall Building for RTS Games Patrick Schmid. Age of Empires.
AI Pathfinding Representing the Search Space
Greta YorshEran YahavMartin Vechev IBM Research. { ……………… …… …………………. ……………………. ………………………… } P1() Challenge: Correct and Efficient Synchronization { ……………………………
Types of Algorithms.
Interactive Storytelling for Video Games Chapter 13: The Argument Against the Supremacy of Player-Driven Storytelling Josiah Lebowitz Chris Klug.
CSE 380 – Computer Game Programming Pathfinding AI
NPC Interaction in Video Games Robert Higginbotham.
Hockey Terminology & Strategy Basics for Parents.
Artificial Intelligence in Game Design Intelligent Decision Making and Decision Trees.
Artificial Intelligence in Game Design Introduction to Learning.
Artificial Intelligence in Game Design Hierarchical Finite State Machines.
Decision Trees Jeff Storey. Overview What is a Decision Tree Sample Decision Trees How to Construct a Decision Tree Problems with Decision Trees Decision.
Planning under Uncertainty
Joost Westra, Frank Dignum,Virginia Dignum Scalable Adaptive Serious Games using Agent Organizations.
1 Using Search in Problem Solving Part II. 2 Basic Concepts Basic concepts: Initial state Goal/Target state Intermediate states Path from the initial.
Embracing Emergent Behavior with Goal-Based AI
Intelligent Agents What is the basic framework we use to construct intelligent programs?
Artificial Intelligence in Game Design Probabilistic Finite State Machines.
This material in not in your text (except as exercises) Sequence Comparisons –Problems in molecular biology involve finding the minimum number of edit.
CS121 Heuristic Search Planning CSPs Adversarial Search Probabilistic Reasoning Probabilistic Belief Learning.
DAMN : A Distributed Architecture for Mobile Navigation Julio K. Rosenblatt Presented By: Chris Miles.
Chapter 5.4 Artificial Intelligence: Pathfinding.
Tactical AI in Real Time Supervisor: Aleks Jakulin Crew: Damir Arh, Matija Jekovec, Mitja Luštrek Gregor Leban, Martin Žnidaršič, Uroš Čibej Translation:
Neural Networks Slides by Megan Vasta. Neural Networks Biological approach to AI Developed in 1943 Comprised of one or more layers of neurons Several.
Xavier Otero Keil.  Animation  Control characters body  makes sure that animation fits situation  handles requests to perform actions  Combat  Possibly.
Toward Real-Time Planning in Games Jeff Orkin Monolith Productions.
Chapter 3 Memory Management: Virtual Memory
Chapter 5.4 Artificial Intelligence: Pathfinding.
Artificial Intelligence in Game Design Problems and Goals.
Video Game AI. Classical Games – Focus on optimal players using computationally expensive search techniques Video Game AI – Refers to games such as First.
Agent Architecture Considerations for Real-Time Planning in Games Jeff Orkin Monolith Productions.
SAMANVITHA RAMAYANAM 18 TH FEBRUARY 2010 CPE 691 LAYERED APPLICATION.
Artificial Intelligence in Game Design
Dynamic Games & The Extensive Form
Topic 5.8 ( only HL ) IB Business & Management Project Management Mr L Greenbank 1.
Artificial Intelligence in Game Design
Black Box Testing Techniques Chapter 7. Black Box Testing Techniques Prepared by: Kris C. Calpotura, CoE, MSME, MIT  Introduction Introduction  Equivalence.
Motion Planning in Games Mark Overmars Utrecht University.
Qualitative Spatial Analysis Chris Mansley. Qualitative Quantitative items are known, definable quantities (x,y) coordinates Remaining health Location.
Artificial Intelligence in Game Design
Jumping, Climbing, and Tactical Reasoning Section 2.5 Tom Schaible CSE 497 – AI & Game Programming.
Artificial Intelligence in Game Design Complex Steering Behaviors and Combining Behaviors.
Toward More Realistic Pathfinding Authored by: Marco Pinter Presentation Date: 11/17/03 Presented by: Ricky Uy.
Random Map Generation and Transport Unit AI for Strategy Games By Russell Kuchar.
Learning & User Modeling Presentation By Brigette Swan.
Computational theory techniques in interactive video games.
Decision Trees Binary output – easily extendible to multiple output classes. Takes a set of attributes for a given situation or object and outputs a yes/no.
Human Computer Interaction
Behavior Control of Virtual Vehicle
COSC 2007 Data Structures II Chapter 13 Advanced Implementation of Tables IV.
Video Games & Object Oriented Programming. Games.
F.E.A.R. Game AI Evaluation by Robert Rak. What is F.E.A.R. ? FEAR is a First Person Shooter game Player takes on the role of an elite strike force team.
Decision Theoretic Planning. Decisions Under Uncertainty  Some areas of AI (e.g., planning) focus on decision making in domains where the environment.
Managing Risk With the IPDE Process
Artificial Intelligence in Game Design Influence Maps and Decision Making.
Artificial Intelligence in Game Design Lecture 8: Complex Steering Behaviors and Combining Behaviors.
2/19/20161 Gameplay and Interactivity CIS 487/587 Bruce R. Maxim UM-Dearborn.
AS Business Studies Unit 1
Adversarial Search 2 (Game Playing)
Artificial Intelligence in Game Design Lecture 20: Hill Climbing and N-Grams.
Finite State Machines Logical and Artificial Intelligence in Games Lecture 3a.
1 CO Games Development 2 Week 13 Influence Maps Gareth Bellaby.
Understanding AI of 2 Player Games. Motivation Not much experience in AI (first AI project) and no specific interests/passion that I wanted to explore.
Team Member AI in an FPS and Goal Oriented Action Planning.
Application of Artificial Intelligence and Graphics to Support a Three-Dimensional Game Chris Cummings.
CIS 488/588 Bruce R. Maxim UM-Dearborn
Ch 7.1: Using a Spatial Database for Runtime Spatial Analysis
Decision Trees Jeff Storey.
Presentation transcript:

AI Game Programming Wisdom 2 Chapter 3.3 Team Member AI in a FPS AI Game Programming Wisdom 2 Chapter 3.3

Goals Teammates that back the player up Teammates that follow instructions Teammates that survive until end of game Don’t want: teammates that get in the player’s way or wander off

Correct Positioning Player’s F.O.V. should not be obstructed Balance between various aspects: Visible teammates add to feeling of the game Consider accuracy of the player’s weapon Should always leave area between player and targets clear

Balancing NPC Movement NPC movement while in player’s F.O.V. should be smooth so as to not detract from game play Should move to clear player’s F.O.V., but should move as little as possible Another consideration: stance, could the teammates crouch or crawl past the player? (Again, take into account accuracy of player’s weapon, and lines of fire)

Correct Movement Multiple targets means a greater chance that at least one line of sight is obstructed Moving out of the way of one target could put a teammate in front of another target Solutions: Consider all targets & find the smaller angle that would leave a clear view for player Consider the player’s heading and move away from it

Correct Movement E E T P E E

Correct Movement E E T P E E May result in a longer path for teammate, but ensures the teammate will not cross player’s line of sight

New Considerations Target Threat: Proximity Level of awareness Readiness AI must be able to act to keep the target with the highest threat clear Ex. Teammate might spot a patrol 500m away while there is an enemy just 10m away Full Spectrum Warrior!

Guidelines Maximum straying distance: don’t want the player to have to chase teammates AI should not take the fun from the player (e.g. Should not be the first around corners, through doors) If ordered to take the initiative, teammates should behave strategically Should move at same speed as player but lag behind slightly

Guidelines Remove? Context: teammates should always respect the context and be able to intelligently change between contexts. Ex. In a stealth game teammates would avoid firing on targets unless they were instructed to do so, or unless they were engaged by the target Can set context for a individual teammates or entire team

Correct Behavior NPC behavior can be defined in rule based terms, focusing on strategic aspects of individual and the entire team 3 behaviors common to FPSs Use of cover Selective firing Reloading

Correct Behavior – Use of Cover Remove? Use of cover keeps the teammates alive as long as the player Should favor use of cover in path finding algorithms When entering a new area, teammates should map out possible points of cover Must take into consideration maximum straying distance

Correct Behavior – Selective Firing Remove? Should only fire when target is in range and in view Realistic games: fire in short bursts to improve accuracy Balance accuracy with response time Low response time could result in AI that appears unaware and less intelligent Response time should be >= enemy response time to ensure the team survives more often

Correct Behavior - Reloading Remove? Teammates should count the number of rounds used & find safe cover to reload Staggering firing of teammates ensure only one will need to reload at a given time While one teammate is reloading, another should be able to keep up the attack

Supporting the Player At least one teammate should cover player’s flanks Report enemy sightings so player can take action and to help guide player through game If enemy sighted and team too busy, teammate should engage autonomously Should concentrate on targets other than the player’s target Should take into consideration threat level Might chose target that is farthest from player’s line of sight

Table of Actions A table of actions can help the team function more effectively and give a greater illusion of intelligence Action Immediate action? Whole team required? Cover Me No I need backup Yes Attack my target Close in Spread out Move to waypoint Hold

The Player is Most Important Player should be allowed to play the game, supported by the team – team should never hinder game play NPCs should chose weapon according to player’s weapon NPCs should defer objects to player If an NPC does get an object, most needy one should have first choice NPCs should have different reaction times for distant and near enemies, to allow the player to respond first

Rainbow Six Demo

Implementation Team Manager Environment Threat Player Layered approach Four layers Lower layers take higher priority Caters to player to improve game play Team Manager Environment Threat Player

Implementation – Player Awareness Primary concern is to avoid player’s line of sight Player’s position, orientation, current target, and possible targets should all be taken into consideration Secondary concern is with avoiding other NPCs’ lines of sight A hierarchical ordering of NPCs solves this

Implementation – Threat Awareness NPCs should be looking for targets using line of sight algorithms Enemies sighted should be reported Movement gets deferred to player awareness level when not searching or engaging enemies

Implementation - Environment Awareness When moving into a new area, teamates should identify cover and areas that are impermissible due to danger or exposure Environment can be used to reduce NPC straying – boundary restrictions

Implementation - Team Manager Shared by all teammates Contains all the team’s data Helps coordinate the whole team NPCs query manager to find out where and how to move (sets context) Tell NPCs if they can pick up objects Consults environ. level to get stray dist. Consults threat level to control rate of fire Never consider the player (unpredictable)

Teammate Availability N = # enemies in covering area O = # enemies in range P = # enemies threatening team Q = supporting another team member (1/0) (Multiply by infinity to make sure busy teammate is never selected) Availability = (1+N) (1+O) (1+P) + (Q*Inf.) Lower numbers indicate greater availability. Set thresholds to determine if a teammate is busy

Fire Staggering Should happen naturally Teammates should not target and fire at the same enemy Team manager should monitor ammo levels Could widen cover area of one NPC to reduce another NPC’s cover area, allowing them to conserve ammo When one NPC runs out the other can then cover the whole area while the former reloads

AI Game Programming Wisdom 3.4 Applying Goal-Oriented Action Planning to Games Autonomous decisions to activate behaviors intended to accomplish most relative goals AI Game Programming Wisdom 3.4

Goal Oriented Action Planning (GOAP) FEAR! A decision making architecture that allows NPCs to decide what to do next, and how to do it Produces less repetitive, less predictable behavior Can be adapted to fit the current situation Facilitates authoring, maintaining, and reuse of behaviors Active goal determines NPC’s behavior through a hard-coded sequence of state transitions

GOAP An agent uses a planner to formulate a sequence of actions that will satisfy some goal GOAP does not replace the need for FSMs, but greatly simplifies those required Plan becomes a sequence of actions where each action represents a state transition Separating the state transition logic from states greatly simplifies the underlying FSM

GOAP - Goals A goal is any condition that an agent wants to satisfy Agent may have any number of goals Only one goal is active at any given moment A goal knows how to calculate its relevance A goal knows when it has been satisfied A goal does not include a plan, but merely conditions that must be met

GOAP - Plan A plan satisfying a goal is any valid sequence of actions that move the agent from some starting state to some a state satisfying the goal Could be multiple plans that satisfy some goal Only need to find one The planner can be given hints Ex. Associate costs with actions, look for lowest cost to reach goal

GOAP - Action An action is a single, atomic step that makes an agent do something Ex. GoToPoint, ActivateObject Could be short or infinitely long Ex. Reload, Attack An action knows its preconditions and effects Allows for easy chaining of actions Ex. Reload and Attack

GOAP – Plan Formulation An agent provides a goal to a handler called a planner The planner searches the space of actions for a sequence that will take the agent from its starting state to a goal state (formulating the plan) If planner is successful, the agent follows the plan until completion or until another goal becomes more relevant If another goal activates or plan becomes invalid, agent aborts and formulates another plan

GOAP – Plan Formulation Kill Enemy Goal Action Space Sleep Start Idle Draw Weapon Dodge Reload Weapon Go to Cover Attack Activate Object Go to Point Goal State

GOAP – Runtime Benefits An agent can custom fit actions to current surroundings Agent can dynamically find alternate solutions to problems Ex. Soldier out of ammo, but laser near by

GOAP – Development Benefits Handling every possible situation for every agent can quickly become difficult to manage Adding design requirements in GOAP is simply a matter of adding actions and defining their preconditions and effects Ex. Adding TurnLightsOn action, precondition to GoTo action GOAP helps prevent invalid plans to be formed, where human error could easily contribute to invalid plans in hand-written code

GOAP – Variety Benefits GOAP can be used to create a variety of characters simply by giving the planner different subsets of actions One character’s actions can easily be replaced with functionally similar, but aesthetically different actions for another character Ex. OpenDoor for regular soldier and brute Extension: add preconditions to certain actions for mood, energy level, etc.

GOAP – Implementation Considerations Challenges: Determining best method for search the space of actions Planner must be able to represent the game world in a clear, compact manner

GOAP – Planner Search Similar to path finding, so the same algorithm can be used: A* The planner need only implement its own classes for A*’s nodes, map, and goals A* involves the calculation of the cost of a node and the heuristic distance from a node to a goal Can search forward or backwards Forward: exhaustive brute force search Backwards: more efficient and intuitive

GOAP – Planner Search Node Cost Calculation: sum of costs of actions that take the world to the state represented by the node A lower cost is preferable Hueristic Cost Calculation: sum of the number of unsatisfied properties of the goal state

GOAP – World Representation Planner must be able to apply preconditions and effects of action to realize when it has reached the goal state Only need to represent minimal number of properties of the world state that are relevant to the goal the planner is trying to satisfy As planner adds actions, goal state grows with the preconditions of actions added

GOAP – World Representation Can construct a list of world property structures for each action taken Enumerated attribute key A value A handle to a subject (the character) Pass desired properties to the goal state

GOAP – World Representation Remove? struct SWorldProperty { GAME_OBJECT_ID hSubjectID; WORLD_PROP_KEY eKey; union value { bool bValue; float fValue; int nValue; } Ex. KillEnemy goal SWorldProperty Prop; Prop.hSubjectID = hShooterID; Prop.eKey = kTargetIsDead; Prop.bValue = true;

GOAP – Final Thought Context preconditions – something that needs to be true for an action to take place, but the planner will never try to satisfy it Ex. Attack action, must be in range and F.O.V. Planner must run two functions, one to make a plan and check all preconditions and another to verify all context preconditions are satisfied for the plan

GOAP - Optimization Possible optimizations for GOAP: Optimizing the search algorithm (which takes the general form of A* but is game specific) Cache results from previous searches Distributed plan formulation over several updates Use of context preconditions to prune search trees.