Ai week 8 2 player games
Download
1 / 12

Lecture Notes - PowerPoint PPT Presentation


  • 256 Views
  • Updated On :

AI – Week 8 2 Player Games. Lee McCluskey, room 2/09 Email [email protected] http://scom.hud.ac.uk/scomtlm/cha2555/. Games and Leisure applications. Computer games and virtual worlds tend to be more appealing if

loader
I am the owner, or an agent authorized to act on behalf of the owner, of the copyrighted work described.
capcha
Download Presentation

PowerPoint Slideshow about 'Lecture Notes' - Sharon_Dale


An Image/Link below is provided (as is) to download presentation

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.


- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -
Presentation Transcript
Ai week 8 2 player games l.jpg

AI – Week 82 Player Games

Lee McCluskey, room 2/09

Email [email protected]

http://scom.hud.ac.uk/scomtlm/cha2555/


Games and leisure applications l.jpg
Games and Leisure applications

Computer games and virtual worlds tend to be more appealing if

  • they are realistic: their virtual world appears to embody the physical laws of the natural world, eg gravity, lighting.

    • achieved by good graphics

  • they are believable: human characters’ behaviour resemble human behaviour, NPC’s are rational

    • achieved by good AI

      Eg South Park, Wallace and Grommet, Donald Duck are “believable” animations but not very realistic! People recognise and empathise with characters through the narrative … rather than through their physical characteristics

      AI techniques can be embedded in opponents, other characters, or the environment to make the game more believable.


Reactive intelligence l.jpg
Reactive “intelligence”

Most current games with virtual environments use programmed behaviour via reactive condition-action rules to mimic intelligence

BELIEF/

WORLD

STATE

SET OF

CONDITION-

ACTION RULES

sensors

effectors

EXTERNAL

ENVIRONMENT

(eg real world)


Reactive intelligence4 l.jpg
Reactive “intelligence”

Representation of NPCs tends to be done using FSM

More sophisticated (eg SIMS) – each character represented as a Frame (object) with qualities, needs, etc

Transitions choice random to give the appearance of unexpected behaviour

attack

Detect enemy

Low energy

wander

Detect enemy

Search for food

retreat


Ai predictive deliberative goal directed l.jpg
AI – predictive, deliberative, goal directed

  • We could automated planning to help characters in virtual environments. They could be given goals, and it would be up to them to plan to meet them.

    However, if the game is adversarial and tightly coupled, planning on its own would be useless!

  • In adversarial, tightly coupled, turn-based games (chess, draughts, connect-4, card games, strategy games..) AI techniques have been well- developed to enable computer move generation.


Ai in turn based 2 player games l.jpg
AI in Turn-Based, 2-player Games

Assume:

  • Take one turn each

  • World state is knowable / calculable

  • Players will always try the ‘best’ move

  • A world state can be evaluated to decide if it is better than another

    World state = game state (eg board situation)

    Action = move pieces

    Goal = win game, or maximise gains

    AI move generating program = search tree of possible

    future board situations and look for the most

    Promising move


Search in 2 player games game tree l.jpg
Search in 2-player games: Game Tree

A “game tree” is a tree where

  • nodes are “boards” (game situations)

  • uni-directional arcs are “moves” connecting one board to another, and alternative arc layers of the tree represent alternative player’s moves

  • the route node is the initial board

  • Each node can be given a value with respect to one of the players, depending how good the board situation is for that player

  • depth of the tree is sometimes called its “ply”.


Search in 2 player games minimax l.jpg
Search in 2-player games: Minimax

Minimax

  • Using breadth first search create a “game tree” to a certain depth n (n-ply)

  • Start at the leaves and evaluate each board.

  • Find the min or max of each board set depending on who is making the move, and attach this value to the node directly about the leaves.

  • Continue till the root is reached

  • Make the move which maximises the values of the nodes connecting the root


Minimax with alpha beta pruning l.jpg
Minimax with alpha/beta pruning

Minimax + alpha/beta pruning is an admissible heuristic:

it SAVES RESOURCE but always gives the SAME, optimal answer as mini-max

Minimax with alpha/beta

Change STEP 3:

  • Find the min or max of each board set depending on who is making the move, and attach this value to the node directly about the leaves.

    IF continuing to evaluate nodes is useless, then stop. This happens if

  • AT A MAX layer: we find a node with higher value than one already found in the layer above

  • AT A MIN layer: we find a node with a lower value than one already found in the layer above


Other heuristics l.jpg
Other Heuristics

  • The minimax has problems if the search is stopped when “there is a lot going on”. If the evaluation function only evaluates piece values, then the minimax can suffer from the Horizon effect: a board is evaluated to be good when in fact the next move proves disasterous.

    Heuristic: grow the tree when boards are in a state of “flux”. Do not grow boards that are “quiet”.

  • Minimax with alpha-beta pruning is still very resource hungry for games like chess.

    Heuristic: at each ply, evaluate the boards FIRST, sort them into order, and search only the ones that are the highest/lowest value (depending on whether it is a max or min ply)


Other types of games l.jpg
Other types of Games

  • N-Player: There are N-player versions of minimax, but these have to have assumptions about the other player built in (eg that the other players do not ‘gang-up’ on one). These can be used in Poker etc

  • Imperfect Information: Some Games (esp card games) players have imperfect world knowledge. In these cases the player/computer can use n-person minimax but has the added complication of using probabilities / constraints to evaluate opposing player’s ‘hands’

  • Games that Learn – using AI Games techniques the “deliberation” aspect can be used to support learning by experience.


Summary l.jpg
Summary

  • AI Gaming is characterized by goal directed behaviour, deliberation and reasoning. Search and state evaluation are used to implement these.


ad