citylimits/examples/simple_ai_logic
Tony Bark c46d0e27e4 Removed state machine for behavior trees
- Added Font Awesome Support
2023-03-14 06:30:58 -04:00
..
env Removed state machine for behavior trees 2023-03-14 06:30:58 -04:00
lumberjack.gd Removed state machine for behavior trees 2023-03-14 06:30:58 -04:00
lumberjack.tscn Removed state machine for behavior trees 2023-03-14 06:30:58 -04:00
main.gd Removed state machine for behavior trees 2023-03-14 06:30:58 -04:00
main.tscn Removed state machine for behavior trees 2023-03-14 06:30:58 -04:00
README.MD Removed state machine for behavior trees 2023-03-14 06:30:58 -04:00

🪵 Simple AI logic : the lumberjack !

This example is about a lumberjack that needs to cut logs. He can carry a certain quantity of logs before going back to the nearest warehouse to drop logs. When logs are dropped, he moves back to the tree he was cutting (or, the nearest tree if the tree is cut), and cut logs again.

The aim of this example is to show how to implement a simple AI logic, composed of differents phases, using a behavior tree. This is just a proposal, there are several ways to create our lumberjack !

In lumberjack behavior tree, you can notice there is no custom tree node (action or condition) : only based ones are used. To execute functional actions, like dropping logs, the BTActionCallable is used. It allows to call a method in a node. For simple behavior trees, it allows to contain all logic into the same script.

Technical elements

  • main.tscn : scene to run,
  • lumberjack.tscn : the lumberjack. The behavior tree is in this scene.