artificial intelligence in gaming
TRANSCRIPT
Artificial IntelligenceINTRODUCTION, GAMING & APPLICATIONS
Satvik JagannathSoftware Development Engineer
CVG, CISCO
Agenda Definitions of Artificial Intelligence Introduction to Artificial Intelligence What does “ARTIFICIAL” INTELLIGENCE “REALLY” mean? AI is not building robots Problem Solving Algorithms and Concepts of AI in Gaming AI Game – Code and Demo Applications of AI in Gaming Logical and Contextual Reasoning Google Deepmind and AlphaGo Artificial Super Intelligence – Videos Battlefield 1 and FIFA 17 Hands on Demo A day made of Glass
Definitions of Artificial IntelligenceFORMAL DEFINITIONS
Definitions of AI
The theory and development of computer systems able to perform tasks normally requiring human intelligence, such as visual perception, speech recognition, decision-making, and translation between languages.
Formal Wikipedia Definition
Definitions of AI
Artificial Intelligence (AI) is usually defined as the science of making computers do things that require intelligence when done by humans.
Alan Turing
Definitions of AI
It is the science and engineering of making intelligent machines, especially intelligent computer programs. It is related to the similar task of using computers to understand human intelligence, but AI does not have to confine itself to methods that are biologically observable.
John McCarthy, Computer Science Dept., Stanford
Definitions of Artificial Intelligence
HOW AI EXPERTS AND RESEARCHERS DEFINE
Definitions of AI
Warning: Cynical Definition...My definition of AI is any algorithm that is new in computer science. Once the algorithm becomes accepted then it's not AI, it's just a boring algorithm.At one time windows, mouse, menus, scroLlbars etc. were considered an AI technique for making computers understand natural language. (The menus are a list of valid words the system understands)This is also why I study "Cognition", not AI.
R. Keen
Dick Keene, Sun Microsystems, Inc.
Definitions of AI
Artificial Intelligence - an area of computer science that follows the credo, "When in doubt, use a graph search!!”
Jared L. ColfleshmDept. of Computer Science, University of Virginia
Definitions of AI
Artificial Intelligence - a subfield of computer science devoted to the construction of extremely complex programs that do not work.
Frank Z. BrillApplied Mathematics, CSSamsung
Definitions of AI
Artificial Intelligence:void Duh( void ) {
while (thinking)Duh();
}
Robert C. Craighurst
Definitions of AI
A year spent in artificial intelligence is enough to make one believe in God.Artificial Intelligence is no match for natural stupidity.Artificial Intelligence? I'll be impressed when they come up with artificial CUNNING.Robots do it with artificial intelligence.
sent by Adam Rifkin([email protected])
Introduction to Artificial Intelligence
https://www.youtube.com/watch?v=fvtrRGmv7aU
AI is not just building Robots!
Robots are “real object representation of an AI engine” An AI Engine is considered something that can do one or more of
the following Act Humanly Think Humanly Think Rationally Act Rationally
Act Humanly – The Turing Test Approach
Intelligent behavior is the ability to achieve Human-like performance in all cognitive tasks
The system would need to possess the following capabilities: Natural Language Processing – Enable communication Knowledge Representation – Store information Automated Reasoning – Analyze information and draw solutions Machine Learning – Detect and extrapolate patterns
Total Turing Test: Computer Vision – Perceive objects Robotics - Mobility
Think Humanly – Cognitive Modelling Approach
The most complicated problem, which is yet to be completely solved : HUMAN BRAIN!
How does a Human Brain work? Can computers behave like us? Emotions? //EML Cognitive Modelling is achieved through
Introspection Physiological Experiments
AI and Cognitive Science fertilize each other
Human Brain
https://www.youtube.com/watch?v=JiTz2i4VHFw
Thinking Rationally – The laws of thought approach
Aristotle coined the word “right thinking” His famous “Laws of Syllogisms” provided patterns and logics
Socrates is a man; All men are mortal; Therefore Socrates is mortal. Simple working principle:
Input : Take Description of problem in a logical notationOutput: Find solution to the problem if one exists
else, the system shall never stop looking Problem : Giving formal inputs, not sure of a 100% solution
Acting Rationally – The rational agent approach
An agent is something that perceives and acts Correct inferences and conclusions Reflex action like humans (not just about correctness! time) Expectation : 100% rational like human Reality : limited rationality as –
Environment is usually complex Computational demands are too high
Problem Solving
Desired outcome
based on context based on chance
DecisionWhat to do sequence of actions
Problem Solving AgentProblem Various solutions
Steps to solve a problem
Problem : Collection of information that the agent will use to decide what to do
Initial State : The initial state that the agent knows itself to be in Operator : Set of possible actions which decide the next state Successor function : Given a state ‘x’, S(x) will return a set of states
that is reachable from ‘x’ State space : Set of all states reachable from the initial state by any
sequence of actions Path : Any sequence Path Cost Function : Assigns a cost to the path Solution : Path from initial state to a state that satisfies the goal test
Example – Simplified roadmap of Romania
8 Puzzle Problem
8 Puzzle Problem
State : location of each tile Operators : blank moves left, right, up or down Goal Test : if state matches the goal Path Cost : each step costs 1 i.e., length of traversal/path
This is an example of NP-Complete problem. Other examples- 15 Puzzle Problem, 8 Queens Problem etc., These are the best problems to implement AI search algorithms
Search techniques
Breadth First Search Uniform Cost Search Depth First Search Depth Limited Search Bi-Directional Search (Memory Intensive!!) Backtracking Search Forward-checking Search
Best First Search
Applied on General Search An evaluation function returning number of desirable outcomes
on expanding the node
Greedy Search
Minimize estimated cost to reach the goal Heuristic function, h(n) that calculates the minimum cost
Map with Distances
Greedy First Approach to find Bucharest
A* Algorithm - Minimizing the Total Path Cost
Greedy search minimizes the estimated cost to goal, h(n) Uniform search minimizes the cost of the path so far, g(n) Combining these 2 strategies would give the estimated cost of
the cheapest solution i.e., f(n) = h(n) + g(n)
A* Approach to find Bucharest
Google NowA data aggregator and data mining
https://www.youtube.com/watch?v=pPqliPzHYyc
A* AI based on JS, HTML5 game
Path finding algorithms are building blocks of AI Simple puzzle game to deep strategy game Obstacle detection and avoidance In most games
Walk around obstacles Find path out of a maze Reach destination ‘B’ from start point ‘A’ Quickest or Shortest possible route Etc..,
Origins of Path Finding AI : Dijkstra’s
Early implementations of Diskstra’s algorithm of finding efficient routes of any hypothetical situation
Best choice of route Travelling from A->B adds up cost
Problems with Dijkstra’s
Naïve implementation – No ‘most likely candidates first’ Solution is got after each & every candidate is tested
A* to the rescue
Best first, graph search algorithm that finds the least cost path from given initial node to the goal node
… more Optimization
Assign weights to nodes along the way and predict direction By using such aggressive heuristic approaches we can predict the
“Most Likely Best Direction”
Games are AI?Not really!
They are GAME AIFor sure not Academic AI
Game AI is an algorithm that replaces randomness.
AI in Games
Good Game AI is an algorithm that provides superior designed results to randomness.
Football Manager doesn't use Neural Networks - it uses standard decision based AI with some learning aspects associated with them through recording of previous resultant effects but it can't be said to be a 'pure' approach in either manner.
Perception, Path Finding, Behavior Trees Navigation Mesh
AI Game
Sprite sheet
Generate a random map or world Obstacles Find path from A to B Using A*
AI Game : HTML
AI Game : JS
AI Game : JS
AI Game : JS
AI Game : JSLet’s actually draw on the screen
AI Game : JSLet’s actually draw on the screen
AI Game : JS
AI Game : JSA* Algo
AI Game : JSA* Algo
AI Game : JS
More code on IDE and Live Demo
Vector Field Collision Avoidance
This method provides “intelligent” behaviors in a wide class of games with very simple and highly reusable code.
We can use Vector Field algo on top of any Path finding algo More optimal and easy to implement More realistic is collision avoidance Vector field concept from Math
Vector Field Collision Avoidance
Vector implementation can be as simple as
Vector Field Collision Avoidance
Force can be anything – Gravity, Wind etc.,
Vector Field Collision Avoidance
Most convenient property of a Vector is “Sum” Multiple forces? No problem! Just add them all!!
Knowledge and Reasoning
Minmax algorithm is used to find the most optimal strategy for the MAX, thereby giving the BEST FIRST MOVE
Chess Game Evaluation
Chess Game Evaluation
Chess Game Evaluation
Chess Game Evaluation
Agents behind logical reasoning
Siri, Cortana are the 2 most popular applications These two assistants churn solution sets to perfectly match your
query unlike Google Now(most of it) New developments
Conversational Interface Personal Context Awareness Service Delegation Recurring Machine Learning
SiriNLP, logical reasoning and recurring ML
https://www.youtube.com/watch?v=8ciagGASro0
Logical Reasoning
Algorithm – Logic + Control Inferences are done by Backward Chaining, using DFS When we hit a dead-end, backs up to most recent step having
alternatives Order of search : Left to Right Clauses in Knowledge Base are applied : First to Last Constraint Logical Programming Meta-reasoning : Reordering of solution set, reasoning about
reasoning
Planning – Every possible move in solution set
Compiler
The best planning & strategy engine Real time, errors as you type Can GCC or javac be called as an AI? How about Javascript? Dynamic Scope! Some thoughts on 1-pass compiler (by Mozilla)
Contextual Reasoning
Reasoning based on position of current state w.r.t. its neighbors Context can be power/strength of neighbors (CS 1.6 game) Context can be time of the day (Facebook) Context can be priority or importance Context can also be the flow Two or more of the above factors can also for contexts of n-
dimensions Example of n-dimensional context GUNAI app
GUNAI
Time factor Context based Data Collection Recurring Machine Learning Adaptive Reasoning Greedy to Learn Correlation Smartest sidebar
https://www.youtube.com/watch?v=4aOYjS1yHhE
Correlation
ML on Twitter Trends
One of the research papers I have written with colleagues Problem : Twitter has humongous real-time tweets Reason why #HashTag is trending is always a ‘?’ Streaming data aggregation Filtering Correlation Relevant tweets Demo
Google’s Deepmind
Google Deepmind beat world champion in Go game Program with AI and Human Intuition Outsmarted Human Brain by using Reinforcement Learning and
Neural Networks rather than just Brute Force Deepmind AI is general purpose There is no Model, it just takes any set of ‘start’ & ‘end’ rules of a
game to learn with possibilities or tasks Our minds are capable of so much, its just about how much we
use it
Go’s possibilities
Brute force was never an option!
AlphaGo
https://www.youtube.com/watch?v=53YLZBSS0cc
Artificial Super Intelligence
Currently a hypothetical agent that posses intelligence which surpasses the brightest human minds in all aspects
Google Deepmind can be one! Achieved - recursive self-improvement Intelligence Explosion – formation of an ASI It can discover or invent anything just like us Take relative decisions Ability to learn with less supervision Reinforcement learning – inherently
ASI
https://www.youtube.com/watch?v=fvtrRGmv7aU
ASI – Person Of Interest
https://www.youtube.com/watch?v=mYmVMH0-tlY
ASI – Chess Game
https://www.youtube.com/watch?v=iz5EFsSbQ7U
Interesting Number : PI
Every thing in the world can be defined in terms on one number
https://www.youtube.com/watch?v=4RldHTtd3O8
AI for Games : Chess
Probabilities Piece Values Strategic Planning
https://www.youtube.com/watch?v=Ffg2l3NtiAQ
AI for Games
AI in Games : Battlefield 1
Counter Strike Call of Duty Battlefield 1 Multi-player strategy Multi-dimensional forces Not just winning, building and saving team
https://www.youtube.com/watch?v=c7nRTF2SowQ
AI in Games : FIFA
Game based on real player moves Game Strategy Multiple players applying their best movement
https://www.youtube.com/watch?v=-3fjoe5Njpc
Demo
Capturing relevant data Learn GraphDB Neo4J, GraphQL Understand Graph Search Why is it efficient? Complex queries Facebook (Friends, Suggestion, Post Recommendation, Timeline)
A Day made of GlassNot just AI, but, a real life of the future
https://www.youtube.com/watch?v=PfgmlVxLC9w
References
Artificial Intelligence - A Modern Approach by Stuart J. Russell and Peter Norvig https://neo4j.com/blog/why-the-most-important-part-of-facebook-graph-search-i
s-graph/
http://www.alanturing.net/turing_archive/pages/reference%20articles/what%20is%20ai.html
https://www.quora.com/Which-Artificial-Intelligence-algorithms-are-used-in-a-game-like-Fifa-Football-or-PES-Pro-Evolution-Soccer
https://www.quora.com/What-are-some-gaming-companies-that-use-artificial-intelligence
https://www.quora.com/Which-artificial-neural-network-learning-rule-does-Football-Manager-Game-use
http://buildnewgames.com/vector-field-collision-avoidance/ http://buildnewgames.com/astar
Thank You
Satvik Jagannath Twitter, Github : @bozzmob