Ba LanIdered/behavior-tree
🌲 Manage React state with Behavior Trees
🌲 Quản lý state React bằng Behavior Tree
Thư viện TypeScript áp dụng Behavior Tree để quản lý logic trạng thái trong React, kết hợp React Hooks.
behavior-tree là một bản cài đặt JavaScript/TypeScript của Behavior Trees, dùng để mô hình hoá và quản lý logic ứng dụng dưới dạng cây nút. Dự án bao gồm hai package chính: @btree/core (độc lập framework) và @btree/react (tích hợp với React).
✨ Điểm nổi bật
- Framework agnostic:
@btree/corecung cấp cách xây dựng cây hành vi độc lập với framework nào. - React integration:
@btree/reactcung cấp React Hooks để dễ dàng dùng Behavior Tree trong component. - Node types: Hỗ trợ các nút như
selector,sequence,condition,actionđể cấu trúc logic. - State management: Truyền trạng thái vào
tick()để thực thi logic cây. - Visualization: Logic được bao bọc bởi cây nút, dễ dàng trực quan hoá hoạt động.
- Tick-based execution: Mỗi lần gọi
tick()sẽ chạy toàn bộ logic của cây.
💡 Vì sao đáng chú ý
Thay vì viết logic phức tạp trong hàm hoặc component, Behavior Tree giúp tổ chức code thành các nút rõ ràng, dễ đọc và dễ bảo trì. Đặc biệt hữu ích khi ứng dụng có nhiều nhánh logic điều kiện phức tạp. Dự án đang trong giai đoạn phát triển sớm, API có thể thay đổi.
#BehaviorTree #ReactHooks #StateManagement #TypeScript #TiniX
Dự án tương tự
Khám phá các dự án và mô hình AI khác có sự tương đồng.
📠 React custom hook for persist state management
freeCodeCamp.org's open-source codebase and curriculum. Learn math, programming, and computer science for free.
owl-bt is editor for Behavior trees. It has been inspired by Unreal engine behavior trees in a way, that it supports special node items like decorators and services. This makes trees smaller and much more readable.
A versatile framework for developing robot behaviors using behavior trees in ROS 2.
The code for a short tutorial on how to create a simple guard AI using behaviour trees in Unity/C# (in text or video format)!