Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Feedback A GOAP (Goal Oriented Action Planning) library beyond GOAP!

Discussion in 'Works In Progress - Archive' started by eelstork, Oct 19, 2019.

  1. eelstork

    eelstork

    Joined:
    Jun 15, 2014
    Posts:
    221
    XGOAP, aka Beyond GOAP is a new planning AI for C#7 and Unity (MIT license).
    Compared to other GOAP libraries XGOAP is:
    • More flexible in how you define your planning models.
    • More concise. Other libraries are a little verbose in how you define preconditions and effects so I leaned the boiler plate.
    • Modern - C#7, package manager integration.
    This follows my Behavior tree (BT) framework, Active Logic, in developing code-first solutions for concise, maintainable Game AIs.

    GOAP is a planning system that's been used in a few AAA titles; some resources and info here. Advice you'll read over and over - don't GOAP everything. Offload details to BT or something else, including hard code.

    Right now, working on a tutorial (check the Sentinel example); when this is done I'll look into performance and GC neutrality.

    The library is quite usable but nothing like one (or if possible, a few) decent, non trivial sample(s) to oust gremlins early in the dev process, so, no official release until I'm done with this.

    Will update as the demo progresses.
     
    nirvanajie and one_one like this.
  2. eelstork

    eelstork

    Joined:
    Jun 15, 2014
    Posts:
    221
    Work on Beyond GOAP has been progressing smoothly. Here is the current state of the demo:



    Working on this example has been helpful. Ironed out a couple of bugs, consolidated the API, improved performance. In the above example two bots are trying to shoot each other down. Shooting range is 3, available actions include moving, shooting, and pulling props (no pushing, too easy).

    Checkout demo project here, run in Unity 2019 (maybe 2018, untested; also, you need Blender installed)

    Heading towards an official Github 'release' meaning full documentation and relatively stable APIs.
     
    one_one and Mohamed-Anis like this.
  3. eelstork

    eelstork

    Joined:
    Jun 15, 2014
    Posts:
    221
    Here goes again!
    • Beyond GOAP is now in its first "official" release, by which I mean a Unity package, in case UPM wasn't enough.
    • Took a first shot at documentation; feedback would be very helpful here.
    Writing a demo did help weed out gremlins; writing doc is a good time to fix APIs so this is starting to look good.

    Dev will continue towards a pencilled asset store release (possibly before 2020) but still no plan to sell this (please, just have it - for now I'd rather see interesting stuff done using this library than put it behind a paywall)

    For summary, GOAP is a planning AI. I've been trying to relax some of the constraints around the original GOAP (the one in F.E.A.R) and things are shaping up. In the coming weeks I'll be working on the following:
    • Priority list for goal selection
    • Give control over re-planning frequency
    • Active Logic integration
    • Performance; seems the library could run 3x, 4x faster without multi-threading just yet.
    Open to ideas/collabs, or just if somebody wanted to suggest a topic for a new demo.
     
    Claytonious and one_one like this.
  4. one_one

    one_one

    Joined:
    May 20, 2013
    Posts:
    621
    That certainly sounds very interesting and seems promising! It might be worth looking into DOTS instead of trying to go for a traditional C# multi-threading approach, by the way!
    I'm not sure if you're aware that Unity is also working on a planner AI? They don't call it GOAP but it does seem quite like one.
     
    eelstork likes this.
  5. eelstork

    eelstork

    Joined:
    Jun 15, 2014
    Posts:
    221
    @one_one yes I'm aware of Unity's plans for planning AIs. Will compare using a couple of non trivial models when I get a chance. rn just building a portfolio of AI solutions which are also unapologetically designed for coders - couldn't move towards HTN (and beyond) without doing BT and GOAP first (reminder: there is no 'best' AI solution, when shopping for stuff, take a tool-for-the-job approach)
    DOTS is a good idea! Fastest GOAP implementations nowadays use CUDA or equiv. but in games... GPU gets a little busy at times.
     
    one_one likes this.
  6. one_one

    one_one

    Joined:
    May 20, 2013
    Posts:
    621
    Ah, interesting! And I like that approach, unfortunately a lot of unity projects are very MonoBehaviour-centric and can't be easily integrated into other design/architecture approaches. A good design workflow for AI is certainly important, but that can always be added on top later on as opposed to remodeling the foundation of a framework.
    If you plan to implement HTNs in the future, have you already seen this cool open-source HTN project?
     
  7. Occuros

    Occuros

    Joined:
    Sep 4, 2018
    Posts:
    300
    I just stumbled on this little gem of a library. But I saw that the latest updates are a few months back. Is it still under active development?

    As Unitys AI planner will probably take a long time to get somewhere usable, and it relies heavily on Monobehaviours, I really like the separation of game ai planning and execution.

    Hope it gets more attention and further development!
     
  8. eelstork

    eelstork

    Joined:
    Jun 15, 2014
    Posts:
    221
    @HolonauticMaster good day to you and nice to see there is interest. Right now I'm focusing on a small but effective Active Logic (my BT library) update and a surprise freebie (yes, it is a surprise!)
    Along with Active Logic (which really is the thing I use everyday) GOAP still fits in my plan so, updates in 2020 but no date here.
    With that, XGOAP is MIT licensed. If there's a thing you need help with, opening an issue is the way to go.

    State of my thinking:
    • Need "life-like behavior" and "effective game logic" => BT is enough, fastest to setup and fast to execute
    • Need "problem solving abilities" => XGOAP not bad if a bit slow to setup (but designer friendly setup possible for some use cases)
    • HTN. Still on the fence, not bought in.