Skip to content

Pathfinding FindGridPath CheckLine Grid Path Override#879

Draft
Syntax-Sculptor wants to merge 4 commits into
mainfrom
GridPath-override
Draft

Pathfinding FindGridPath CheckLine Grid Path Override#879
Syntax-Sculptor wants to merge 4 commits into
mainfrom
GridPath-override

Conversation

@Syntax-Sculptor

Copy link
Copy Markdown
Collaborator

this is the best PR name to grace REPENTOGON.

@Syntax-Sculptor Syntax-Sculptor marked this pull request as draft July 9, 2026 23:59
Comment thread repentogon/Patches/EntityPlus.h Outdated
public:
virtual ~EntityPlus() {}

int lineOfSightCostThreshold = 900;

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Is there a benefit to this being a threshold instead of a boolean setting? Like in practice, would you ever bother to set this to like 500 instead of just 0? Does it do anything to set this >900?

Legitimate question, if you can think of good justifications for these. The main benefit seems to be just ignoring everything <= 900

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

I feel like there might be some niche cases but in retrospect, I think a boolean toggle will be more intuitive.

@Syntax-Sculptor Syntax-Sculptor Jul 10, 2026

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

In retrospect, since there's fireplaces and grid entities with their own grid paths being set, what if we opted for an enum instead? I'm thinking along the lines of

GridPathThreshold = {
    DEFAULT = 900,
    IGNORE_DECAY = 950,
    IGNORE_FIREPLACES_AND_DECAY = 1000,
    IGNORE_EVERYTHING = 1001
}

I think these are pretty realistic situations that'd warrant an integer threshold over a boolean.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

No, if we keep the threshold route the "enum" is still just PathMarker/GridPath by another name (disregarding that the PathMarker enum doesn't exist in lua still, but yeah).

As a threshold this feature is just replacing the PathMarker/GridPath passed along to the CheckLine call inside FindGridPath - it cant be made more granular than that.

I suppose to actually consider the usefulness of the threshold, yeah you can increase it further to have something ignore fireplaces too, or other things if you go even higher. It's somewhat limited sure, but anything more granular will be much more complicated to implement, especially since part of the logic is baked into this CheckLine call.

You can keep the feature as a threshold, for that little extra potential usage. After looking at the decomp closer, turning this into a boolean in its current state might not be appropriate.

Though now that I am looking at it, shouldn't there be a second place where this threshold matters? Like, the current patch is for the direct path check, but there's a separate check done for the actual grid-based pathfinding that should also be handled, right?

return 1;
}

LUA_FUNCTION(Lua_EntitySetLineOfSightCostThreshold) {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Had a thought, pretty sure that the Pathfinder class has a reference to its parent Entity:

Entity * _entity : 0x0;

So in theory, you could still have these as Pathfinder functions, while under the hood they still read/write from EntityPlus

This is hypothetical though, lemme know if it doesn't seem like that would work. Just seems like something that should be in Pathfinder API-wise

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Good idea.

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