Presentation is loading. Please wait.

Presentation is loading. Please wait.

Artificial Intelligence in Game Design Lecture 17: Goal Oriented Action Planning.

Similar presentations


Presentation on theme: "Artificial Intelligence in Game Design Lecture 17: Goal Oriented Action Planning."— Presentation transcript:

1 Artificial Intelligence in Game Design Lecture 17: Goal Oriented Action Planning

2 Planning Creating series of actions to meet some goal Planning actions to meet multiple needs –Chosen so final state has highest utility –Intermediate states after part of sequence should not be unacceptable –Allows fast actions to be chosen in logical circumstances Planning actions with multiple steps before payoff –Purchase ingredients –Cook ingredients in oven –Eat meal –No effect on hunger until after last step

3 Planning Example ActionEffect on FunEffect on Energy Paint-2+1 Go to Concert-9+3 Nap in Chair+1-2 Sleep in Bed+5-10 NeedCurrent level After PaintAfter Go to Concert After Nap in Chair After Sleep in Bed Fun86262 0202 9292 13 2 Energy67272 9292 4242 0202 Total effect100 8581107169 Best action if single action allowed Will be very tired afterward!

4 Planning Example Better approach for two large needs: –Take fast action to relieve one –Then take another action to relieve other Example: –Take nap before concert NeedCurrent levelAfter Nap in ChairThen After Go to Concert Fun89292 0202 Energy64242 7272 Total effect100 10749 Better than taking single action

5 Planning and Utility Why choose this order? –Why take nap before concert instead of going to concert first? Goal: Minimize “total discontentment” over time Σ discontentment at time t t NeedTime 0Time 1 (concert) Time 2 (concert) Time 3 (concert) Time 4 (nap) Fun852522 0202 1212 Energy67272 8282 9292 7272 Total 10074688150 Total discontentment: 273 Total discontentment: 240 NeedTime 0Time 1 (nap) Time 2 (concert) Time 3 (concert) Time 4 (concert) Fun89292 6262 3232 0202 Energy64242 5252 6262 7272 Total 10085614549

6 Planning and Search Trees Must try all possible combinations of actions –Compute total discontentment for each path –Choose path with lowest total root Sleep in Bed Nap in Chair Go to Concert Paint Go to Conc ert Paint Nap in Chair Paint Sleep in Bed Go to Conc ert Paint Go to Conc ert Nap in Chair Go to Conc ert Sleep in Bed Nap in Chair Paint Nap in Chair Go to Conc ert Nap in Chair Sleep in Bed Paint Sleep in Bed Go to Conc ert Sleep in Bed Nap in Chair Sleep in Bed

7 Planning and Search Trees Expanding search tree is costly –Given a possible actions –Given n possible levels a n possibilities to test –Will only be able to test small number of action combinations (lookahead limit) –Even two actions enough to seem intelligent Looks like character thinking ahead

8 Planning and Search Trees Algorithm: depth limited search –Depth-first search to some fixed limit n a n leafs in tree –At each leaf, compute total discontentment –Just keep track of best path found so far Storage cost: n Best sequence of actions found so far Current path being tested

9 Pruning and Search Trees Can cut off search down obviously bad branches –Branches with intermediate state unacceptably bad –Branches with total discontentment more than best sequence found so far –Can possibly save search time (but no guarantee) Total discontentment = 172 Total discontentment to this point = 180 No path can be better than best found so far, so no further search Discontentment at this state= 150 Unacceptably bad, so no further search

10 Planning and Preconditions Actions may have preconditions before they can be taken Multiple actions required to meet needs Action PreconditionsPostconditions Action Preconditions which character meets Postconditions Action PreconditionsPostconditions meet need meets

11 Planning and Preconditions Example: Microwaving food Get food Uncooked food in fridge Have uncooked food Cook food in microwave Have uncooked food Have microwave Have cooked food meets Eat food Have cooked food Hunger - 5 meets

12 Planning Methods Depth-limited search –Try all combinations of actions up to lookahead limit –Can prune branches with actions whose preconditions not met Expensive –Design world so actions require few steps (2 or 3 at most) Get food Cook food in microwave Prerequisite not met

13 Planning Methods Scripted action sequences –Actually single action with what appears to be multiple steps –Long animated sequence Very simple to implement (no planning needed!) Weaknesses: –Cannot interrupt sequence without starting over entirely Phone rings while cooking –Cannot start plan until all preconditions met Get food Cook food in microwave Eat food Have uncooked food Have microwave Hungry - 5

14 Opportunistic Planning What if not all preconditions for plan exist? –Can get uncooked food –No microwave to cook food (yet) –Should still buy the food if hungry! Opportunistic planning: Taking actions which may pay off in future –Meets one of several prerequisites for action –Other prerequisites can then become goals for character Tell player to buy microwave for character Search for microwave… Get food from fridge Cook food in microwave Eat food Have uncooked food Have microwave Hungry - 5


Download ppt "Artificial Intelligence in Game Design Lecture 17: Goal Oriented Action Planning."

Similar presentations


Ads by Google