RepositoryTypeScriptPLBa Lan
ID

Idered/behavior-tree

🌲 Manage React state with Behavior Trees

119sao
3fork
6issue
1lượt xem

🌲 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/core cung cấp cách xây dựng cây hành vi độc lập với framework nào.
  • React integration: @btree/react cung 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.

RepositoryTypeScript
pmndrs/zustand

🐻 Bear necessities for state management in React

59.0k
Nov 23, 2026
RepositoryTypeScript
diegohaz/constate

React Context + State

4.0k
Nov 28, 2026
RepositoryTypeScript
bluebill1049/little-state-machine

📠 React custom hook for persist state management

1.5k
Oct 25, 2026
RepositoryTypeScript
codetypess/behavior3-ts

behavior tree for ts/js

61
Nov 12, 2026
RepositoryTypeScript
freeCodeCamp/freeCodeCamp

freeCodeCamp.org's open-source codebase and curriculum. Learn math, programming, and computer science for free.

459.9k
Dec 2, 2026
RepositoryJavaScript
pruttned/owl-bt

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.

187
Dec 10, 2022
RepositoryC++
AutoAPMS/auto-apms

A versatile framework for developing robot behaviors using behavior trees in ROS 2.

110
Nov 17, 2026
RepositoryC#
MinaPecheux/UnityTutorials-BehaviourTrees

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)!

108
Nov 2, 2021
RepositoryJavaScript
react/react

The library for web and native user interfaces.

253.0k
Nov 30, 2026