Code Monkey home page Code Monkey logo

behavior3editor's Introduction

行为树编辑器

这是一个直观、可视化、通用的行为树编辑器,行为树的保存格式为json,可以让策划自行去实现AI,技能,buff等复杂的游戏逻辑,从而减少不必要的沟通成本和提升开发效率。

示例项目

  • 工作区: sample/workspace.b3-workspace
  • 节点定义: sample/node-config.b3-setting
  • 行为树目录: sample/workdir
  • 批处理脚本: sample/scripts

节点定义

interface NodeArgOption {
  name: string;
  value: string | number;
}
interface NodeArg {
  name: string, // 字段名
  // string | string? | boolean | boolean?| int | int? | float | float? | code | code? | enum | enum?
  type: string, // 字段类型
  desc: string, // 字段中文描述
  default?: string; // 默认值
  options?: NodeArgOption[]; // 枚举类型
}
interface NodeDef {
  name: string;         //节点名称
  type?: string;        //节点分类(Composite,Decorator,Condition,Action)
  desc?: string;        //节点说明
  args?: ArgsDefType[]; //参数列表
  input?: string[];     //输入变量名 exp: ["target", "enemy?"]
  output?: string[];    //输出变量名 exp: ["target", "enemy?"]
  doc?: string;         //文档说明(markdown格式)
  color?: string;       //节点颜色 exp: "#ff00ff"
  icon?: string;        //节点图标 exp: icons/cmp.svg
}

节点定义配置在项目创建的时候会自动生成一个配置,参照sample/node-config.b3-setting,这是个json的配置文件。编辑器不提供节点定义的编辑,强烈建议节点定义文件由代码生成 (参照示例项目behavior3lua)。

编译与构建

npm install # 安装依赖
npm start # 运行测试
npm run build # 编译可执行文件

技术栈

  • react + ts
  • electron
  • antd
  • g6

示例行为树框架

About

本项目将长期维护,欢迎各位大佬加群交流(Q群:644761605)

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.