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

Cache pathfinding results to speed up calculations #1541

Merged
merged 40 commits into from
Sep 9, 2020

Conversation

idshibanov
Copy link
Collaborator

Using Djikstra-style implementation. Path/distance calculation is constant after cache initialization.

@idshibanov idshibanov self-assigned this Sep 5, 2020
@idshibanov idshibanov added logic Things related to game logic optimisation labels Sep 5, 2020
@idshibanov idshibanov added this to the 0.9 milestone Sep 5, 2020
@ihhub
Copy link
Owner

ihhub commented Sep 6, 2020

Hi @idshibanov , is it ready for review?

Copy link
Owner

@ihhub ihhub left a comment

Choose a reason for hiding this comment

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

Hi @idshibanov , looks great! Could you please take a look into my comments and discuss if you have any questions?

@idshibanov idshibanov requested a review from ihhub September 8, 2020 03:33
@idshibanov
Copy link
Collaborator Author

Hi @idshibanov , is it ready for review?

It is ready now. Removed the old and debugging code as well.

Copy link
Owner

@ihhub ihhub left a comment

Choose a reason for hiding this comment

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

Hi @idshibanov , I left just one comment. Could you please take a look into it?

@ihhub
Copy link
Owner

ihhub commented Sep 8, 2020

Hi @idshibanov , I tested the changes. I can see a noticeable delay when I switch to a hero which can walk for a long distance. I'm just curious: can we make a usage of distance in this case? For example, once we switch to a hero we calculate every possible path based on a current area to show, then we add more and more points when we try to calculate longer distance... I'm just curious. From what I see in the code most likely it's not possible.

@idshibanov
Copy link
Collaborator Author

idshibanov commented Sep 8, 2020

Hi @idshibanov , I tested the changes. I can see a noticeable delay when I switch to a hero which can walk for a long distance. I'm just curious: can we make a usage of distance in this case? For example, once we switch to a hero we calculate every possible path based on a current area to show, then we add more and more points when we try to calculate longer distance... I'm just curious. From what I see in the code most likely it's not possible.

Before the change amount of move points hero had directly affected the distance and slowness of the algorithm. Right now, it calculates everything which was reasonably fast in my tests.

I can limit amount of max iterations. I think once road check will be replaced with the boolean speed of calculation will improve dramatically.

@idshibanov idshibanov requested a review from ihhub September 9, 2020 06:31
@ihhub ihhub merged commit 8bc3ee3 into ihhub:master Sep 9, 2020
@ihhub
Copy link
Owner

ihhub commented Sep 9, 2020

Hi @idshibanov , thanks a lot for your valuable contribution to the project!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
logic Things related to game logic
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants