-
Notifications
You must be signed in to change notification settings - Fork 25
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
field_of_movement algorithm is broken #127
Comments
@orph3usLyre this might interest you |
I came up with a working solution using the Dijkstra algorithm. I can try to implement it in a similar coding style as the current state of field_of_movement, however, it may take a little while as we're heading into Christmas festivities. Merry Christmas! |
Looking into this, and yeah the algorithm is definitely broken, an actual pathfinding algorithm should be used instead |
Hi again, I lack the time & probably the skill currently to convert my solution to something that looks more Rust idiomatic. But I'll post my solution below and hopefully that can help some;
The reason why I'm returning HashMap<Hex, (Hex, u32)> here is so one can easily use a helper function to find the shortest path to any tile within the field of movement.
|
Closing for now, feel free to reopen if necessary |
Describe the bug
In this particular video below, you'll see me moving between two white tiles that have the exact same cost to reach another white tile further below. However, one of the white tiles I hover is showing that it's within my field of movement, while the other one does not. The budget in this case was 5.
To Reproduce
https://github.com/ManevilleF/hexx/blob/main/examples/field_of_movement.rs
Use the above example, put budget to a lower amount and look around your map to find that things don't add up
Expected behavior
To be able see a field of movement that corresponds to the set budget
Screenshots Or Code snippet
543a537a26c3ff5a317ad71cffb95137.mp4
Not sure what's wrong with it or what algorithm it is based on. I'll try to come up with a fix but I don't understand how it works yet.
The text was updated successfully, but these errors were encountered: