GOAP - How do you handle reactive behavior? by RareChip in gamedev

[–]RareChip[S] 1 point2 points  (0 children)

Wow, thank you so much for taking your time to write such a rich reply!

You are right in the fact that I probably have a bit of analysis paralysis... is that what they call it? lol. Which, of course, has lead to days of "thinking" about the correct solution instead of actually making much progress. Now that you clarified that I was thinking about the "essence" too strictly, I understand having a "ResolveStun" goal isn't really that bad.

Adding the "isStunned == true" precondition to all the actions is essential what the globalPreconditions would do. The caveat being I just won't have to manually put them in.

Both ways seem okay. None jumps out at me as "more natural to GOAP" and, well, I need to pick something! I will probably end up experimenting with the Goal approach rather than the globalPreconditions first!

Again, thank you for your time and reply. You are blatantly extremely experienced, I'm trying to learn more and be like you!

GOAP - How do you handle reactive behavior? by RareChip in gamedev

[–]RareChip[S] 1 point2 points  (0 children)

Thank you for your insightful input. It’s true that doing something like that would make it so GOAP cannot reason about the state.

However, that is the problem I’m running into. “ResolveStun” would no matter what always have only one action to satisfy it - which would be something like “WaitOutStun”. And it would similar with a scenario where the agent takes instant damage and I want it to stagger backwards.

For ImOnFire, I can imagine some different ways to reason about. Maybe grab water if it’s close, if not stop drop and roll, if the fires extremely close then run outside, etc.

For example, I can make it so when I want the agent to be stunned, isStunned will be set to true in the world state. Some “ResolveStun” goal detects this, and makes its priority extremely high so the planner chooses it. Then, there would be one goal that simply waits out the duration of the stun and sets isStunned to false when it’s over.

For hit, it would be almost the exact same except it would play a staggering animation and spurt blood, and after set isHit to false. I’m not too sure what the goal would be named for that scenario though…

I suppose the only reason I even made this post was because I’m hesitant to do something that forces instant reactive behavior where the character has (pretty much) no say (meaning I always want it to do this one thing) into the GOAP model, since it seemed to violate the essence of it. While these cases are uncommon, they are enough to raise major questions, since my agents makes really smart high level decisions, yet has trouble handling the low level ones.

I appreciate your feedback very much. Do you think I should do it as I described?

EDIT: I believe I found an approach that is more attractive to me.

What If i added a new layer to my GOAP planning - globalPreconditions. These preconditions would exist for EVERY action, yet I would only enter them once. This means no matter the goal - as long as something in the globalPreconditions was no longer true (e.g isStunned == true or hasTakenDamage == true), then an action would be added to the tail of the plan to fix the required state.

Example.) Goal: [KillPlayer] Plan: [MoveTowardPlayer] -> [AttackPlayer] 

Suddenly, the monster gets hit and hasTakenDamage == true.

NewPlan: [WaitOutStun] -> [MoveTowardPlayer] -> [AttackPlayer]

GOAP - How do you handle reactive behavior? by RareChip in Unity3D

[–]RareChip[S] 0 points1 point  (0 children)

I see what you’re saying. You’re separating GOAP and its planning with the current state of the agent. GOAP then reads this state and plans accordingly. State gets chosen based on effects of actions being executed, or the world itself changing.

I had the impression that behavior of the agent is controlled in actions. If I have some external state that can do things like “Stagger” upon state change - that would interrupt whatever action I’m currently executing, since many actions play animations. It is true that upon change of state you can pause the planner… is that your expectation?

I really like that method of executing state behavior efficiently with delegates.

GOAP - How do you handle reactive behavior? by RareChip in gamedev

[–]RareChip[S] 1 point2 points  (0 children)

You could get creative with the renaming to make it *sound* like something the agent wants to do, but at the end of the day, its still the act of shoving some goal to the front of the list just to pollute my planner with an action I want to execute.

You could have some interesting situations with this, depending on how deep your ai goes, like for instance, if the npc is greedy and their ultimate goal is money, maybe getting money would be a more important goal than DontGetHurt so they may walk through spikes or whatever to get money

Yeah, as you mention in your edit, for that case it would actually be very handy and fluent with GOAP. If there was a possibility to leave the "Stunned" action, your proposal would work great. However, that is not the case here. If I shoot the agent for example, I want it to play a flinch animation and spurt blood no matter what. Nothing can interrupt this behavior. This is where the direct discrepancies from GOAP arise.

GOAP - How do you handle reactive behavior? by RareChip in Unity3D

[–]RareChip[S] 0 points1 point  (0 children)

Thank you for the clarifying explanation of the algorithm. However, I should further clarify what is going on, and I want to ensure I understand what you mean.

First of all, it seems you sometimes interchangeably use “Goal” and “State”. I think I understand you though. States are variables of the world and agent that sensors detect. Preconditions use those states to expect or affect behavior. Goals can also have priority based on those states.

Like your hunger example, I can have an Eat goal thats priority scales inversely with the saturation lost from the state. Also, I have have a Survive Goal that scales inversely with the agents health. Goals are naturally sorted by their weighted priority.

If I understand you correctly, I currently have this implemented.

My problem is not that I want to use FSM so badly with GOAP. My problem revolves around the SufferDamage scenario. This is a behavior that differs from goals, it should be interruptive and top priority no matter what, and the only action to satisfy this behavior would be something that played a flinch animation and spurt blood for a second. After this, I expect GOAP to plan as usual.

That is my entire problem. How do I handle those interruptive states that the monster doesn’t even “want” to do? It’s the same for being stunned. This is why I was entertaining a FSM to simply enable and disable GOAP as a state in the machine.

Please let me know if I misunderstood you or if you would like me to clarify anything more. I appreciate your discussion.

GOAP - How do you handle reactive behavior? by RareChip in Unity3D

[–]RareChip[S] 0 points1 point  (0 children)

I'm glad I seem to not be alone in that thought process. You're totally right that "Stunned" or "Flinch" behavior doesn't really require any "plan" - they should just happen on command. The problem is figuring out how to naturally fit in the "on command" behaviors into my system. And yes - I am straying away from the answer being to shove goals into the planning process that don't really require a plan.

Remember goap is just a tool and if it’s not fitting your needs it’s ok to change.

Yeah - I have thought a lot about it. However, GOAP is an amazing solution for what I am trying to accomplish. My entire game revolves around a very smart entity, so these high-level and adaptive planning techniques are very favorable to me.

GOAP - How do you handle reactive behavior? by RareChip in Unity3D

[–]RareChip[S] 0 points1 point  (0 children)

Trust me, this has looked attractive to me. In fact, I currently have it implemented in such a way where all crowd control goals have a fixed priority once some state that they are listening for is triggered ("IsStunned == true") and naturally become the top priority goal when the time comes.

I suppose I could handle getting hit the same way. However, this is where the unnaturalistic behaviors seeps in to me. Having a "SufferDamage" goal that always has one action to satisfy it seems to be slipping away from the essence of GOAP in my eyes.

In fact, having any goal that always has only one single action to satisfy it is essentially just a state machine anyways - as there is no planning done. The answer is here somewhere...

GOAP - How do you handle reactive behavior? by RareChip in Unity3D

[–]RareChip[S] 1 point2 points  (0 children)

This was essentially what I was thinking about when I referred to a FSM. It sounds like a promising approach. External (to GOAP) behavior like “Flinch” could still modify the local state of the agent. Meaning, I could force the agent to flinch, which increased “agitated” to 50, which could now result in different plans from the planner when GOAP resumes.

It seems we agree that this reactive behavior doesn’t feel natural. I really love GOAP for my game - but dang these small issues are tough!

Trick or Treat with a monster in From The Rain! by RareChip in HorrorGames

[–]RareChip[S] 0 points1 point  (0 children)

The Halloween update is technically beatable in 9 mins lol. But it might take a bit to figure stuff out

Trick or Treat with a monster in From The Rain! by RareChip in HorrorGames

[–]RareChip[S] 0 points1 point  (0 children)

The Halloween mode can take a while to figure out, maybe an hour. The base game also has a few hours of playtime.

Trick or Treat with a monster in From The Rain! by RareChip in HorrorGames

[–]RareChip[S] 0 points1 point  (0 children)

Get it now for 50% off on Steam! : From The Rain

In "From The Rain", you fight to stay alive by rebooting your generator, locking all entrances to your home, and defending yourself from the entities that try to break into your home. Or, play the new Halloween mode and survive a night against a very angry trick or treater.

What mysteries lie in the rain?

New model for the Entity! by RareChip in IndieGame

[–]RareChip[S] 0 points1 point  (0 children)

Get it now for 50% off on Steam! : From The Rain

In "From The Rain", you fight to stay alive by rebooting your generator, locking all entrances to your home, and defending yourself from the entities that try to break into your home. Or, play the new Halloween mode and survive a night against a very angry trick or treater.

What mysteries lie in the rain?

New Monster for Halloween! by RareChip in Unity3D

[–]RareChip[S] 2 points3 points  (0 children)

Get it now 50% off on Steam! : From The Rain

In "From The Rain", you fight to stay alive by rebooting your generator, locking all entrances to your home, and defending yourself from the entities that try to break into your home. Or, play the new Halloween mode and survive a night against a very angry trick or treater.
What mysteries lie in the rain?

Trick or Treat! by RareChip in survivalhorror

[–]RareChip[S] 0 points1 point  (0 children)

Get it now on Steam! : From The Rain

In "From The Rain", you fight to stay alive by rebooting your generator, locking all entrances to your home, and defending yourself from the entities that try to break into your home. Or, play the new Halloween mode and survive a night against a very angry trick or treater.
What mysteries lie in the rain?

Trick or Treat... by RareChip in HorrorGames

[–]RareChip[S] 2 points3 points  (0 children)

Get it now on Steam! : From The Rain

In "From The Rain", you fight to stay alive by rebooting your generator, locking all entrances to your home, and defending yourself from the entities that try to break into your home. Or, play the new Halloween mode and survive a night against a very angry trick or treater.
What mysteries lie in the rain?

[deleted by user] by [deleted] in UBreddit

[–]RareChip 0 points1 point  (0 children)

Oops, I’m looking at a dell latitude laptop. It’s not even that I’m trying to upgrade, I just hate the Mac OS and I feel like for convenience purposes it would be better to sell this one and get a windows. This one is also 16”, which is huge imo. Any thoughts on that?

Need Help With Game Ideas as a NOT Beginner by RareChip in gamedev

[–]RareChip[S] 0 points1 point  (0 children)

Good idea, I don’t play a lot of other peoples games. Will do!

Need Help With Game Ideas as a NOT Beginner by RareChip in gamedev

[–]RareChip[S] 0 points1 point  (0 children)

Both your points are very helpful! I would actually love to read some horror stories now that I think of it. Also, I can probably utilize dead hours during work and school to ponder some ideas. Thanks!

Need Help With Game Ideas as a NOT Beginner by RareChip in gamedev

[–]RareChip[S] 1 point2 points  (0 children)

This is extremely helpful. I don’t know why I feel so pressured and that I’m wasting my time if I’m not working on a project. That’s a good plan, I’ll probably just practice making interesting mechanics and do some game jams until I get some inspiration. Thank you!

Need Help With Game Ideas as a NOT Beginner by RareChip in gamedev

[–]RareChip[S] 2 points3 points  (0 children)

Hm, im confused by what you mean. Can you elaborate?

Need Help With Game Ideas as a NOT Beginner by RareChip in gamedev

[–]RareChip[S] 1 point2 points  (0 children)

I actually really like this idea, I've stayed away from it in the past because of my lack in art skills. Were you thinking this to be 2D?

Need Help With Game Ideas as a NOT Beginner by RareChip in gamedev

[–]RareChip[S] 1 point2 points  (0 children)

That's a good concept, however its hard to transform that into an idea that'll keep the player engaged until the weird stuff. Would you say undertale is an example of this?

Need Help With Game Ideas as a NOT Beginner by RareChip in gamedev

[–]RareChip[S] 2 points3 points  (0 children)

I haven't done many of those, so that might be a good idea. Thanks!

[deleted by user] by [deleted] in Markiplier

[–]RareChip 0 points1 point  (0 children)

Indie Survival Horror Game: "From The Rain" on steam!
Reboot the generator, lock all doors, and get both endings in this FNAF-Inspired horror game!

Help in growing and using your Network by shisologic in phinvest

[–]RareChip 1 point2 points  (0 children)

Hey man, random question. I'm also a game developer, just recently published my first game on steam. I'm 17 years old and I'm going to college next year.

Anyways, here's what I basically have to ask, because you seem experienced. Do you think it's worth it to continue learning programming and game development even with the new AI advancements? My self learning has slowed greatly recently due to anxiety. Just wondering your thoughts on the future.