GithubHelp home page GithubHelp logo

zeiren / behavior3java Goto Github PK

View Code? Open in Web Editor NEW

This project forked from silencesu/behavior3java

0.0 1.0 0.0 162 KB

behavior for java

Home Page: https://github.com/SilenceSu/behavior3java

License: Apache License 2.0

Java 100.00%

behavior3java's Introduction

behavior3java Build Status maven

Overview

behavior3java是一套与behavior3editor编辑器相配套的行为树框架。

编辑器

开始使用

注意点

使用桌面版本时候会出现b3文件,代表整个工程文件。 但是此时工程文件与导出project json 格式是不一样的。 所以导致报错不兼容,后期会区分加载b3文件与工程json

引用框架
<dependency>
  <groupId>com.github.silencesu</groupId>
  <artifactId>behavior3java</artifactId>
  <version>1.1.0</version>
</dependency>

独立子树加载

//不包含子树的独立树
BehaviorTree behaviorTree = B3Loader.loadB3Tree(confJson, extendNodes);
含有子树的工程加载
//加载整个工程文件
BehaviorTreeProject behaviorTreeProject = B3Loader.loadB3Project(confJson, extendNodes);
BehaviorTree behaviorTree = behaviorTreeProject.findBTTreeByTitle("b1");//获取名字为b1的树

开始运行
//该行为树所有数据都存储在blackboard中。
Blackboard blackboard = new Blackboard();
//驱动tick
behaviorTree.tick(new Object(), blackboard);

测试用例行为树

  • 行为树b1

行为树图

  • 行为树b2

行为树图

行为树介绍

行为树 4大基本类型节点

  • Composite Node 组合节点
  • Decorator Node 修饰节点
  • Condition Node 条件节点(叶节点)
  • Action Node 动作节点(叶节点)

行为树节点状态

  • SUCCESS 节点执行成功
  • FAILED 节点失败
  • RUNNING 节点正在运行
  • ERROR 程序错误

Composite 节点子类

  • Priorty(Selector) Node 选择节点

当执行本类型Node时,它将从begin到end迭代执行自己的Child Node: 如遇到一个Child Node执行后返回True,那停止迭代, 本Node向自己的Parent Node也返回True;否则所有Child Node都返回False, 那本Node向自己的Parent Node返回False。

  • Sequence Node 顺序节点

当执行本类型Node时,它将从begin到end迭代执行自己的Child Node: 如遇到一个Child Node执行后返回False,那停止迭代, 本Node向自己的Parent Node也返回False;否则所有Child Node都返回True, 那本Node向自己的Parent Node返回True。

  • Parallel Node (计划)

并发执行它的所有Child Node。 而向Parent Node返回的值和Parallel Node所采取的具体策略相关: Parallel Selector Node: 一False则返回False,全True才返回True。 Parallel Sequence Node: 一True则返回True,全False才返回False。 Parallel Hybird Node: 指定数量的Child Node返回True或False后才决定结果。

  • Random 随机节点 (计划)

随机的执行节点

Decorator 节点常用

  • Inverter
  • Limiter
  • MaxTime
  • Repeater
  • RepeatUntilFailure
  • RepeatUntilSuccess

Action 节点

  • Succeeder
  • Failer
  • Error
  • Runner
  • Wait

行为树相关学习

相关项目

behavior3java's People

Contributors

dependabot[bot] avatar mingxinkejian avatar silencesu avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.