Files
Lukas Klingsbo 20c08ad170 chore(release): Publish packages (#3494)
- behavior_tree@0.1.3+1
 - flame@1.25.0
 - flame_3d@0.1.0-dev.6
 - flame_audio@2.11.0
 - flame_behavior_tree@0.1.3+6
 - flame_bloc@1.12.7
 - flame_fire_atlas@1.8.1
 - flame_forge2d@0.18.2+6
 - flame_isolate@0.6.2+6
 - flame_kenney_xml@0.1.1+6
 - flame_lint@1.2.2
 - flame_lottie@0.4.2+6
 - flame_markdown@0.2.3+2
 - flame_noise@0.3.2+6
 - flame_oxygen@0.2.3+6
 - flame_rive@1.10.9
 - flame_splash_screen@0.3.1+1
 - flame_sprite_fusion@0.1.3+6
 - flame_svg@1.11.6
 - flame_test@1.18.0
 - flame_texturepacker@4.1.6
 - flame_tiled@2.0.1
 - flame_spine@0.2.2+6
 - flame_console@0.1.2+2
 - flame_riverpod@5.4.9
 - flame_network_assets@0.3.3+6
2025-02-13 13:40:30 +01:00
..

flame

This package provides a simple and easy to use behavior tree API in pure dart.


Behavior tree is a very common way of implementing AI behavior in game and robotics. Using this, you can break-down a complex behavior of an in game AI, into multiple smaller nodes.

Features

  • Nodes
    • Composite
      • Sequence: Continues execution until one of the children fails.
      • Selector: Continues execution until one of the children succeeds.
    • Decorator
      • Inverter: Flips the status of the child node.
      • Limiter: Limits the number of ticks for child node.
    • Task
      • Task: Executes a given callback when ticked.
      • AsyncTask: Executes an async callback when ticked.
      • Condition: Checks a condition when ticked.

Getting started

Add this package to your dart project using,

dart pub add behavior_tree

Usage

  • Create a behavior tree.
final treeRoot = Sequence(
  children: [
    Condition(() => isHungry),
    Task(() => goToShop()),
    Task(() => buyFood()),
    Task(() => goToHome()),
    Task(() => eatFood()),
  ]
);
  • Tick the root node to update the tree.
final treeRoot = ...;
treeRoot.tick();