{"id":13530866,"url":"https://github.com/Gizmo199/BehaviorTree","last_synced_at":"2025-04-01T19:30:44.383Z","repository":{"id":213120083,"uuid":"733075963","full_name":"Gizmo199/BehaviorTree","owner":"Gizmo199","description":"A simple behavior tree system for Gamemaker Studio 2","archived":false,"fork":false,"pushed_at":"2023-12-18T14:58:11.000Z","size":19,"stargazers_count":8,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2024-11-02T17:36:32.637Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Yacc","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Gizmo199.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null}},"created_at":"2023-12-18T14:05:17.000Z","updated_at":"2024-10-25T07:17:10.000Z","dependencies_parsed_at":"2024-01-05T20:31:21.501Z","dependency_job_id":null,"html_url":"https://github.com/Gizmo199/BehaviorTree","commit_stats":null,"previous_names":["gizmo199/behaviortree"],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Gizmo199%2FBehaviorTree","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Gizmo199%2FBehaviorTree/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Gizmo199%2FBehaviorTree/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Gizmo199%2FBehaviorTree/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Gizmo199","download_url":"https://codeload.github.com/Gizmo199/BehaviorTree/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246700091,"owners_count":20819824,"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-08-01T07:00:56.746Z","updated_at":"2025-04-01T19:30:43.570Z","avatar_url":"https://github.com/Gizmo199.png","language":"Yacc","readme":"This is a simple Behavior Tree system for Gamemaker Studio 2!\nBehavior trees are kind of like Finite State Machines, but allow you to have fallback states and is organized more sequentially.\n\nTo get started all you need to do is create a reference to the behavior tree like so:\n```\nbehavior = bh_tree();\n```\n\nFrom there you can add conditions, sequences, selectors and much more! The `bh_tree()` itself contains 3 way to add to it via:\n- `.add(node_tree)`\n- `.selector(node_tree)`\n- `.sequence(node_tree)`\n\n`.selector()` and `.sequence()` just automatically `.add()` a `bh_selector` or `bh_sequence` to your behavior tree, but you are free to\nuse them independantly with the `.add()` command as well if you prefer.\nThere are 4 main types of behavior nodes you can use:\n-  `bh_selector()`   | This will let you add multiple fallback states that can be 'selected' from if one fails\n-  `bh_sequence()`   | This lets you ensure that a sequence of succesful sub-node events occur, and if one fails, will return a fail for the entire branch of nodes\n-  `bh_condition()`  | This can be used to run a function that returns a `true` or `false`. If `true` is returned from the input function, the behavior was successful and will continue the chain, otherwise it will fail.\n-  `bh_action()`     | This is just a simple call command that will only execute if the conditions, sequences, or selectors before it have not failed!\n\nSo for instance if you wanted to make a simple **Patrol - Chase - Attack** enemy AI behavior tree you would want to set it up like so:\n**CREATE EVENT**\n```\nbehavior = bh_tree();\nbehavior.selector(\n  bh_sequence(\n    bh_condition(checkEnemyNearby),\n    bh_action(chaseEnemy)\n  ),\n  bh_sequence(\n    bh_condition(enemyInAttackRange),\n    bh_action(attackEnemy)\n  ),\n  bh_action(patrolForEnemies)\n);\n```\n\n**STEP EVENT**\n```\nbehavior.step();\n```\nAnd thats it! You can easily get some basic AI behavior working with only this code (as seen here):\nhttps://github.com/Gizmo199/BehaviorTree/assets/25496262/5f3af526-3b7e-443a-8b34-37cfcf0cecd7\n\n","funding_links":[],"categories":["State Machines"],"sub_categories":["Recommendations"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FGizmo199%2FBehaviorTree","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FGizmo199%2FBehaviorTree","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FGizmo199%2FBehaviorTree/lists"}