Code Monkey home page Code Monkey logo

behaviortree's Introduction

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)

behaviortree's People

Contributors

ayongm2 avatar

Watchers

James Cloos avatar Ryan 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.