{"id":17964796,"url":"https://github.com/dong50252409/behavior3erl","last_synced_at":"2026-02-20T15:32:00.943Z","repository":{"id":45115677,"uuid":"297007422","full_name":"dong50252409/behavior3erl","owner":"dong50252409","description":"Behavior3 runtime library for Erlang (Behavior Trees for Erlang)","archived":false,"fork":false,"pushed_at":"2024-03-14T09:42:12.000Z","size":88,"stargazers_count":28,"open_issues_count":0,"forks_count":10,"subscribers_count":2,"default_branch":"master","last_synced_at":"2026-02-15T20:51:51.574Z","etag":null,"topics":["behavior-tree","behavior3","erlang"],"latest_commit_sha":null,"homepage":"","language":"Erlang","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/dong50252409.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-09-20T05:18:12.000Z","updated_at":"2025-11-12T06:02:48.000Z","dependencies_parsed_at":"2022-09-26T21:40:45.854Z","dependency_job_id":null,"html_url":"https://github.com/dong50252409/behavior3erl","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/dong50252409/behavior3erl","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dong50252409%2Fbehavior3erl","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dong50252409%2Fbehavior3erl/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dong50252409%2Fbehavior3erl/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dong50252409%2Fbehavior3erl/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dong50252409","download_url":"https://codeload.github.com/dong50252409/behavior3erl/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dong50252409%2Fbehavior3erl/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29655304,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-20T09:27:29.698Z","status":"ssl_error","status_checked_at":"2026-02-20T09:26:12.373Z","response_time":59,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["behavior-tree","behavior3","erlang"],"created_at":"2024-10-29T12:08:44.603Z","updated_at":"2026-02-20T15:32:00.927Z","avatar_url":"https://github.com/dong50252409.png","language":"Erlang","funding_links":[],"categories":[],"sub_categories":[],"readme":"中文\n=====\nErlang的行为树运行库，使用 [behavior3editor](https://github.com/behavior3/behavior3editor) 编辑生成行为树\n\n快速开始\n----\n添加如下内容到`rebar.config`\n\n    {deps, [\n       ...\n       {behavior3, \"2.0.1\"}\n    ]}.\n\n编译\n----\n    $ rebar3 compile\n    \n使用\n----\n    Filename = \"example.json\",\n    BTTitle = \u003c\u003c\"example_ai\"/utf8\u003e\u003e, \n    State = #{},\n    %% 执行这步后会产生大量垃圾，建议手动执行一次erlang:garbage_collect/0,1,2\n    TreeMod = behavior_tree:load_tree_file(Filename),\n    BB = blackboard:init_blackboard(TreeMod, BTTitle),\n    {_BTStatus, _BB1, _State1} = behavior_tree:execute(BB, State).\n    \n\n调试\n----\n添加`{d,'BT_DEBUG'}`到`rebar.config`文件中，默认调试信息输出到控制台，可调用`blackboard:set_io/2`重定向日志输出位置\n\n    {erl_opts, [\n        {d, 'BT_DEBUG'}\n    ]}.\n    ./rebar3 clean -a\n    ./rebar3 compile\n    \n热更新行为树\n----\n行为树配置文件发生改变时，可调用`behavior_tree:load_tree_file/1`进行生成加载，并返回一个新的模块名供后续使用。\n\n考虑到老的行为树模块会有已运行的行为树调用，自动清除可能会造成异常，老的行为树模块由使用者自行决定后续操作，可调用`behavior_tree:unload_tree_mod/1`清除。\n\n一个DEMO\n----\n[rogue_adventure](https://github.com/dong50252409/rogue_adventure)\n\n\nBehavior3使用系列文章：\n----\n里面的代码实例是1.0.0版本的，各位主要看看概念就好\n\n[（一）行为树应用之行为树简介](http://note.youdao.com/s/77bGugj9)\n\n[（二）行为树应用之组合节点](http://note.youdao.com/s/XiKlHPIr)\n\n[（三）行为树应用之装饰节点](http://note.youdao.com/s/9Z6zI3YE)\n\n[（四）行为树应用之自定义节点](http://note.youdao.com/s/AcRrY8ig)\n\nEnglish\n=====\n\nErlang runtime library behavior tree, use [behavior3editor](https://github.com/behavior3/behavior3editor) to edit generated tree\n\nQuickstart\n----\nadd to `rebar.config`\n\n    {deps, [\n       ...\n       {behavior3erl, \"2.0.1\"}\n    ]}.\n\nBuild\n----\n\n    $ rebar3 compile\n   \nUsage\n----\n    Filename = \"example.json\",\n    BTTitle = \u003c\u003c\"example_ai\"/utf8\u003e\u003e, \n    State = #{},\n    %% This step generates a lot of garbage and a manual erlang:garbage_collect/0,1,2 is recommended\n    TreeMod = behavior_tree:load_tree_file(Filename), \n    BB = blackboard:init_blackboard(TreeMod, BTTitle),\n    {_BTStatus, _BB1, _State1} = behavior_tree:execute(BB, State).\n    \n\nDEBUG\n----\nAdd `{d,'BT_DEBUG'}` to `rebar.config` and default debug information is output to the console by calling `blackboard:set_IO/2` to redirect the log output location\n\n    {erl_opts, [\n        {d, 'BT_DEBUG'}\n    ]}.\n    ./rebar3 clean -a\n    ./rebar3 compile\n\nHotFix\n----\nWhen the behavior tree configuration file changes, call `behavior_tree:load_tree_file/1` to load the configuration file and return a new module name for future use\n\nBecause the old behavior tree module has running behavior tree calls, automatic clearing may cause exceptions. Follow-up operations of the old behavior tree module are determined by users. You can call `behavior_tree:unload_tree_mod/1` to clear the behavior tree module\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdong50252409%2Fbehavior3erl","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdong50252409%2Fbehavior3erl","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdong50252409%2Fbehavior3erl/lists"}