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
Goal-Oriented Action Planning

2 Goals Complex characters have goals What if goals conflict?
Actions appear motivated instead of reflexive Player must be aware of character motivations Example: Napoleon “boss” NPC Capture other cities Protect own cities Increase gold level What if goals conflict? Get gold Avoid player ???

3 Goals and the Sims Overall goals for player to meet
Positive and negative goals Transient goals based on physical needs Hunger Energy Fun Etc. Characters automatically choose actions to meet needs

4 Goals and Actions Goals have actions than fulfill need
Key questions: Which actions should NPC take to fulfill which goals? Hunger Eat snack Cook dinner Energy Nap in chair Sleep in bed Fun Go to concert Paint Read

5 Insistence of Needs Needs may have “degree of urgency” (insistence)
How critical is need? How important is this need relative to others? How much of an action is needed to fulfill need? Represented as number Higher = greater need Zero = no need Need Insistence Hunger 5 Energy Fun 3

6 Actions and Goals Actions can permanently fulfill goals
Replaced with another related goal (Sims) Ends game (Napoleon captures all cities in world) Actions can temporarily lessen needs Action: Need – n (lessens that need by n) Hunger Eat snack: Hunger – 1 Cook dinner: Hunger – 5 Energy Nap in chair: Energy – 1 Sleep in bed: Energy – 5 Fun Go to concert: Fun – 4 Paint: Fun – 2 Read: Fun – 1

7 Choosing Actions Simple approach: Choose goal with highest insistence
Choose action that gives largest decrease Need Insistence Hunger 6 Energy Fun 3 Greatest need Best action Eat Eat snack: Hunger – 1 Cook dinner: Hunger – 5 Energy Nap in chair: Energy – 1 Sleep in bed: Energy – 5 Fun Go to concert: Fun – 4 Paint: Fun – 2

8 Side Effects Actions can effect multiple goals Side effect
Drink Coffee Hunger – 1 Energy – 1 Eat at Restaurant Hunger – 4 Fun – 3 Cook Gourmet Meal Hunger – 5 Fun – 1 Energy + 1 Side effect Fulfilling one goal increases other needs

9 Overall Utility Utility-based decision making
Determine effect of each action on total needs Choose action that has best overall effect One criteria: sum of all needs Need Current level After Cook Gourmet Meal After Drink Coffee After Eat at Restaurant After Sleep in Bed Hunger 3 2 Energy 1 Fun 4 Total effect 6 7 Best action

10 Overall Utility Problem: This can ignore very severe needs
Behavior does not appear rational! Need Current level After Eat at Restaurant After Sleep in Bed Hunger 3 Energy 10 5 Fun Total effect 11 Will be chosen, even though Sim is very tired!

11 Overall Squared Utility
Common solution: Total discontentment = sum of square of needs Need Current level After Eat at Restaurant After Sleep in Bed Hunger 3 02 32 Energy 10 102 52 Fun Total effect 100 43

12 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

13 Planning Example 85 81 107 169 Best action if single action allowed
Effect on Fun Effect on Energy Paint -2 +1 Go to Concert -9 +3 Nap in Chair Sleep in Bed +5 -10 Need Current level After Paint After Go to Concert After Nap in Chair After Sleep in Bed Fun 8 62 02 92 132 Energy 6 72 42 Total effect 100 85 81 107 169 Best action if single action allowed Will be very tired afterward!

14 Planning Example Better approach for two large needs: Example: 107 49
Take fast action to relieve one Then take another action to relieve other Example: Take nap before concert Need Current level After Nap in Chair Then After Go to Concert Fun 8 92 02 Energy 6 42 72 Total effect 100 107 49 Better than taking single action

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

16 Planning and Search Trees
an possible paths to test Given a possible actions Given n possible levels Expanding search tree is costly 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

17 Planning and Search Trees
Algorithm: depth limited search Depth-first search to some fixed limit n an leafs in tree, so choose n so this can be computed in reasonable time At each leaf, compute discontentment Just keep track of best path found so far Storage cost: n Best sequence of actions found so far Current path being tested

18 Pruning and Search Trees
Can cut off search down obviously bad branches Branches with intermediate state unacceptably bad Can possibly save search time (but no guarantee) Character dead No path can be better than best found so far, so no further search Discontentment = 172


Download ppt "Artificial Intelligence in Game Design"

Similar presentations


Ads by Google