Tset_Tsyung

Behavior Needing help understanding GOAP (Brent Owen article) - any pointers?

Recommended Posts

Hey all,

As the heading says I'm trying to get my head around Goal Objective Action Planning AI.  However I'm having some issues reverse engineering Brent Owens code line-by-line (mainly around the recursive graph building of the GOAPPlanner).  I'm assuming that reverse engineering this is the best way to get a comprehensive understanding... thoughts?

Does anyone know if an indepth explanation on this article (found here: https://gamedevelopment.tutsplus.com/tutorials/goal-oriented-action-planning-for-a-smarter-ai--cms-20793), or another article on this subject?

I'd gladly post my specific questions here (on this post, even), but not too sure how much I'm allowed to reference other sites... :|

Any pointers, help or comments would be greatly appreciated.

Sincerely,

Mike

Share this post


Link to post
Share on other sites

In general, understanding an algorithm from reverse engineering code is one of the worst ways. It contains an ocean floor full of details that are needed for the implementation, but they make you get totally lost in finding the one or two key ideas at the surface that bring you safely across the pond.

The other direction is much faster. From the key ideas that you read in articles / papers / presentations, you can see the entire structure and understand the idea at global level. With that understanding you can move code of an implementation into the right spot immediately, since its function in the algorithm is clear already. Code here serves as a reference in how exactly they did some sub-sub-sub step in the algorithm.

An alternative is to write your own implementation after reading the articles / papers, to check that your understanding is correct and complete.

 

 

As for GOAP, the first hit I got is http://alumni.media.mit.edu/~jorkin/goap.html which looks adequate in resources to get you started. I would suggest you read the various descriptions how it works. As usual with complicated algorithms, there is no single solution, but you can vary parts of the algorithm and tailor them to your specific problem.

Once you understand it, go to your own problem (assuming you have one), and try to find out what parts are relevant for your case, and study those in more detail, until you can write an implementation.

Share this post


Link to post
Share on other sites

You guys are brilliant! Many thanks!

Alberth - that link was one I came across as well... but mistakenly thought I should handle the Brent Owens "easy" implementation before looking at the more in depth F.E.A.R. examples (and yes, I did think that was ALL that site was showcasing - that'll teach me to skim read!)

IADaveMark - Jeff Orkin! Brilliant, now I have another name to scour for information regarding.  Many thanks for this.

Again, you're both life savers.  Many thanks.

Hopefully, the next post will be of my triumphing over this challenge - #thenoobknowsnothingofwhatstocome

Share this post


Link to post
Share on other sites
4 hours ago, Tset_Tsyung said:

IADaveMark - Jeff Orkin! Brilliant, now I have another name to scour for information regarding.  Many thanks for this.

What do you think "~jorkin" means in the url I linked? Ie you already have that resource.

I have been looking information too (in particular in robotic context, ie RGOAP), but found very little, much to my surprise. Not sure why that is the case. Perhaps competition from eg Prolog or other methods is too strong?

4 hours ago, Tset_Tsyung said:

#thenoobknowsnothingofwhatstocome

That's always the fun part, you may run into many nice and less nice surprises :)

 

Hope you figure it out.

 

 

Share this post


Link to post
Share on other sites

Just so you know. GOAP isn't all that great for many game AI applications. It suffers from having a harder time with complex environments with many verbs (plan time) and when the game state is very dynamic (frequent replanning). That is, most of the time your long, detailed plans get invalidated by the next think cycle and you have to replan entirely.

Share this post


Link to post
Share on other sites
7 hours ago, IADaveMark said:

Just so you know. GOAP isn't all that great for many game AI applications. It suffers from having a harder time with complex environments with many verbs (plan time) and when the game state is very dynamic (frequent replanning). That is, most of the time your long, detailed plans get invalidated by the next think cycle and you have to replan entirely.

I can see why it doesn't quite work in games. In robotics, time is not that relevant at planning level, state doesn't change often either, while robustness (ie adapting to the environment) is a major problem.

Thanks for the information.

Edited by Alberth

Share this post


Link to post
Share on other sites

Ah, so are you saying that GOAP isn't so great for games?  If that's the case, what would you peeps recommend?

In case you haven't noticed, I'm a noob when it comes to AI... :(

I started reading "Programming Game AI by Example" and in there it mentions the 'State Design Pattern' system. (I stopped reading as I realised that the 'free pdf' was actually a pirate and shouldn't have been free... I'll save up and buy a book instead - recommendations would be appreciated).

Again, many thanks for your replies.

Share this post


Link to post
Share on other sites

What are you trying to implement? AI is not about picking a nifty-sounding algorithm and throwing it at anything and everything under the sun; starting with a solid understanding of the problem you want to solve is key.

Share this post


Link to post
Share on other sites
33 minutes ago, Tset_Tsyung said:

Ah, so are you saying that GOAP isn't so great for games?

We were just discussing some disadvantages of the GOAP algorithm. All algorithms have strong and weak points. As ApochPiQ says, there is no golden bullet that will solve any AI problem you throw at it (if such an algorithm existed, it would be one and only algorithm in the entire AI field).

You normally select an algorithm that has the strong points you need for solving your problem, while at the same time its weak points don't affect you (much).

 

In the end, the proof is in implementing the algorithm, and seeing it in action. Implementing it is also great for educational purposes, hands-on learning works best.

 

Share this post


Link to post
Share on other sites

@ApochPiQ I don't have a major 'project' at the moment.  I was gonna to try to build a basic 'scene' where a blue cube mines for a resource top buy his escape whilst shooting green cubes that come at him (with grabbing better weapons on occasion) just so I could get used to it.  I would like to try a SMALL horror game in the future where the player is hunted by a monster in the woods (listen to player and watches for flashlight).  I was going to use the first 'scene' to practice GOAP with.

Following on from Alberth's latest comment I suppose I could use this simple scene to practice different styles (FSM, State Design Pattern, GOAP, custom-frankensteins-monster-hybrid, whatever.)

Many thanks for all your replies all.  I think I'm gonna just go and experiment/play with different concepts for a bit.  If I get stuck on something more specific you will probably hear from me... but not after extensive google searches first ;)

 

Again, thanks all.

Share this post


Link to post
Share on other sites

Start here:

http://intrinsicalgorithm.com/IAonAI/2012/11/ai-architectures-a-culinary-guide-gdmag-article/

As for a pirated copy of Mat's book, I don't think he cares. We make about a buck (or less) off these books. His publisher may care, though. Anyway, that's the book we recommend first anyway. That or Millington's. 

Share this post


Link to post
Share on other sites
On 7/23/2017 at 11:37 PM, IADaveMark said:

Just so you know. GOAP isn't all that great for many game AI applications. It suffers from having a harder time with complex environments with many verbs (plan time) and when the game state is very dynamic (frequent replanning). That is, most of the time your long, detailed plans get invalidated by the next think cycle and you have to replan entirely.

Why not use GOAP for longer term planning or strategies, and supplement with a different system (like a utility system) for shorter term actions/reactions?

Share this post


Link to post
Share on other sites

Merging architectures based on "time into the future" can sound appealing on paper, but often degenerates into really difficult sub-problems that end up making the whole thing less than ideal.

For example, in your suggested scenario, what happens if I find the utility of an already-formulated plan to be zero? What happens if I plan to do something but ignore its utility? Obviously that's not going to fly, so we have to compromise and integrate utility into the planning heuristics somehow. But now we need to know the utility of future hypothetical gamestates, so all we've really done is complicate both algorithms substantially. The handoff between the two designs is not clear or well defined, meaning that it will be hard to keep the two from polluting each other.

 

This is of course just an off-the-cuff example. When you get into the weeds of blending architectures, it often turns nasty because of this kind of thing. It is actually pretty hard to find disparate architectures that "hand off" well between them in the general case, when you're talking about time into the future blending. If you're lucky and your particular case doesn't have those thorny edges, cool; but otherwise you end up just writing a lot of special case hacks and workarounds that don't really suit the goal of getting the game done.

Layered architectures are a different thing. That's where you have a system that controls the fine-grained details and one or more additional systems that control the big picture stuff. They are designed to feed data back and forth, and to cooperate. Layering is a good thing and used all the time for things like strategy-vs-tactics distinctions, for example.

 

Occasionally there are architectures that work well across the "time into the future" spectrum. For example, utility architectures can be set up to do partial planning with some careful forethought. When you have a single solution for a wide range of problems, it's much more appealing to use that solution generally than to try and wire together a bunch of special cases.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now


  • Forum Statistics

    • Total Topics
      628288
    • Total Posts
      2981844
  • Similar Content

    • By Simplepg
      https://play.google.com/store/apps/details?id=simple.gplay.GamesInABox
    • By Simplepg
      https://play.google.com/store/apps/details?id=simple.gplay.GamesInABox
    • By ForgedInteractive


      Who We Are
      We are Forged Interactive, a small team of like-minded game developers with the sole purpose of making games we love! We're a team of artists, animators, programmers, level designers, writers, composers, producers, and other creative minds. We want to make games that you, the modern gamer want to play! We hope to build a community that enjoys our games as much as we love creating them. With your feedback and support we will be able to achieve that.

      About the Game
      GAME NAME is a fun, action-packed army builder with unique characters, challenges and engaging levels. Set forth on an adventure to protect friends, family and countrymen from new adversaries. Once defeated your enemies turn coat and join you in your adventures. Players can enjoy a range of troops and abilities based on their gameplay style which become more important as maps introduce more challenging terrain, enemies and bosses. Strong orc knights, dangerous shamans, and even a dragon are out on the prowl. Knowing when to fight and when to run, and how to manage your army is essential. Your actions alone decide the fate of this world.

      Previous Work by Team
      Although we are working towards our first game as a team, our team members themselves have past experience in the industry.
      This includes members who have worked on titles including:
      Final Fantasy Kingsglaive, FIFA, Xcom 2 and Civilization.

      Who are we looking for? 3D Modellers Concept Artists Marketing Specialists Level Designer

      What do we expect? Reference work or portfolio. Examples what have you already done and what projects you have worked on academic or otherwise. The ability to commit to the project on a regular basis. If you are going on a two-week trip, we don't mind, but it would be good if you could commit 10+ hours to the project each week. Willingness to work with a royalty based compensation model, you will be paid when the game launches. Openness to learning new tools and techniques
      What can we offer? Continuous support and availability from our side. You have the ability to give design input, and creative say in the development of the game. Shown in credits on websites, in-game and more. Insight and contacts from within the Industry.
      Contact
      If you are interested in knowing more or joining. Please email or PM us on Skype. Myself or Colin will reply to you within 48 hours.

      E-mail: Recruitment@ForgedInteractive.com
      Skype: ForgedInteractive

      Regards,
      David and Colin

      Follow us on:

      Facebook: https://www.facebook.com/ForgedInteractive/
      Twitter: @ForgedInteract
      Youtube: https://www.youtube.com/channel/UCpK..._as=subscriber
      Reddit: https://www.reddit.com/user/Forged_Interactive/
    • By Eck
      I just saw their courses were knocked down to $10 each and figured I'd share the info here. They have stuff for Unity, Unreal, drawing, business, etc. I haven't used their stuff before, but the previews I looked at seemed pretty good and there is a user review system as well.
      https://www.udemy.com/courses/search/?q=Unity&src=ukw
      - Eck
       
  • Popular Now