Search Unity

AI Open Source GOAP v2

Discussion in 'Tools In Progress' started by CrashKonijn, Mar 2, 2023.

  1. CrashKonijn

    CrashKonijn

    Joined:
    Mar 4, 2010
    Posts:
    245
    Description

    Open Source GOAP (Goal Oriented Action Planner) for Unity. Completely re-written from the original 2016 version (which has 260+ stars).

    Intro

    About 6 years ago I created an open source GOAP for unity for my graduation project, which by now has collected 264 stars on GitHub!

    In the past couple of months I’ve been getting back into game dev, and for one of my games I’d like to use GOAP once again. Naturally I decided to completely re-write my original package, spending more time on this than actually developing the game.

    Anyway, In the last couple of days I managed to get the A* going using Jobs and burst (Thanks to the tutorials of Turbo!), re-re-created the `Node Viewer` using UI Toolkit and I’ve written most of the docs (I think…).

    I’m very excited about my progress and I really wanted to share!

    Features

    - Easy setup using ScriptableObjects as config
    - Uses burst compiled job as the planner
    - Node Viewer editor window
    - Easy API
    - Better documentation
    - A much more complete implementation, including world sensors.
    - Unit tests
    - Uses unity 2022.2.8f1

    Resources

    - V2 branch on GitHub: https://github.com/crashkonijn/GOAP/tree/feature/version-2
    - Pull request with progress: https://github.com/crashkonijn/GOAP/pull/9
    - Documentation: https://goap.crashkonijn.com/
    - Original thread: https://forum.unity.com/threads/a-new-open-source-goap-goal-oriented-action-planner-for-ai.493951/

    Roadmap

    - Better test coverage
    - Rewrite ui’s in UI Toolkit
    - More complete demo project
    - Getting Started / Tutorial
    - Cleaning and restructuring the underlying projects

    goap_window_drag.gif

    goap-set-config.png
     
  2. CrashKonijn

    CrashKonijn

    Joined:
    Mar 4, 2010
    Posts:
    245
    Hi all,

    I've done the following:

    - Improved the node viewer. It not also shows Action Data and World Data.
    - Improved demo project. It now actually looks like something. Also greatly improved the code of the demo itself. Now easily runs 1k+ agents (on my machine).
    - Improved processing time of sensors
    - Reduced GC
    - Made the project buildable (apparently it wasn't)

    Here's a 1000 agents using GOAP. They don't all resolve their goal each frame but even with this amount of agents you can see the runtime of the GOAP itself being < 1ms!

    2k_agents_short.gif

    node_viewer_data.png
     
    DragonCoder and blueivy like this.
  3. CrashKonijn

    CrashKonijn

    Joined:
    Mar 4, 2010
    Posts:
    245
    Hi all!

    I've been busy the last couple of weeks, but I did manage to get the following done:
    • Implemented agent update queue, this should improve performance for larger crowds
    • Implemented a complex example
      • Example of generic actions, goals and sensors
      • Setup through code
      • Different agent types working together
    • Added option to inject data into Actions, Goals and Sensors
    • Added Goap Set Factory (setup through code)
    • Added events to agent
    • Created a personal website, including landing page for this project: https://crashkonijn.com/projects/goap/
    • I've created a discord channel for this project. Join if you'd like to stay connected or have any questions!

    goap_complex_example.gif
     
    Last edited: Apr 12, 2023
    DavidLe360 likes this.