1 / 12

AI – Week 8 2 Player Games

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

Sharon_Dale
Télécharger la présentation

AI – Week 8 2 Player Games

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. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. AI – Week 82 Player Games Lee McCluskey, room 2/09 Email lee@hud.ac.uk http://scom.hud.ac.uk/scomtlm/cha2555/

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

  3. 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)

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

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

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

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

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

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

  10. 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)

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

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

More Related