Artificial intelligence in game design
Download
1 / 17

Artificial Intelligence in Game Design - PowerPoint PPT Presentation


  • 84 Views
  • Uploaded on

Artificial Intelligence in Game Design. Behavior Trees. Reactive Planning. Plan : Set of steps to accomplish some goal Move to door  Open door  Enter room Can easily be done with state machine Reactive planning: Altering plan if steps not currently possible

loader
I am the owner, or an agent authorized to act on behalf of the owner, of the copyrighted work described.
capcha
Download Presentation

PowerPoint Slideshow about ' Artificial Intelligence in Game Design' - nuala


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.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.


- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -
Presentation Transcript

Reactive planning
Reactive Planning

  • Plan: Set of steps to accomplish some goal

    • Move to door  Open door  Enter room

    • Can easily be done with state machine

  • Reactive planning: Altering plan if steps not currently possible

    • What if player locks door?

    • What if player barricades door?

  • Key idea in real-world AI


Reactive planning1
Reactive Planning

  • Decision-making process like tree

  • Possible courses of action may require many steps

    • Decision trees just defined for single step

Door opens

Enter room

Door opens

Enter room

Get key

Try unlocking door

Try breaking down door

Door doesn’t opens

Door doesn’t opens


Behavior trees
Behavior Trees

  • Designed for appearance of reactive planning

    • Plans, contingencies actually scripted

  • Combine features of several representations

    • Decision trees (unambiguous)

    • Finite State Machines (hierarchical)

  • Often used to design games (Halo 2, etc.)

    • Easy to translate into code

    • Easy for non-programmers to design, understand


Tasks
Tasks

  • Leaves of tree = tasks performed by NPC

  • Conditions: Is something currently true or not?

    • Internal to character or external in world

    • Ideally, can be quickly checked against game state

Door open?

Hit points < 5?


Tasks1
Tasks

  • Actions: Outputs/instructions to game engine

    • Internal to character state

    • External, often in form of firing animation

    • Can fire other actions(hear player  start path planning routine)

Open door

Move(room)

hit points --


Composites
Composites

  • Define how tasks combined

  • Sequence node: Execute tasks in given order

    • Often involve tests at beginning to insure sequence can be completed

    • Sequence halts and fails if any tasks fail

Door open?

Move(room)

Close door


Composites1
Composites

  • Selector node: Try tasks in order until one succeeds

    • Multiple tasks with same goal

    • Like if / else if/else if …/ else

    • Best if last task always succeeds (like else)

?

Open door

Break down door

Bang on door


Decision tree structure
Decision Tree Structure

  • Example: Entering a room

    • Problem: Player may have closed the door to prevent guard from entering

?

Door open?

Move(room)

Move(door)

Open door

Move(room)


Hierarchical structure
Hierarchical Structure

  • Can nest to any level

    • Usually alternate levels of selection, sequence

?

?

Door open?

Move(room)

Move(door)

Move(room)

Open door

Break down door

Door open?


Translation into code
Translation into Code

  • Each task/node is subroutine that returns boolean

  • Sequence node:for each task T { success = execute T if (!success) return false }return true

  • Selector node:for each task T { success = execute T if (success) return true }return false


Decorators
Decorators

  • Used to modify structure of nodes below in tree

  • Common case: looping

    • For limited number of times

    • Until fail …

?

Limit = 3

Open door

Bang on door

Break down door


Nondeterminism
Nondeterminism

  • Characters should not always take actions in same order (appears scripted)

  • Door locked

  • Set fire to door: Get matches, get gasoline

Barge door

Don’t always try the same one first!

Set fire to door

Don’t always do in this order!


Partial order planning
Partial-Order Planning

  • Understand what steps must happen in a certain order

  • Other steps can be done in any order

    • Choose order randomly in those cases

Barge door

Try in either order

Try unlocking door

Try opening door

Set fire to door

Get gasoline

Pour gasoline on door

Ignite gasoline

Get matches

Do in any order


Nondeterministic behavior tree
Nondeterministic Behavior Tree

?

Nondeterministic selector node

~?

Door open?

Move(room)

Barge door

Nondeterministic sequence node

~>

Douse door

Ignite door

Get matches

Get gasoline


Parallelism
Parallelism

  • Controls behavior for multiple characters working towards common goal

    • Each character has behavior subtree that runs in parallel (usually implemented as concurrent threads)

    • All characters exit tree when goal succeeds/fails

 

Charcter 1’s task

Charcter 2’s task

Charcter 3’s task


Parallelism1
Parallelism

 

  • “Sequence” parallelism: Exit (and fail) if anythread fails

  • “Selection” parallelism: Exit (and succeed) if anythread succeeds

Quaterback avoids rushers

Reciever gets open

? ??

Rifleman shoots at boss opponent

Grenadier throws grenade at boss opponent


ad