mirror of
				https://github.com/flame-engine/flame.git
				synced 2025-10-31 08:56:01 +08:00 
			
		
		
		
	 639dac0732
			
		
	
	639dac0732
	
	
	
		
			
			``` Package Name Current Version Updated Version Update Reason flame 1.16.0 1.17.0 manual versioning flame_forge2d 0.17.0 0.17.1 manual versioning flame_oxygen 0.2.0 0.2.1 manual versioning behavior_tree 0.1.0 0.1.1 updated with minor changes flame_behavior_tree 0.1.0 0.1.1 updated with minor changes flame_network_assets 0.3.0 0.3.1 updated with minor changes flame_sprite_fusion 0.1.0 0.1.1 updated with minor changes flame_texturepacker 3.1.0 3.2.0 updated with minor changes flame_tiled 1.19.0 1.20.0 updated with minor changes flame_test 1.16.0 1.16.1 dependency was updated flame_isolate 0.6.0 0.6.0+1 dependency was updated flame_fire_atlas 1.5.0 1.5.1 dependency was updated flame_audio 2.10.0 2.10.1 dependency was updated flame_spine 0.2.0 0.2.0+1 dependency was updated flame_bloc 1.11.0 1.11.1 dependency was updated flame_lottie 0.4.0 0.4.0+1 dependency was updated flame_markdown 0.2.0 0.2.0+1 dependency was updated flame_rive 1.10.0 1.10.1 dependency was updated flame_noise 0.3.0 0.3.0+1 dependency was updated flame_riverpod 5.4.0 5.4.1 dependency was updated flame_svg 1.10.0 1.10.1 dependency was updated ```
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.
 
 
- Composite
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();
