artificial intelligence in gaming

86
Artificial Intelligence INTRODUCTION, GAMING & APPLICATIONS Satvik Jagannath Software Development Engineer CVG, CISCO

Upload: satvik-jagannath

Post on 26-Jan-2017

176 views

Category:

Data & Analytics


3 download

TRANSCRIPT

Page 1: Artificial Intelligence in Gaming

Artificial IntelligenceINTRODUCTION, GAMING & APPLICATIONS

Satvik JagannathSoftware Development Engineer

CVG, CISCO

Page 2: Artificial Intelligence in Gaming

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

Page 3: Artificial Intelligence in Gaming

Definitions of Artificial IntelligenceFORMAL DEFINITIONS

Page 4: Artificial Intelligence in Gaming

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

Page 5: Artificial Intelligence in Gaming

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

Page 6: Artificial Intelligence in Gaming

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

Page 7: Artificial Intelligence in Gaming

Definitions of Artificial Intelligence

HOW AI EXPERTS AND RESEARCHERS DEFINE

Page 8: Artificial Intelligence in Gaming

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.

Page 9: Artificial Intelligence in Gaming

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

Page 10: Artificial Intelligence in Gaming

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

Page 11: Artificial Intelligence in Gaming

Definitions of AI

Artificial Intelligence:void Duh( void ) {

while (thinking)Duh();

}

Robert C. Craighurst

Page 12: Artificial Intelligence in Gaming

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])

Page 13: Artificial Intelligence in Gaming

Introduction to Artificial Intelligence

https://www.youtube.com/watch?v=fvtrRGmv7aU

Page 14: Artificial Intelligence in Gaming

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

Page 15: Artificial Intelligence in Gaming

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

Page 16: Artificial Intelligence in Gaming

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

Page 17: Artificial Intelligence in Gaming

Human Brain

https://www.youtube.com/watch?v=JiTz2i4VHFw

Page 18: Artificial Intelligence in Gaming

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

Page 19: Artificial Intelligence in Gaming

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

Page 20: Artificial Intelligence in Gaming

Problem Solving

Desired outcome

based on context based on chance

DecisionWhat to do sequence of actions

Problem Solving AgentProblem Various solutions

Page 21: Artificial Intelligence in Gaming

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

Page 22: Artificial Intelligence in Gaming

Example – Simplified roadmap of Romania

Page 23: Artificial Intelligence in Gaming

8 Puzzle Problem

Page 24: Artificial Intelligence in Gaming

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

Page 25: Artificial Intelligence in Gaming

Search techniques

Breadth First Search Uniform Cost Search Depth First Search Depth Limited Search Bi-Directional Search (Memory Intensive!!) Backtracking Search Forward-checking Search

Page 26: Artificial Intelligence in Gaming

Best First Search

Applied on General Search An evaluation function returning number of desirable outcomes

on expanding the node

Page 27: Artificial Intelligence in Gaming

Greedy Search

Minimize estimated cost to reach the goal Heuristic function, h(n) that calculates the minimum cost

Page 28: Artificial Intelligence in Gaming

Map with Distances

Page 29: Artificial Intelligence in Gaming

Greedy First Approach to find Bucharest

Page 30: Artificial Intelligence in Gaming

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)

Page 31: Artificial Intelligence in Gaming

A* Approach to find Bucharest

Page 32: Artificial Intelligence in Gaming

Google NowA data aggregator and data mining

https://www.youtube.com/watch?v=pPqliPzHYyc

Page 33: Artificial Intelligence in Gaming

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..,

Page 34: Artificial Intelligence in Gaming

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

Page 35: Artificial Intelligence in Gaming

Problems with Dijkstra’s

Naïve implementation – No ‘most likely candidates first’ Solution is got after each & every candidate is tested

Page 36: Artificial Intelligence in Gaming

A* to the rescue

Best first, graph search algorithm that finds the least cost path from given initial node to the goal node

Page 37: Artificial Intelligence in Gaming

… 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”

Page 38: Artificial Intelligence in Gaming

Games are AI?Not really!

Page 39: Artificial Intelligence in Gaming

They are GAME AIFor sure not Academic AI

Page 40: Artificial Intelligence in Gaming

Game AI is an algorithm that replaces randomness.

Page 41: Artificial Intelligence in Gaming

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

Page 42: Artificial Intelligence in Gaming

AI Game

Sprite sheet

Generate a random map or world Obstacles Find path from A to B Using A*

Page 43: Artificial Intelligence in Gaming

AI Game : HTML

Page 44: Artificial Intelligence in Gaming

AI Game : JS

Page 45: Artificial Intelligence in Gaming

AI Game : JS

Page 46: Artificial Intelligence in Gaming

AI Game : JS

Page 47: Artificial Intelligence in Gaming

AI Game : JSLet’s actually draw on the screen

Page 48: Artificial Intelligence in Gaming

AI Game : JSLet’s actually draw on the screen

Page 49: Artificial Intelligence in Gaming

AI Game : JS

Page 50: Artificial Intelligence in Gaming

AI Game : JSA* Algo

Page 51: Artificial Intelligence in Gaming

AI Game : JSA* Algo

Page 52: Artificial Intelligence in Gaming

AI Game : JS

More code on IDE and Live Demo

Page 53: Artificial Intelligence in Gaming

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

Page 54: Artificial Intelligence in Gaming

Vector Field Collision Avoidance

Vector implementation can be as simple as

Page 55: Artificial Intelligence in Gaming

Vector Field Collision Avoidance

Force can be anything – Gravity, Wind etc.,

Page 56: Artificial Intelligence in Gaming

Vector Field Collision Avoidance

Most convenient property of a Vector is “Sum” Multiple forces? No problem! Just add them all!!

Page 57: Artificial Intelligence in Gaming

Knowledge and Reasoning

Minmax algorithm is used to find the most optimal strategy for the MAX, thereby giving the BEST FIRST MOVE

Page 58: Artificial Intelligence in Gaming

Chess Game Evaluation

Page 59: Artificial Intelligence in Gaming

Chess Game Evaluation

Page 60: Artificial Intelligence in Gaming

Chess Game Evaluation

Page 61: Artificial Intelligence in Gaming

Chess Game Evaluation

Page 62: Artificial Intelligence in Gaming

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

Page 63: Artificial Intelligence in Gaming

SiriNLP, logical reasoning and recurring ML

https://www.youtube.com/watch?v=8ciagGASro0

Page 64: Artificial Intelligence in Gaming

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

Page 65: Artificial Intelligence in Gaming

Planning – Every possible move in solution set

Page 66: Artificial Intelligence in Gaming

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)

Page 67: Artificial Intelligence in Gaming

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

Page 68: Artificial Intelligence in Gaming

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

Page 69: Artificial Intelligence in Gaming

Correlation

Page 70: Artificial Intelligence in Gaming

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

Page 71: Artificial Intelligence in Gaming

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

Page 72: Artificial Intelligence in Gaming

Go’s possibilities

Brute force was never an option!

Page 73: Artificial Intelligence in Gaming

AlphaGo

https://www.youtube.com/watch?v=53YLZBSS0cc

Page 74: Artificial Intelligence in Gaming

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

Page 75: Artificial Intelligence in Gaming

ASI

https://www.youtube.com/watch?v=fvtrRGmv7aU

Page 76: Artificial Intelligence in Gaming

ASI – Person Of Interest

https://www.youtube.com/watch?v=mYmVMH0-tlY

Page 77: Artificial Intelligence in Gaming

ASI – Chess Game

https://www.youtube.com/watch?v=iz5EFsSbQ7U

Page 78: Artificial Intelligence in Gaming

Interesting Number : PI

Every thing in the world can be defined in terms on one number

https://www.youtube.com/watch?v=4RldHTtd3O8

Page 79: Artificial Intelligence in Gaming

AI for Games : Chess

Probabilities Piece Values Strategic Planning

https://www.youtube.com/watch?v=Ffg2l3NtiAQ

Page 80: Artificial Intelligence in Gaming

AI for Games

Page 81: Artificial Intelligence in Gaming

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

Page 82: Artificial Intelligence in Gaming

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

Page 83: Artificial Intelligence in Gaming

Demo

Capturing relevant data Learn GraphDB Neo4J, GraphQL Understand Graph Search Why is it efficient? Complex queries Facebook (Friends, Suggestion, Post Recommendation, Timeline)

Page 84: Artificial Intelligence in Gaming

A Day made of GlassNot just AI, but, a real life of the future

https://www.youtube.com/watch?v=PfgmlVxLC9w

Page 85: Artificial Intelligence in Gaming

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

Page 86: Artificial Intelligence in Gaming

Thank You

Satvik Jagannath Twitter, Github : @bozzmob