Presentation is loading. Please wait.

Presentation is loading. Please wait.

Artificial Intelligence in Game Design

Similar presentations


Presentation on theme: "Artificial Intelligence in Game Design"— Presentation transcript:

1 Artificial Intelligence in Game Design
Intelligent Decision Making and Decision Trees

2 Decision Making Based on internal and external information
Defines a current action (“eat food”) Changes world and internal state “I am hungry” “There is food nearby” “Food nearby is gone” “I am not hungry”

3 “Intelligent Agent” Approach
Reflex agent No memory, just “if-then” rules Memory-based agent Also based on current state Goal-based agent Chooses actions that best help meet current goal Utility-based agent Balances multiple weighted goals, choosing actions that give best overall state action input rules action input rules memory Goal-based planning Sims

4 Reflex Agents Example: “orc” reflex agent if hitPoints < 5 then run away from player if distance to player < 2 units then attack player if player visible the run towards player else move in random direction

5 Reflex Agents Example: “orc” reflex agent if hitPoints < 5 then run away from player if distance to player < 2 units then attack player if player visible then run towards player else move in random direction Internal state External state

6 Reflex Agents Actions often hierarchical if hitPoints < 5 then run away from player if distance to player < 2 units then attack player if player visible then run towards player else move in random direction These will call complex navigation subroutines to implement the action

7 Reflex Agents Must consider cost of gathering inputs if hitPoints < 5 then run away from player if distance to player < 2 units then attack player if player visible if player in same room or distance to player < 5 units then run towards player else move in random direction This requires complex computations

8 Reflex Agents Possible problem: Multiple rules may fire
Indicated actions may be contradictory Action may depend on order of rules Problem if rules added by multiple developers (side effects) if hitPoints < 5 then run away from player if distance to player < 2 units then attack player What if next to player and have low hit points?

9 Within one unit of player?
Decision Trees Simple decision tool Easy for non-programmers to understand No ambiguity Very efficient Simple tree traversal Node = question Branch to follow = answer Leaf = final action to take Hit points < 5? no yes Obstacle between myself and player? Within one unit of player? yes yes no no Path to player clear? hide run attack yes no run towards player run sideways

10 Randomness in Decision Trees
Make decisions at some nodes based on random number Math.random() < 0.5 yes no defend Math.random() < 0.2 yes no Swing sword from left Swing sword from right

11 Randomness in Decision Trees
Problem: Generating different random action may not be plausible Will both stand still and patrol for a few frames at a time Better if it decided to do one and keep doing it for a while Need states to implement this idea Math.random() < 0.4 yes no Stand still Patrol


Download ppt "Artificial Intelligence in Game Design"

Similar presentations


Ads by Google