{"id":15137877,"url":"https://github.com/victorb/dogoap","last_synced_at":"2025-04-12T21:25:25.224Z","repository":{"id":252654155,"uuid":"832188194","full_name":"victorb/dogoap","owner":"victorb","description":"Goal-oriented Action Planning (GOAP) with Bevy integration","archived":false,"fork":false,"pushed_at":"2024-12-24T16:28:27.000Z","size":342,"stargazers_count":109,"open_issues_count":3,"forks_count":7,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-04-04T03:03:34.700Z","etag":null,"topics":["ai","bevy","bevy-engine","bevy-plugin","ecs","game-ai","game-development","gamedev","goap","npc","npcai","rust","rust-crate"],"latest_commit_sha":null,"homepage":"https://victorb.github.io/dogoap/","language":"Rust","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/victorb.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-07-22T13:54:55.000Z","updated_at":"2025-04-03T17:18:57.000Z","dependencies_parsed_at":"2024-08-11T15:29:14.005Z","dependency_job_id":"e8f69bb1-11e6-44db-87a5-8dfdd8b90576","html_url":"https://github.com/victorb/dogoap","commit_stats":{"total_commits":9,"total_committers":2,"mean_commits":4.5,"dds":"0.11111111111111116","last_synced_commit":"b6da5e5e25c390da7447d8e9fea62190535e5576"},"previous_names":["victorb/dogoap"],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/victorb%2Fdogoap","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/victorb%2Fdogoap/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/victorb%2Fdogoap/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/victorb%2Fdogoap/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/victorb","download_url":"https://codeload.github.com/victorb/dogoap/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248633285,"owners_count":21136849,"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":["ai","bevy","bevy-engine","bevy-plugin","ecs","game-ai","game-development","gamedev","goap","npc","npcai","rust","rust-crate"],"created_at":"2024-09-26T07:03:05.733Z","updated_at":"2025-04-12T21:25:25.202Z","avatar_url":"https://github.com/victorb.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Data-Oriented GOAP (Goal-Oriented Action Planning)\n[![License](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/victorb/dogoap#License)\n[![Crates.io](https://img.shields.io/crates/v/dogoap.svg)](https://crates.io/crates/dogoap)\n[![Downloads](https://img.shields.io/crates/d/dogoap.svg)](https://crates.io/crates/dogoap)\n[![Docs](https://docs.rs/dogoap/badge.svg)](https://docs.rs/dogoap/latest/dogoap/)\n[![ci](https://github.com/victorb/dogoap/actions/workflows/ci.yml/badge.svg?branch=master)](https://github.com/victorb/dogoap/actions/workflows/ci.yml)\n\n\u003e AKA DOGOAP - GOAP implemented in data-oriented way to facilitate dynamically setting up states/actions/goals rather than only at compile-time\n\n\u003e Includes bevy_dogoap which provides a neat Bevy integration of the dogoap library\n\n### [Live Demos](https://victorb.github.io/dogoap)\n\n[![Live Demo](./web-src/images/live_demo.png)](https://victorb.github.io/dogoap)\n\n## Documentation\n\n- [`dogoap`](./crates/dogoap/README.md) docs - Standalone library for creation actions, states and goals to be used with the provided planner\n- [`bevy_dogoap`](./crates/bevy_dogoap/README.md) docs - Integration of the `dogoap` library into Bevy\n\n## Why should I use this?\n\n- If you have NPCs that have to perform tasks that depend on each other (Move to A \u003e pickup item X \u003e move to B \u003e drop item X), GOAP can help you do that\n- If you want NPCs to be able to improvise themselves to how to reach a goal (aka \"emergent behaviour\"), after you setup the actions, GOAP can help you do that\n- You're looking for something more involved than Utility AI, but you don't wanna go full HTNs, GOAP can help you do that\n- You watched the F.E.A.R GDC talk (or the Shadow of Mordor one) from some Monolith people, and you know you want GOAP, then this library helps you skip the boring stuff :)\n\n## Minimal Bevy Example\n\nIn this example, we create a IsHungry `DatumComponent` that signals if the entity is hungry or not, and a EatAction `ActionComponent`.\n\n```rust\n#[derive(Component, Reflect, Clone, DatumComponent)]\nstruct IsHungry(bool);\n\n#[derive(Component, Reflect, Clone, Default, ActionComponent)]\nstruct EatAction;\n\nfn setup(mut commands: Commands) {\n    // We want our final outcome to be that IsHungry is set to false\n    let goal = Goal::from_reqs(\u0026[IsHungry::is(false)]);\n\n    // Here we declare that the result of perfoming EatAction is that IsHungry gets set to false\n    let eat_action = EatAction::new().add_mutator(IsHungry::set(false));\n\n    // Creating the planner with everything together gives us Components we can use with Bevy\n    let (planner, components) = create_planner!({\n        actions: [(EatAction, eat_action)],\n        state: [IsHungry(true)],\n        goals: [goal],\n    });\n\n    // Add `planner` + `components` to your Entity, or spawn a new one\n    commands.spawn((Name::new(\"Planner\"), planner, components));\n}\n\n// System for handling EatAction\nfn handle_eat_action(\n    mut commands: Commands,\n    mut query: Query\u003c(Entity, \u0026EatAction, \u0026mut IsHungry)\u003e,\n) {\n    for (entity, _eat_action, mut is_hungry) in query.iter_mut() {\n        is_hungry.0 = false;\n        commands.entity(entity).remove::\u003cEatAction\u003e();\n    }\n}\n```\n\nOnce you run this code, the planner will automatically figure out that the entity needs to execute the EatAction in order to set IsHungry to false, and your defined System handles the actual logic of the action.\n\nMore involved examples can be found here: [bevy_dogoap examples](./crates/bevy_dogoap/README.md#More%20Examples)\n\n## Prior Art / Other similar projects\n\n- https://github.com/skyne98/soap - A lot of inspiration taken from this repository, biggest difference is the data-oriented structure that dogoap has + the tight Bevy integration dogoap offers\n- https://github.com/dmackdev/bevy_goap - Native Bevy GOAP library, API interface isn't ideal though\n- https://github.com/QueenOfSquiggles/bevy_htnp - Native Bevy HTN (Hierarchical Task Network) library\n\n## License\n\nMIT 2024 - Victor Bjelkholm\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvictorb%2Fdogoap","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvictorb%2Fdogoap","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvictorb%2Fdogoap/lists"}