f15gdsy/BT-Framework
关于
BT Framework is a behavior tree framework that can be used to create game AI. It's written for Unity3d.
游戏与模拟器可以做什么
- Minimum dependencies on Unity3d, so it won't pollute your inspector.
- Extendable to handle customized logic nodes, though classic logic nodes, like sequence, priority selector, parallel, are provided.
- Communication between local nodes, cross-tree nodes, and other scripts are possible by the use of blackboard system.
- Enter, Execute, Exit api support for action nodes.
实测星标增长
- 24小时
- 0
- 7天
- 0
- 15天
- 0
- 1个月
- 正在收集历史
各周期内的星标净变化,周期相互重叠,并非每日新增。缺失的测量保持空白。星标代表关注度,不代表软件质量。
README.md
原文BT-Framework
BT Framework is a simple behavior tree framework that can be used to create game AI. It's written for Unity3d.
Features
- Minimum dependencies on Unity3d, so it won't pollute your inspector.
- Extendable to handle customized logic nodes, though classic logic nodes, like sequence, priority selector, parallel, are provided.
- Communication between local nodes, cross-tree nodes, and other scripts are possible by the use of blackboard system.
- Enter, Execute, Exit api support for action nodes.
How to use
Create various actions and pre-conditions inheriting from BTAction and BTPrecondition.
Create a class inheriting from BTTree, and construct the behavior tree in Init function.
Drag the class to a GameObject.
It's this simple!
A simple example:
// A class inheriting from BTTree
protected override void Init () {
// Initialize base class
base.Init();
// Create root node
_root = new BTPrioritySelector();
// ---Construct the behavior tree---
// Escape when boss is close
DistanceClosePrecondition bossClose = new DistanceClosePrecondition("Boss");
_root.AddChild (new DoRun(bossClose));
// Fight when a goblin is close
DistanceClosePrecondition goblinClose = new DistanceClosePrecondition("Goblin");
_root.AddChild (new DoFight(goblinClose));
// Do nothing when boss & goblin not around
_root.AddChild (new Idle());
}
where DistanceClosePrecondition are user defined precondition that inherits from BTPrecondition, and
DoRun, DoFight, Idle are user defined behaviors that inherit from BTAction.
Example demos:
Ludum Dare 48-hour game jam entry: [Swordsman] (http://ludumdare.com/compo/ludum-dare-30/?action=preview&uid=24851)
Code Demo: [BT Test Improved] (https://github.com/f15gdsy/BT-Test/tree/improved)
Code Demo: [BT Test Original] (https://github.com/f15gdsy/BT-Test/tree/master)
Platformer Demo: [Archer] (https://dl.dropboxusercontent.com/u/27907965/games/Archer/Build_0/Build_0.html)
探索相关项目
加载中…