项目作者: zhandouxiaojiji

项目描述 :
行为树编辑器(桌面版)
高级语言: TypeScript
项目地址: git://github.com/zhandouxiaojiji/behavior3editor.git
创建时间: 2020-10-09T02:54:15Z
项目社区:https://github.com/zhandouxiaojiji/behavior3editor

开源协议:

下载


行为树编辑器

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

示例项目

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

节点定义

  1. export interface NodeDef {
  2. name: string;
  3. type: "Action" | "Decorator" | "Condition" | "Composite";
  4. desc: string;
  5. icon?: string;
  6. color?: string;
  7. input?: string[];
  8. output?: string[];
  9. args?: {
  10. name: string;
  11. type:
  12. | "boolean"
  13. | "boolean?"
  14. | "boolean[]"
  15. | "boolean[]?"
  16. | "int"
  17. | "int?"
  18. | "int[]"
  19. | "int[]?"
  20. | "float"
  21. | "float?"
  22. | "float[]"
  23. | "float[]?"
  24. | "string"
  25. | "string?"
  26. | "string[]"
  27. | "string[]?"
  28. | "json"
  29. | "json?"
  30. | "json[]"
  31. | "json[]?"
  32. | "expr"
  33. | "expr?"
  34. | "expr[]"
  35. | "expr[]?";
  36. desc: string;
  37. default?: unknown;
  38. /** Input `value`, only one is allowed between `value` and this arg.*/
  39. oneof?: string;
  40. options?: { name: string; value: unknown }[];
  41. }[];
  42. status?:
  43. | "success"
  44. | "failure"
  45. | "running"
  46. | "!success" !(child_success | child_success...)
  47. | "!failure" !(child_failure | child_failure...)
  48. | "|success" child_success | child_success...
  49. | "|failure" child_failure | child_failure...
  50. | "|running" child_running | child_running...
  51. | "&success" child_success & child_success...
  52. | "&failure"; child_failure & child_failure...
  53. /** Allowed number of children
  54. * + -1: unlimited
  55. * + 0: no children
  56. * + 1: exactly one
  57. * + 3: exactly three child (ifelse)
  58. */
  59. children?: -1 | 0 | 1 | 3;
  60. doc?: string; //文档说明(markdown格式)
  61. }

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

编译与构建

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

技术栈

  • react + ts
  • electron
  • antd
  • g6

示例行为树框架

About

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