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

Improve pathfinding performance for multi-tile characters #463

Closed
Annoraaq opened this issue Dec 29, 2023 · 3 comments
Closed

Improve pathfinding performance for multi-tile characters #463

Annoraaq opened this issue Dec 29, 2023 · 3 comments
Assignees
Labels
enhancement New feature or request performance

Comments

@Annoraaq
Copy link
Owner

No description provided.

@Annoraaq Annoraaq added enhancement New feature or request performance labels Dec 29, 2023
@Annoraaq Annoraaq self-assigned this Dec 29, 2023
@Annoraaq
Copy link
Owner Author

Annoraaq commented Feb 21, 2024

While working on this I realized that the JPS pathfinding algorithm might be broken for multi-tile characters in general and also for diagonal movements (8 direction movement) on maps that have unidirectional collision (tiles that don't block from all sides).

I will investigate and fix this if possible. Worst case will be that one has to use BFS or A* for pathfinding in these situations.

@JCtapuk
Copy link

JCtapuk commented Feb 22, 2024

While working on this I realized that the JPS pathfinding algorithm might be broken for multi-tile characters in general and also for diagonal movements (8 direction movement) on maps that have unidirectional collision (tiles that don't block from all sides).

I will investigate and fix this if possible. Worst case will be that one has to use BFS or A* for pathfinding in these situations.

Ok.

Annoraaq added a commit that referenced this issue Feb 28, 2024
Annoraaq added a commit that referenced this issue Feb 28, 2024
Annoraaq added a commit that referenced this issue Feb 28, 2024
Annoraaq added a commit that referenced this issue Feb 28, 2024
@Annoraaq
Copy link
Owner Author

I could increase the pathfinding for multi tile characters. The exact speedup depends on many factors, such as the actual tileWidth and tileHeight of the multi-tile chars. For characters with tile sizes like 2 or 3, don't expect orders of magnitudes faster pathfinding.

With the current algorithms, pathfinding for multi-tile characters is always more expensive than for single-tile characters. That is because more positions have to be checked to see if a neighboring position is blocked. Moreover, you can't use the efficient JPS algorithm.

There probably exist better algorithms for multi-tile pathfinding that I am not aware of. So feel free to reopen this (or a feature request for a different algorithm).

Also if performance for multi-tile characters is really slow in comparison to single tile characters, there might be something else causing the problem. In this case also just reopen this bug or open a new one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request performance
Projects
Status: Done
Development

No branches or pull requests

2 participants