Skip to content

Optimize pathfinding#4637

Merged
ranisalt merged 100 commits intootland:masterfrom
NRH-AA:Optimize_Pathfinding
May 11, 2025
Merged

Optimize pathfinding#4637
ranisalt merged 100 commits intootland:masterfrom
NRH-AA:Optimize_Pathfinding

Conversation

@NRH-AA
Copy link
Contributor

@NRH-AA NRH-AA commented Mar 23, 2024

Pull Request Prelude

Changes Proposed

This is a overhaul of when and how pathfinding is done. I did attempt this before but I closed the pull request due to congestion. I believe all problems from the original pull request have been fixed.

This will change the pathfinding to work as A* algorithm rather than djikstra's.
It will also add more pathfinding calls as needed fixing monster moving around slowly due to 1 second pathfinding interval.
This PR also includes separation of when creatures will update their path from creatures onThink.
Lastly it includes some fixes for bugs which were not detectable until pathfinding was able to be called more often.

Issues addressed:
Might fix: #4617

@MillhioreBT
Copy link
Contributor

I did a quick test but this PR doesn't work, the monsters walk randomly and move away from the target slowly until they disappear from sight, and the summons don't have any type of movement.

@NRH-AA

This comment was marked as outdated.

@NRH-AA
Copy link
Contributor Author

NRH-AA commented Mar 6, 2025

@ranisalt

image

@Coldensjo
Copy link
Contributor

What are the required commits for this PR to work?

@ranisalt
Copy link
Member

I lack the understanding to approve this, the only thing I dislike is using the int_fast variants but if @Codinablack and @MillhioreBT give it the ✅ we should merge it

Copy link
Contributor

@Codinablack Codinablack left a comment

Choose a reason for hiding this comment

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

Overall I think it looks pretty well polished at this point. Just make the two changes I requested and you have my approval.

Copy link
Contributor

@Codinablack Codinablack left a comment

Choose a reason for hiding this comment

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

LGTM

@NRH-AA
Copy link
Contributor Author

NRH-AA commented Apr 26, 2025

LGTM

What happened to the build lmao? The code is all up-to-date was something changed on the master that messed up all the tests?

@Codinablack
Copy link
Contributor

LGTM

What happened to the build lmao?

It's a WIP. There are a few issues due to updates from cmake, github runners, vcpkg... it's a whole toolchain thing. The project still builds fine when downloading and trying locally. I have more information if you want to talk about it you can message me on discord.

@NRH-AA
Copy link
Contributor Author

NRH-AA commented May 3, 2025

COMON

return distance >= Map::maxViewportX + Map::maxViewportY ||
position.z != followerPosition.z;
}),
followers.end());
Copy link
Member

Choose a reason for hiding this comment

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

Nice change!

ranisalt
ranisalt previously approved these changes May 3, 2025
Copy link
Member

@ranisalt ranisalt left a comment

Choose a reason for hiding this comment

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

Why tf Github keeps saying I requested changes if I already approved this

@github-project-automation github-project-automation bot moved this from In review to Ready to be merged in TFS 1.8 May 3, 2025
@NRH-AA
Copy link
Contributor Author

NRH-AA commented May 11, 2025

Just threw in some final touches since this hasn't been merged yet.

@ranisalt ranisalt merged commit 8fe2872 into otland:master May 11, 2025
5 of 19 checks passed
@github-project-automation github-project-automation bot moved this from Ready to be merged to Done in TFS 1.8 May 11, 2025
@ranisalt
Copy link
Member

Let's get this over with!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement Increase or improvement in quality, value, or extent needs-triage Needs testing with screenshot/video confirmation priority: high

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

Wrong interactions of monsters with pathfinding.