Game Playing in Artificial Intelligence�
Areas of Interest
NB
One of the most studied and most interesting areas of Artificial Intelligence is game playing. They are Fun, and HARD to create
23-Mar-2009
Artificial Intelligence - CMT310
2
DEFINITION
23-Mar-2009
Artificial Intelligence - CMT310
3
Definition cont …
23-Mar-2009
Artificial Intelligence - CMT310
4
Why are games relevant to AI?
23-Mar-2009
Artificial Intelligence - CMT310
5
State Space
23-Mar-2009
Artificial Intelligence - CMT310
6
The Illusion of Human Behaviour
23-Mar-2009
Artificial Intelligence - CMT310
7
Computer Games Types
23-Mar-2009
Artificial Intelligence - CMT310
8
More complicated games
23-Mar-2009
Artificial Intelligence - CMT310
9
The functionalism of game AI
→ Pseudo-autonomy: limited knowledge, ‘personal’ goals etc.
23-Mar-2009
Artificial Intelligence - CMT310
10
History and overview
- Developed by John von Neumann in 1928
- This algorithm is used extensively in game theory
- The program learns through the manipulation of the summation of heuristics.
- If the program wins, it raises high heuristic values and lowers low ones. If it loses, it does the opposite.
- Progress and success in Game AI.
- Creating a successful AI meant coming up with the right rules for it to follow.
1970s-1980s
- Transition to games as entertainment
- Using search based AI to emulate entertaining characters would be unnatural and clumsy
- Game play is based more on skill than on rules
- Increased realism becomes the primary focus of the game industry
- A rift develops between the developers of popular games and AI researchers
23-Mar-2009
Artificial Intelligence - CMT310
11
Examples:
First Person Shooters (Halflife, Deus Ex, Unreal Tournament): “Suicidal” AI is replaced by more sophisticated AI that appears to care about its own life. It coordinates attacks, calls for backup, and retreats when hurt. Friendly AI can even be given orders by the player.
Real Time Strategy: AI in the broad scheme doesn’t evolve much in RTS games. Individual unit scripts are added in to some games, but in the over all picture, the AI still simply pours units at an enemy until it is defeated. Perhaps this is because of the foreignness of the RTS paradigm, or maybe it really is the best strategy. Most successful human players abide by this “rush” strategy.
23-Mar-2009
Artificial Intelligence - CMT310
12
Late 1990s
- To add intrigue, developers look again to AI
CONCEPTS�Technologies / techniques used
23-Mar-2009
Artificial Intelligence - CMT310
13
Techniques / Technologies used
23-Mar-2009
Artificial Intelligence - CMT310
14
Game setup
23-Mar-2009
Artificial Intelligence - CMT310
15
How to Play a Game by Searching
23-Mar-2009
Artificial Intelligence - CMT310
16
The Minimax Rule
23-Mar-2009
Artificial Intelligence - CMT310
17
Minimax Procedure
23-Mar-2009
Artificial Intelligence - CMT310
18
Consider a 2-ply (two step) game:
Max want’s largest outcome --- Min want’s smallest.
MinMax - Overview
23-Mar-2009
Artificial Intelligence - CMT310
19
Minimax Algorithm
23-Mar-2009
Artificial Intelligence - CMT310
20
function MINIMAX-DECISION(state) returns an action
inputs: state, current state in game
v←MAX-VALUE(state)
return the action in SUCCESSORS(state) with value v
function MIN-VALUE(state) returns a utility value
if TERMINAL-TEST(state) then return UTILITY(state)
v ← ∞
for a,s in SUCCESSORS(state) do
v ← MIN(v, MAX-VALUE(s) )
return v
function MAX-VALUE(state) returns a utility value
if TERMINAL-TEST(state) then return UTILITY(state)
v ← -∞
for a,s in SUCCESSORS(state) do
v ← MAX(v, MIN-VALUE(s) )
return v
Properties of minimax
23-Mar-2009
Artificial Intelligence - CMT310
21
Alpha-Beta Pruning
23-Mar-2009
Artificial Intelligence - CMT310
22
2
7
1
=2
>=2
<=1
?
α−β Pruning Example
23-Mar-2009
Artificial Intelligence - CMT310
23
≥ 3
MAX
MIN
=3
3
12
8
2
X
X
≤ 2
14
≤ 14
5
≤ 5
2
=2
=3
Alpha-Beta Pruning
23-Mar-2009
Artificial Intelligence - CMT310
24
Alpha-Beta Algorithm 1�MAX Ply
23-Mar-2009
Artificial Intelligence - CMT310
25
function ALPHA-BETA-SEARCH(state) returns an action
inputs: state, current state in game
v←MAX-VALUE(state, - ∞ , +∞)
return the action in SUCCESSORS(state) with value v
function MAX-VALUE(state,α , β) returns a utility value
if TERMINAL-TEST(state) then return UTILITY(state)
v ← - ∞
for a,s in SUCCESSORS(state) do
v ← MAX(v,MIN-VALUE(s, α , β))
if v ≥ β then return v
α ← MAX(α ,v)
return v
Alpha-Beta Algorithm II�MIN Ply
23-Mar-2009
Artificial Intelligence - CMT310
26
function MIN-VALUE(state, α , β) returns a utility value
if TERMINAL-TEST(state) then return UTILITY(state)
v ← + ∞
for a,s in SUCCESSORS(state) do
v ← MIN(v,MAX-VALUE(s, α , β))
if v ≤ α then return v
β ← MIN(β ,v)
return v
α-β
🡪 doubles depth of search
23-Mar-2009
Artificial Intelligence - CMT310
27
Minimax for nondeterministic games
23-Mar-2009
Artificial Intelligence - CMT310
28
3
Deterministic games in practice
Othello: Human champions refuse to compete against computers, who are too good.
Go: Human champions refuse to compete against computers, who are too bad. In Go, b > 300, so most programs use pattern knowledge bases to suggest plausible moves.
23-Mar-2009
Artificial Intelligence - CMT310
29
23-Mar-2009
Artificial Intelligence - CMT310
30
APPLICATIONS
23-Mar-2009
Artificial Intelligence - CMT310
31
- Every person is an expert on
human-level intelligence
- Testing of AI is easy
- Crowd scenes
- Flocking behavior
- Realistic Movement
Applications
23-Mar-2009
Artificial Intelligence - CMT310
32
- Job-shop scheduling for the NASA space shuttle,
- Elevator dispatch control
- Cellphone channel assignment
- Assembly-line manufacturing
Applications
23-Mar-2009
Artificial Intelligence - CMT310
33
To adapt hierarchical task-network planning techniques for use in BRIDGE GAME, ways for the planner to perform complex numeric calculations, plan for multiple agents, consult external information sources, and reason about uncertain information were developed.
These same techniques are now proving useful in generating and evaluating manufacturing process plans
Applications
Game AI Major Challenges
- Realism in computer games focused on graphics
- Advanced graphics requires many CPU cycles
- Recent advances in computer hardware have someone alleviated this issue.
- Game engine must be developed before AI can be tested
- AI programmers often have to compromise to meet deadlines
- Perfect AI would be easier to code
- It would lack believability and not be fun.
- Human-level AI should quit, surrender, or run away- even fight to the end.
- Lack of cohesion between AI research community and game developers
- AI in modern computer games seems trivial to AI researchers
23-Mar-2009
Artificial Intelligence - CMT310
34
- Human level behavior will require AI
- We currently have only limited behavior
- Human level intelligence is really hard to create and
we still do not know how to achieve it
23-Mar-2009
Artificial Intelligence - CMT310
35
TRENDS of Game AI
23-Mar-2009
Artificial Intelligence - CMT310
36
Changes in Games Development
23-Mar-2009
Artificial Intelligence - CMT310
37
Changes in Gaming
23-Mar-20009
Artificial Intelligence - CMT310
38
Changes in Game Fidelity
23-Mar-20009
Artificial Intelligence - CMT310
39
Changing Game Players
23-Mar-2009
Artificial Intelligence - CMT310
40
The Industry Now
23-Mar-2009
Artificial Intelligence - CMT310
41
- Broadband and online multiplayer games
- Highly immersive AI to contrast real players
Examples:
Multiplayer Games (Battlefield 1942): The AI in this game is outright pitiful. While it excels at pathfinding, using tanks, planes, ships, and other implements, it is simply not human-like behavior. Among other things, the AI lacks a reasonable strategy. Instead of sending all of its troops to the front lines, it distributes them equally throughout the map. It often has trouble deciding whether it should shoot an enemy or simply lie down and stand up repeatedly.
Immersive AI (Halo): Because of the plotline in this game, the friendly AI acts largely autonomously. While the human player is the “leader,” this only extends to the AI’s protection, not its obedience. This is also reflected in the opponent AI. When attacking a group of AI controlled enemies, if the leader is removed first, the remaining force becomes less effective and less organized.
23-Mar-2009
Artificial Intelligence - CMT310
42
THE FUTURE OF GAME AI
- Sims weren’t smart at all
- Instead, surrounding objects contained instructions for use
- AI finds the object that makes them happy and follows instructions
- Rule based AI is not sufficient to model human intelligence
- Uncertain algorithms such as Genetic Algorithms and Neural Networks are the future
- Instead of creating a reality, the AI borrows from the real world
- Will a game AI be the first to pass the Turing Test?
23-Mar-2009
Artificial Intelligence - CMT310
43
Future of AI games cont …
World Fillers
Better Opposition
23-Mar-2009
Artificial Intelligence - CMT310
44
Summary�
23-Mar-2009
Artificial Intelligence - CMT310
45
Philosophical Food for thought
23-Mar-2009
Artificial Intelligence - CMT310
46
Bibliography
23-Mar-2009
Artificial Intelligence - CMT310
47