Artificial Intelligence (A.I.)
Pure AI
Game AI
Pure AI / Game AI
Pure AI
> “Pure” AI is a scientific discipline
Pure AI
> “Pure” AI is a scientific discipline
Pure AI
> “Pure” AI is a scientific discipline
Pure AI
> “Pure” AI is a scientific discipline
Pure AI
> “Pure” AI is a scientific discipline
Pure AI
> “Pure” AI is a scientific discipline
Game AI
> Game AI is a whole other thing
Game AI
> Game AI is a whole other thing
Game AI
> Game AI is a whole other thing
Game AI
> Game AI is a whole other thing
Game AI
> Game AI is a whole other thing
Game AI
> Game AI is a whole other thing
Pure AI vs Game AI
> Pure AI for an NPC would be to make it fight as effective as possible.
Pure AI vs Game AI
> Pure AI for an NPC would be to make it fight as effective as possible.
> Is that what we want to achieve?
Pure AI vs Game AI
> Pure AI for an NPC would be to make it fight as effective as possible.
> Is that what we want to achieve?
> Game AI aims to make immersive experience
- Represent a enemy character accurately
- Allow Player to “become” Batman
Pure AI vs Game AI
> Pure AI for an NPC would be to make it fight as effective as possible.
> Is that what we want to achieve?
> Game AI aims to make immersive experience
- Represent a enemy character accurately
- Allow Player to “become” Batman
>Entertainment, no problem solving
Automate Opponents
> Centuries of trying to play games with few players
-Mechanical Trunk claimed to be a chess player circ 1770
Automate Opponents
> Centuries of trying to play games with few players
-Mechanical Trunk claimed to be a chess player circ 1770
-First video game example - Pong 1972
Automate Opponents
> Centuries of trying to play games with few players
-Mechanical Trunk claimed to be a chess player circ 1770
-First video game example - Pong 1972
-Ongoing commercial interests - FPS “Bots” RTS “Skirmish”
Automate Opponents
> Emphasis on delivering a good player experience
Looking and Being Smart
> Two components to Game AI
Looking and Being Smart
> Two components to Game AI
Looking and Being Smart
> Two components to Game AI
Looking and Being Smart
> Two components to Game AI
> Focus in this class is on “Being Smart”
Looking and Being Smart
> Two components to Game AI
> Focus in this class is on “Being Smart”
> Looking Smart is more on an animation / art issues
Looking and Being Smart
> Two components to Game AI
> Focus in this class is on “Being Smart”
> Looking Smart is more on an animation / art issues
> Good decision making still required to drive this
Some AI Basics
What is AI?
> Any time a computer has to pick between two or more choices it can be said it is acting “intelligently”
What is AI?
> Any time a computer has to pick between two or more choices it can be said it is acting “intelligently”
> That isn’t to say that it is inherently making good choices
What is AI?
> Any time a computer has to pick between two or more choices it can be said it is acting “intelligently”
> That isn’t to say that it is inherently making good choices
> Typically, looking for better-than-random levels of sophistication
Decision Making Theory
> Not going to get too bogged down today in the process
Decision Making Theory
> Not going to get too bogged down today in the process
> Science of decision can fill up multiple degree-level courses
Decision Making Theory
> Not going to get too bogged down today in the process
> Science of decision can fill up multiple degree-level courses
> Game Theory is a good starting point to learn more
Smart or Dumb?
> Partly ignoring decision making because of Game AI, it isn’t so important for intro level.
Smart or Dumb?
> Partly ignoring decision making because of Game AI, it isn’t so important for intro level.
> Partly because of the entertainment issue
Smart or Dumb?
> Partly ignoring decision making because of Game AI, it isn’t so important for intro level.
> Partly because of the entertainment issue
> Partly for rapid iteration
Agent-Based Systems
Agent-Based Systems
> Intelligent Agents are things within our problem that are going to be trying to act intelligently
Agent-Based Systems
> Intelligent Agents are things within our problem that are going to be trying to act intelligently
> Could be a Roomba, a warehouse robot, an automated trip booking system or a predator drone
Agent-Based Systems
> Intelligent Agents are things within our problem that are going to be trying to act intelligently
> Could be a Roomba, a warehouse robot, an automated trip booking system or a predator drone
> Agents have three important characteristics
Agent-Based Systems
> Intelligent Agents are things within our problem that are going to be trying to act intelligently
> Could be a Roomba, a warehouse robot, an automated trip booking system or a predator drone
> Agents have three important characteristics
Agent-Based Systems
> Intelligent Agents are things within our problem that are going to be trying to act intelligently
> Could be a Roomba, a warehouse robot, an automated trip booking system or a predator drone
> Agents have three important characteristics
Agent-Based Systems
> Intelligent Agents are things within our problem that are going to be trying to act intelligently
> Could be a Roomba, a warehouse robot, an automated trip booking system or a predator drone
> Agents have three important characteristics
Agent-Based Systems
> Intelligent Agents are things within our problem that are going to be trying to act intelligently
> Could be a Roomba, a warehouse robot, an automated trip booking system or a predator drone
> Agents have three important characteristics
NPCs as Agents
> One of the core places we can apply “agent-based systems” in when thinking about NPCs
NPCs as Agents
> One of the core places we can apply “agent-based systems” in When thinking about NPCs
> Each NPC is an agent
NPCs as Agents
> One of the core places we can apply “agent-based systems” in When thinking about NPCs
> Each NPC is an agent
> In this Model
Representations
> Software Engineering buzzwords!
Representations
> Software Engineering buzzwords!
> Representation internal to one NPC or shared?
Representations
> Software Engineering buzzwords!
> Representation internal to one NPC or shared?
> Alien Hive-mind - All units know what one units knows
Representations
> Software Engineering buzzwords!
> Representation internal to one NPC or shared?
> Alien Hive-mind - All units know what one units knows
> Director - All knowing and makes decision on player situations
Representations
> Software Engineering buzzwords!
> Representation internal to one NPC or shared?
> Alien Hive-mind - All units know what one units knows
> Director - All knowing and makes decision on player situations
Representations
> Software Engineering buzzwords!
> Representation internal to one NPC or shared?
> Alien Hive-mind - All units know what one units knows
> Director - All knowing and makes decision on player situations
> Modern Squad - Communication between certain units
Representations
> Software Engineering buzzwords!
> Representation internal to one NPC or shared?
> Alien Hive-mind - All units know what one units knows
> Director - All knowing and makes decision on player situations
> Modern Squad - Communication between certain units
> Medieval Guards - No Widespread communication
AI Implementations
Automata Theory
> Automata Theory is the study of abstract machines and automata, as well as the computational problems that can be solved using them.
B-Tree
FSM
Finite State Machines (FSMs)
FSM
> Finite State Machine
FSM
> Finite State Machine
FSM
> Finite State Machine
Execution Flow
> Modeling a flow of character movement
Agent FSM
Complex FSMs
Complex FSMs
Complex FSMs
Complex FSMs
Complex FSMs
Complex FSMs
Complex FSMs
BEHAVIOR TREES (B-Trees)
Directed Acyclic Graphs (DAGs)
> Finite directed graph with no directed cycles.
B-Tree Traversal (tree search)
-Rootfirst
-Depth first order
-Traversal is a tick
-Tick is set via timer
-O(log n) proportional
time
Traversal Results or Return
>Execution of a node or sub behavior tree results in an return state, extends the time of a tick.
Traversal Results or Return
>Execution of a node or sub behavior tree results in an return state, extends the time of a tick
Traversal Results or Return
>Execution of a node or sub behavior tree results in an return state, extends the time of a tick
Traversal Results or Return
>Execution of a node or sub behavior tree results in an return state, extends the time of a tick
Traversal Results or Return
>Execution of a node or sub behavior tree results in an return state, extends the time of a tick
Traversal Results or Return
>Execution of a node or sub behavior tree results in an return state, extends the time of a tick
Traversal Semantics
Traversal Semantics
-Inner Nodes only control
-Priority Selectors
Priority Selectors: check which child to run in priority order.
-Defined with a priority #
-Nodes needs to return a succeed in order for tree to keep moving
-Can override tree traversal in code
Traversal Semantics
-Inner Nodes only control
-Priority Selectors
-Sequence Selectors
Sequence Selector: Run child one after another.
-If child fails then sequence fails
-Nodes needs to return a succeed in order for tree to keep moving
-Without a reset the or explicit finish will return to last ran child
Traversal Semantics
-Inner Nodes only control
-Priority Selectors
-Sequence Selectors
-Loops
Loop: sequences but they loop around
-Loops when reaching their last child during their traversal instead of returning to its parent.
Traversal Semantics
-Inner Nodes only control
-Priority Selectors
-Sequence Selectors
-Loops
-Random Selectors
Random Selector: randomly select child node to visit
-Its soooo random!
Traversal Semantics
-Inner Nodes only control
-Priority Selectors
-Sequence Selectors
-Loops
-Random Selectors
-Concurrent
Concurrent: nodes visit all the children
-Must set a preset fail amount for concurrent to fail
-Children will be run in parallel
-Parallel options can be denied based on child failures
Traversal Semantics
-Inner Nodes only control
-Priority Selectors
-Sequence Selectors
-Loops
-Random Selectors
-Concurrent
-Decorator
Decorator: Only one child with special child rules
-Used with timers
-Special case statements
Traversal Semantics
-Inner Nodes only control
-Priority Selectors
-Sequence Selectors
-Loops
-Random Selectors
-Concurrent
-Decorator
Leaf Nodes
-Last Nodes to Visit
-Actions
-Basic Actor AI
Actions: Where the Action happens!
-Actor or game word state changes
-EG: switch weapon, run a sound, move to a position, look out for enemies
-Actor or game word state changes
-Run for one tick, one frame, or multiple ticks
-Based on returning of a fale, in progress or success return
Leaf Nodes
-Last Nodes to Visit
-Actions
-Conditions
Conditions: Check if a condition holds true
-A condition check will prevent child nodes form running
-Used to determine if a state has became invalid for actions
-Adding to AI Behavior
Goal Oriented Action Planning
But wait! There’s more!