Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add FleeGoal #636

Open
wants to merge 5 commits into
base: dev
Choose a base branch
from
Open

Add FleeGoal #636

wants to merge 5 commits into from

Conversation

lionaneesh
Copy link

A goal which can be configured to run away to a possible safepoint if X mobs attack. Also, later I want to add checks based on HP/Mana which can be configured via the Json.

A goal which can be configured to run away to a possible safepoint if X mobs attack.
@Xian55
Copy link
Owner

Xian55 commented Dec 12, 2024

Gooday, thanks for the contribution i will look into this sometime soon tomorrow. On the other hand i want to try out how it feels and probably going to help eliminate the warnings.

@Xian55
Copy link
Owner

Xian55 commented Dec 12, 2024

There's a way to get notified about upon a mob is died by the player. There's a decoupled messaging system setup where GoapGoals be able to communicate with each other without knowing each other.

I will definitely going to improve the PR that way.

@@ -9,4 +11,5 @@ public sealed class GoapAgentState
public int ConsumableCorpseCount { get; set; }
public int LastCombatKillCount { get; set; }
public bool Gathering { get; set; }
public LinkedList<Vector3> safeLocations = new LinkedList<Vector3>();
Copy link
Owner

@Xian55 Xian55 Dec 12, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In my humble opinion, making safeLocations as a LinkedList<Vector3> seems like an overkill.

In my humble opinion, a safe spot would be a location what the player was already stepped on in the recent past.

While the player is outside of combat, periodically X seconds or X milliseconds, a location can be marked as safe.

Upon entering the FleeGoal the goal execution would be really simple, from a Stack collection just pops safe locations until leaves combat.

There should be some guard clause that the safeLocations should contain about Y seconds worth of time in order to make sure that do not run out of safeLocations this can be checked in the CanRun().

Basically safeLocations.Count > 0

Essentially while the safeLocations has content we do not need to reach for the Navigation Component.

It should be a good idea to find out, after entering combat with a mob, how many seconds does it take till the enemy exit combat.

@Xian55
Copy link
Owner

Xian55 commented Dec 12, 2024

Hello, i've slightly refactored the code to be more simpler. It should give a better integration with the existing framework.

The biggest benefit probably is to see the path while in the FleeGoal. I left some TODOs in the code a few things needs to be figured out.

@Xian55
Copy link
Owner

Xian55 commented Dec 12, 2024

Currently when the SafeLocations is running out of saved elements, the player just keep moving forward until leaves combat.

However this can be dangerous 👀

Refactor: SafeSpotCollector: stores the spots.

More todos
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants