Artificial Intelligence in Game Design Introduction to Learning.

Slides:



Advertisements
Similar presentations
Informed search algorithms
Advertisements

Heuristic Search techniques
Reactive and Potential Field Planners
7.1. O SCARS & A RTIFICIAL I NTELLIGENCE Interim awards and introduction to game AI.
RL for Large State Spaces: Value Function Approximation
Neural Networks  A neural network is a network of simulated neurons that can be used to recognize instances of patterns. NNs learn by searching through.
Least squares CS1114
Class Project Due at end of finals week Essentially anything you want, so long as it’s AI related and I approve Any programming language you want In pairs.
Artificial Intelligence in Game Design
Multiagent Probabilistic Smart Terrain Dr. John R. Sullins Youngstown State University.
Artificial Intelligence in Game Design Intelligent Decision Making and Decision Trees.
Artificial Intelligence in Game Design Hierarchical Finite State Machines.
Planning under Uncertainty
Chapter 4 DECISION SUPPORT AND ARTIFICIAL INTELLIGENCE
RED DEAD REVOLVER Artificial Intelligence Critique By Mitchell C. Dodes CIS 588.
November 10, 2009Introduction to Cognitive Science Lecture 17: Game-Playing Algorithms 1 Decision Trees Many classes of problems can be formalized as search.
Optimization via Search CPSC 315 – Programming Studio Spring 2009 Project 2, Lecture 4 Adapted from slides of Yoonsuck Choe.
And Just Games etc.. EVOLUTION OF COMPUTER GAMES PongOdyssey Beginning of the use of microprocessors ATARI VCS system bit.
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.
KNN, LVQ, SOM. Instance Based Learning K-Nearest Neighbor Algorithm (LVQ) Learning Vector Quantization (SOM) Self Organizing Maps.
D Nagesh Kumar, IIScOptimization Methods: M1L4 1 Introduction and Basic Concepts Classical and Advanced Techniques for Optimization.
Optimization via Search CPSC 315 – Programming Studio Spring 2008 Project 2, Lecture 4 Adapted from slides of Yoonsuck Choe.
CS Reinforcement Learning1 Reinforcement Learning Variation on Supervised Learning Exact target outputs are not given Some variation of reward is.
Game Trees: MiniMax strategy, Tree Evaluation, Pruning, Utility evaluation Adapted from slides of Yoonsuck Choe.
Issues with Data Mining
Minimax Trees: Utility Evaluation, Tree Evaluation, Pruning CPSC 315 – Programming Studio Spring 2008 Project 2, Lecture 2 Adapted from slides of Yoonsuck.
Artificial Intelligence in Game Design Problems and Goals.
Vilalta&Eick: Informed Search Informed Search and Exploration Search Strategies Heuristic Functions Local Search Algorithms Vilalta&Eick: Informed Search.
1 Local search and optimization Local search= use single current state and move to neighboring states. Advantages: –Use very little memory –Find often.
Artificial Intelligence in Game Design
CSC321: Neural Networks Lecture 12: Clustering Geoffrey Hinton.
An Introduction to Artificial Life Lecture 4b: Informed Search and Exploration Ramin Halavati In which we see how information.
For games. 1. Control  Controllers for robotic applications.  Robot’s sensory system provides inputs and output sends the responses to the robot’s motor.
StarCraft Learning Algorithms By Logan Yarnell, Steven Raines, and Dean Antel.
Artificial Intelligence in Game Design Lecture 6: Fuzzy Logic and Fuzzy State Machines.
Artificial Intelligence in Game Design
Data Mining Practical Machine Learning Tools and Techniques Chapter 4: Algorithms: The Basic Methods Section 4.6: Linear Models Rodney Nielsen Many of.
CSC321: Introduction to Neural Networks and machine Learning Lecture 16: Hopfield nets and simulated annealing Geoffrey Hinton.
Exploration Strategies for Learned Probabilities in Smart Terrain Dr. John R. Sullins Youngstown State University.
Artificial Intelligence in Game Design N-Grams and Decision Tree Learning.
Artificial Intelligence in Game Design Dynamic Path Planning Algorithms.
Jumping, Climbing, and Tactical Reasoning Section 2.5 Tom Schaible CSE 497 – AI & Game Programming.
Monte-Carlo methods for Computation and Optimization Spring 2015 Based on “N-Grams and the Last-Good-Reply Policy Applied in General Game Playing” (Mandy.
Artificial Intelligence in Game Design Complex Steering Behaviors and Combining Behaviors.
CHAPTER 4, Part II Oliver Schulte Summer 2011 Local Search.
Intelligent Database Systems Lab 國立雲林科技大學 National Yunlin University of Science and Technology 1 Evolving Reactive NPCs for the Real-Time Simulation Game.
Princess Nora University Artificial Intelligence Chapter (4) Informed search algorithms 1.
Optimization Problems
1 Statistics & R, TiP, 2011/12 Neural Networks  Technique for discrimination & regression problems  More mathematical theoretical foundation  Works.
Artificial Intelligence in Game Design Influence Maps and Decision Making.
Artificial Intelligence in Game Design Lecture 8: Complex Steering Behaviors and Combining Behaviors.
Probabilistic Smart Terrain Dr. John R. Sullins Youngstown State University.
Graph Search II GAM 376 Robin Burke. Outline Homework #3 Graph search review DFS, BFS A* search Iterative beam search IA* search Search in turn-based.
Artificial Intelligence in Game Design Lecture 20: Hill Climbing and N-Grams.
Machine Learning in Practice Lecture 2 Carolyn Penstein Rosé Language Technologies Institute/ Human-Computer Interaction Institute.
CS-424 Gregory Dudek Lecture 10 Annealing (final comments) Adversary Search Genetic Algorithms (genetic search)
Artificial Intelligence in Game Design Board Games and the MinMax Algorithm.
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.
The Game Development Process: Artificial Intelligence.
CS 9633 Machine Learning Support Vector Machines
Iterative Deepening A*
Local Search Algorithms
Artificial Intelligence in Game Design
CIS 488/588 Bruce R. Maxim UM-Dearborn
The Alpha-Beta Procedure
Introduction to Artificial Intelligence Lecture 9: Two-Player Games I
More on Search: A* and Optimization
Minwise Hashing and Efficient Search
Local Search Algorithms
Presentation transcript:

Artificial Intelligence in Game Design Introduction to Learning

Learning and Games Learning in AI: –Creating new rules automatically Observation of world Examples of good/bad actions to take –Major goal of AI Would be very useful in gaming –Automatic adaptation to player tactics –Infinite replayability Would be impossible for player to create strategy that would win forever You can defeat me now, but I shall return smarter than ever!

Learning and Games Fairer and more plausible NPC behavior Characters should have same learning curve as players –Start out inexperienced –Become more competent over time Example: Simple “cannon fire game” –Could use physics to compute exact angle, but would win first turn! –Character should miss badly at first –Should “learn” to get closer over time

Learning in AI Basic components: Inputs from environment Current Rules Actions indicated by rules Critic Determines how good or bad action was Often in terms of some error Learning Element Determines how to change rules in order to decrease error

Learning in AI Learning algorithms in AI –Neural networks –Probabilistic learning –Genetic learning algorithms Common attributes –Requires time Usually thousands of cycles –Results are unpredictable Will create any rules that decrease error, not necessarily the ones that make the most sense in a game Still very limited –No algorithm to automatically generate something as complex as a FSM Not what you want to happen in a game! “Create an opponent that can defeat Data”

Online Learning Learning most useful if occurs during game –Must be as efficient as possible Simple methods best –Hill climbing –N-Gram prediction –Decision tree learning Most successful methods often specific to game –Example: Negative influences at character destruction locations Unknown enemy unit Our unit destroyed Other units steer around this area

Scripted Learning Can “fake” appearance of learning –Player performs action –Game AI knows best counteraction, but does not perform it –Game AI allows player certain number of that action before beginning to perform counteraction Like timeout Number could be chosen at random –Gives appearance that character has “learned” to perform counteraction Player allowed to attack from right for certain number of turns AI begins to defend from right after that point

Scripted Learning Scripting in cannon game: –Compute actual best trajectory using physics –Add error factor E to computation –Decrease error E over time at rate Δ E Test different values of Δ E to make sure learns at “same rate” as typical player Can also different values of Δ E to set “difficulty” level Correct trajectory Large E Small E

Hill Climbing Simple technique for learning optimal parameter values Character AI described in terms of configuration of parameter values V = (v 1, v 2, … v n ) –Example: Action probabilities for Oswald –V = (P left, P right, P defend ) Attack Left45% Attack Right30% Defend25% Oswald’s current V = (0.45, 0.30, 0.25)

Hill Climbing Each configuration of parameter values V = (v 1, v 2, … v n ) has error measure E(V ) –Often an estimate based on success of last action(s) Example: Total damage taken by Oswald – Total damage caused by Oswald’s last 3 actions Good enough for hill climbing Goal of learning: Find V such that E(V ) is minimized –Or at least “good enough” Attack Left35% Attack Right25% Defend40% Configuration with low error measure

Hill Climbing Hill climbing works best for –Single parameter –Correctness measure which is easy to compute Example: “cannon game” –Only parameter: Angle Ө of cannon –Error measure: Distance between target and actual landing point Error Ө

Error Space Graphical representation of relationship between parameter value and correctness Hill climbing = finding “lowest point” in this space Ө Error Optimal Ө Ө Error = 0 Maximum correctness

Hill Climbing Algorithm Assumption: –Small change in one direction increases correctness –Will eventually reach optimal value if keep changing in that direction Ө Error Ө2Ө2 Ө3Ө3 Ө1Ө1 Direction of decreasing error Ө3Ө3 Ө2Ө2 Ө1Ө1

Hill Climbing Algorithm Estimate direction of slope in local area of error space –Must sample values near E(Ө) E(Ө + ε) E(Ө - ε) Move in direction of decreasing error –Increase/decrease Ө by some given step size δ –If E(Ө + ε) < E(Ө - ε) then Ө = Ө + δ –Else Ө = Ө – δ Ө Ө+εӨ+εӨ-εӨ-ε Ө + δ

Multidimensional Error Space Exploring multiple parameters simultaneously –Probabilities for Attack Left, Attack Right, Defend –Ability to control “powder charge” C for cannon as well as angle Ө Vary parameters slightly in all dimensions –E(Ө + ε, C + ε) E(Ө + ε, C – ε) –E(Ө – ε, C + ε) E(Ө – ε, C – ε) Choose combination with lowest error Ө 1 C 1 I need to increase both the angle and the charge

Multidimensional Error Space Can have too many parameters –n parameters = n dimensional error space –Will usually “wander” space, never finding good values If using learning keep problem simple –Few parameters (one or two best) –Make sure parameters have independent effect on error Increased charge, angle both increase distance Ө 1 C 1 I could also move up a hill, or check the wind direction…

Hill Climbing Step Size Choosing a good step size δ –Too small: learning takes too long –Too large: learning will “jump over” optimal value Ө2Ө2 Ө1Ө1 This guy is an idiot! Ө2Ө2 Ө1Ө1

Hill Climbing Step Size Adaptive Resolution –Keep track of previous error E (Ө T-1 ) If E (Ө T ) < E (Ө T-1 ) assume moving in correct direction –Increase step size to get there faster δ = δ + κ Ө2Ө2 Ө1Ө1 Ө3Ө3

Hill Climbing Step Size If E (Ө T ) > E (Ө T-1 ) assume overshot optimal value –Decrease step size to avoid overshooting on way back δ = δ × ρ, ρ < 1 –Idea: decrease step size fast Main goal: Make character actions plausible to player –Should make large changes if miss badly –Should make small changes if near target Ө1Ө1 Ө3Ө3 Ө2Ө2

Local Minima in Error Space Major assumption: Error space monotonically decreases as move towards goal Multiple shots with same result – no decrease in error

Local Minima in Error Space Local minima in error space –Places where apparent error does not decrease as get closer to optimum value –Simple hill climbing can get stuck Ө Error Optimal ӨLocal minima Hill climbing will not escape!

May need to restart with different initial value –Use randomness –Something very different from last starting point –Plausible behavior – if current actions not working, try something new Local Minima in Error Space Multiple shots with same result Very different result

Memory and Learning What if player moves? –Should not have to restart learning process –Should keep appearance that character is slowly improving aim Should quickly adapt to changes in player strategy Ө3Ө3 Ө2Ө2 Ө1Ө1 Ө4Ө4

Memory and Learning Remember previous actions and effects –Store each angle Ө tried and resulting distance D(Ө) –If player moves to location L, start from Ө whose D(Ө) is closest to L Ө3Ө3 Ө2Ө2 Ө1Ө1 Closest to new player location is Ө 2 D(Ө2)D(Ө2)D(Ө3)D(Ө3)D(Ө1)D(Ө1) D(Ө2)D(Ө2)D(Ө3)D(Ө3)D(Ө1)D(Ө1)