{"id":18835649,"url":"https://github.com/tgsstdio/birdnest.nodes","last_synced_at":"2026-01-26T23:30:15.143Z","repository":{"id":34755240,"uuid":"38736373","full_name":"tgsstdio/BirdNest.Nodes","owner":"tgsstdio","description":"C# stack based (i.e. non-recursive) behaviour tree implementation","archived":false,"fork":false,"pushed_at":"2015-08-22T07:09:04.000Z","size":172,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-01-31T05:04:09.480Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/tgsstdio.png","metadata":{"files":{"readme":"README.MD","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-07-08T06:29:44.000Z","updated_at":"2017-10-12T05:58:41.000Z","dependencies_parsed_at":"2022-09-24T23:52:17.579Z","dependency_job_id":null,"html_url":"https://github.com/tgsstdio/BirdNest.Nodes","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tgsstdio%2FBirdNest.Nodes","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tgsstdio%2FBirdNest.Nodes/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tgsstdio%2FBirdNest.Nodes/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tgsstdio%2FBirdNest.Nodes/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tgsstdio","download_url":"https://codeload.github.com/tgsstdio/BirdNest.Nodes/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":239770329,"owners_count":19694036,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":[],"created_at":"2024-11-08T02:16:48.200Z","updated_at":"2026-01-26T23:30:15.113Z","avatar_url":"https://github.com/tgsstdio.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"# BirdNest.Nodes\n---\nC# implementation of a stack based behaviour tree. The library traverses a tree\nnon-recursively and therefore easier to debug \u0026 trace.\n## Example\n---\n\n```C#\n\tpublic interface IPlayerLocator\t{ ... }\n\n\tpublic class Enemy\n\t{\n\t\tpublic bool WithinDistance (){ ... }\n\t\tpublic bool HasTarget () { ... }\n\t\tpublic Result MoveTowards () { ... }\n\t\tpublic Result SelectTarget () { ... }\n\t\tpublic Result HitTarget () { ... } \n\t}\t\n\t\n\tpublic class EnemySituation\n\t{\n\t\tpublic IPlayerLocator Service;\n\t\tpublic Enemy Individual;\n\t}\n\n\tpublic abstract class BaseEnemyAI : Step, IBlackboardNode\u003cEnemy\u003e\n\t{\n\t\t#region IBlackboardNode implementation\n\t\tpublic Blackboard\u003cEnemy\u003e Board { get; set; }\n\t\t#endregion\n\t}\t\n\t\n\t// initialise tree build\n\tvar dictionary = new TreeDictionary();\n\tvar builder = new BlackboardTreeBuilder\u003cEnemy\u003e(new TreeBuilder(), dictionary);\n\n\t// gererate a behavior tree\n\tbuilder\n\t\t.Sequence()\n\t\t\t.Begin ()\n\t\t\t.Selector()\n\t\t\t\t.Begin ()\n\t\t\t\t\t.IsTrue((e) =\u003e e.HasTarget())\n\t\t\t\t\t.Selector ()\n\t\t\t\t\t.Begin ()\n\t\t\t\t\t\t.Step((e) =\u003e e.SelectTarget())\n\t\t\t\t\t.End ()\n\t\t\t\t.End ()\n\t\t\t.Selector()\n\t\t\t\t.Begin ()\n\t\t\t\t\t.IsTrue((e) =\u003e e.WithinDistance())\n\t\t\t\t\t.Selector ()\n\t\t\t\t\t.Begin ()\n\t\t\t\t\t\t.Step((e) =\u003e e.MoveTowards())\n\t\t\t\t\t.End ()\n\t\t\t\t.End()\n\t\t\t.End ()\n\t\t\t.Step ((e) =\u003e e.HitTarget())\n\t\t.End ()\n\t.BuildAndRegisterAs\u003cBaseEnemyAI\u003e();\n\n\tvar topBuilder = new BlackboardTreeBuilder\u003cEnemySituation\u003e(new TreeBuilder(), dictionary);\n\t\n\t// generate tree as a stub for an BaseEnemyAI implementation\n\tvar tree = topBuilder\n\t\t.UseStub\u003cBaseEnemyAI, Enemy\u003e()\n\t\t.Build();\n\n\tvar walker = new NodeWalker(tree);\n\twalker.AddBlackboard\u003cEnemySituation\u003e(new Blackboard\u003cEnemySituation\u003e{ Context = new EnemySituation()});\n\twalker.AddDependentBlackboard\u003cEnemySituation, Enemy\u003e((es) =\u003e {return es.Individual;});\n```\n\n## Changelog\n---\n### Version 1.1.0 \n#### 2015-08-22\n - Replaced library with PCL version 4.0 (Profile328) \n - Renamed Action type to Step because .NET already has a Action type\n\n### Version 1.0.0 \n#### 2015-07-08\n - Initial check in\n\n## LICENSE \n---\nThe MIT License (MIT)\n\nCopyright (c) 2015 David Young\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in\nall copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN Step OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\nTHE SOFTWARE.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftgsstdio%2Fbirdnest.nodes","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftgsstdio%2Fbirdnest.nodes","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftgsstdio%2Fbirdnest.nodes/lists"}