Download presentation
Presentation is loading. Please wait.
1
AI – Week 8 AI + 2 Player Games Lee McCluskey, room 3/10 Email lee@hud.ac.uklee@hud.ac.uk http://scom.hud.ac.uk/scomtlm/cha2555/
2
Artform Research Group RECAP – SYMBOLIC AI n Representing “knowledge” (rather than just “data”) Usually done using “logic” or some other “declarative” language eg using PDDL to represent knowledge about actions n Reasoning – like planning, learning, problem solving, inference Usually done using SEARCH eg nodes contain states of the world, arcs represent action execution. Heuristics can make search feasible. -
3
Artform Research Group Games and Leisure applications AI point of view: Feasible application of AI because we can abstract from the “real world” Computer games and virtual worlds point of view: they tend to be more appealing if n they are realistic: their virtual world appears to embody the physical laws of the natural world, eg gravity, lighting. u achieved by good graphics n they are believable: human characters’ behaviour resemble human behaviour, NPC’s are rational u 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.
4
Artform Research Group 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 EXTERNAL ENVIRONMENT (eg real world) sensorseffectors
5
Artform Research Group Reactive “intelligence” n Behaviour of NPCs: Use an FSM n State of NPCs: Use a set of attribute-value pairs n Transitions can be random to give the appearance of unexpected behaviour wander retreat attack Search for food Detect enemy Low energy Detect enemy
6
Artform Research Group AI – predictive, deliberative, goal directed n We could us automated planning to help characters appear believable 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! n 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.
7
Artform Research Group AI in Turn-Based, 2-player Games Assume: n Take one turn each n World state is knowable / calculable n Players will always try the ‘best’ move n A world state can be evaluated to decide if it is better than another World state = game state (eg board situation) Action = move a piece Goal = win game, or maximise gains AI move generating program = search tree of possible future board situations to find goal TAKING OPPONENT INTO ACCOUNT
8
Artform Research Group Search in 2-player games: Game Tree A 2 player “game tree” is a tree where n nodes are “boards” (game situations) n uni-directional arcs are “moves” connecting one board to another, and alternative arc layers of the tree represent alternative player’s moves n the route node is the initial board n Each node can be given a value with respect to one of the players, depending how good the board situation is for that player n depth of the tree is sometimes called its “ply”.
9
Artform Research Group Search in 2-player games: Minimax Minimax 1. Using breadth first search create a “game tree” to a certain depth n (n-ply) 2. Start at the leaves and evaluate each board. 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. 4. Continue till the root is reached 5. Make the move which maximises the values of the nodes connecting the root
10
Artform Research Group Minimax with alpha/beta pruning Minimax + alpha/beta pruning is a good heuristic as it SAVES RESOURCE but always gives the SAME, optimal answer as mini-max Minimax with alpha/beta Change STEP 3: n When evaluating nodes at a layer, check the current value at the layer above. IF continuing to evaluate nodes in the layer is useless, then stop. This happens if n AT A MAX layer: we find a node with higher value than current MIN in the layer above n AT A MIN layer: we find a node with a lower value than the current MAX found in the layer above
11
Artform Research Group Other Heuristics n 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”. n 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)
12
Artform Research Group Other types of Games n 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 n 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’ n Games that Learn – using AI Games techniques the “deliberation” aspect can be used to support learning by experience.
13
Artform Research Group Summary n AI search techniques have been used in Two Player Games very successfully for years. n The most common techniques are based on games tress, mini-max, and alpha-beta pruning
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.