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

Implement good pathfinding algorithm #29

Closed
VedVid opened this issue Oct 22, 2018 · 17 comments
Closed

Implement good pathfinding algorithm #29

VedVid opened this issue Oct 22, 2018 · 17 comments
Labels
critical [priority] enhancement New feature or request

Comments

@VedVid
Copy link
Owner

VedVid commented Oct 22, 2018

No description provided.

@VedVid VedVid added enhancement New feature or request high [priority] labels Oct 22, 2018
@VedVid
Copy link
Owner Author

VedVid commented Oct 22, 2018

Resources: roguebasin1, roguebasin2, redblobgames

@VedVid
Copy link
Owner Author

VedVid commented Oct 22, 2018

@VedVid
Copy link
Owner Author

VedVid commented Oct 22, 2018

medium

@VedVid
Copy link
Owner Author

VedVid commented Oct 22, 2018

boohu's astar algorithm

@VedVid
Copy link
Owner Author

VedVid commented Oct 25, 2018

@VedVid
Copy link
Owner Author

VedVid commented Oct 31, 2018

For now, I decided to just "bruteforcing" path from goal to the start (I can't be sure, but it looks like Dijkstra for me). It looks trivial, but SOMEHOW I can't implement it properly for a week... Still, I'd rather implement it from scratch by myself rather to use external library, because I want RAWIG to be self-contained, without any third-party libraries (except of BearLibTerminal)

@VedVid VedVid added the help wanted Extra attention is needed label Oct 31, 2018
@VedVid
Copy link
Owner Author

VedVid commented Nov 10, 2018

Example of current implementation (flawed and bugged):

https://play.golang.org/p/QwAnARS0Ndx

@VedVid
Copy link
Owner Author

VedVid commented Nov 11, 2018

Fixed implementation:

https://play.golang.org/p/pxJx4unbOz1

@VedVid VedVid added critical [priority] and removed help wanted Extra attention is needed high [priority] labels Nov 11, 2018
@VedVid
Copy link
Owner Author

VedVid commented Nov 11, 2018

Creating graph is finally done! Commit history is very ugly, but I'm pleased with final effect.

TODO:

  • moveTowardsPath should move creature, not create a graph
  • comments!
  • maybe graph should not be re-calculated, if target remains the same?

@VedVid
Copy link
Owner Author

VedVid commented Nov 11, 2018

backtracking in progress...

@VedVid
Copy link
Owner Author

VedVid commented Nov 11, 2018

Tests failing.

code: https://play.golang.org/p/JqCWKPiOymH

problems:

  • "T" is creating larger distance from "@" instead of approaching it; it looks like fleeing
  • even if it's fleeing, it's flawed, because it stops on (19, 19)

@VedVid
Copy link
Owner Author

VedVid commented Nov 12, 2018

both flaws are fixed now

@VedVid
Copy link
Owner Author

VedVid commented Nov 12, 2018

TODO: #33 #34 #35

@VedVid
Copy link
Owner Author

VedVid commented Nov 12, 2018

#33 done!

@VedVid
Copy link
Owner Author

VedVid commented Nov 12, 2018

TODO: #34 #35 #36

@VedVid
Copy link
Owner Author

VedVid commented Nov 12, 2018

#34 done by 7943a9c and edec91d

#36 done by edec91d

#35 postponed

@VedVid
Copy link
Owner Author

VedVid commented Nov 12, 2018

Finally, merged into development branch by 1e22dda

@VedVid VedVid closed this as completed Nov 12, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
critical [priority] enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant