1 Star 3 Fork 0

baimingjiang / BehaviorTree

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
贡献代码
同步代码
取消
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
Loading...
README
MIT

Behavior Tree

纯lua实现的一个简单的行为树
编写AI形式如下,可用思维导图制作后写个脚本导出
SEL:AI
    SEQ:去球场打球
        CON:不是情人节:isNotValentinesDay
        ACT:去球场:gotoCourt
        ACT:打球:playBall
    SEL:约会
        SEL:买花
            SEQ:回家拿钱
                CON:女友没花:hasnotFlowerGF
                CON:自己没花没带够钱:hasnotFlowerSelf:100
                ACT:走回家:goHome 
                ACT:拿钱:fetchMoney
            SEQ:去花店买花
                CON:女友没花:hasnotFlowerGF
                CON:自己没花:hasnotFlowerSelf
                ACT:走去花店:gotoFlowerShop
                ACT:买花:buyFlower
        SEQ:见女友
            ACT:去找女友:gotoGF
            CON:女友还在:isHereGF
            CON:女友没花:hasnotFlowerGF
            ACT:送花:giveFlower

使用方式如下,其中entity为人物model对象,上面定义的方法实现在model中
local tree = BehaviorTree.new(ai_string)
tree:behave(entity)
忘了说了,这是要每帧调用的
The MIT License (MIT) Copyright (c) 2016 Chengfu Bao Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

简介

纯lua实现的一个简单的行为树 展开 收起
Lua
MIT
取消

发行版

暂无发行版

贡献者

全部

近期动态

加载更多
不能加载更多了
Lua
1
https://gitee.com/wants_hot_pot/BehaviorTree.git
git@gitee.com:wants_hot_pot/BehaviorTree.git
wants_hot_pot
BehaviorTree
BehaviorTree
master

搜索帮助

14c37bed 8189591 565d56ea 8189591