-
Notifications
You must be signed in to change notification settings - Fork 50
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 algorithm #386
Comments
Path finding for GoTo is not properly implemented at the moment. If the unit gets stuck, it will cancel the GoTo action. That's similar to what the original game does. The original has better path finding though... |
I've changed the name of this ticket to better reflect the nature of the issue then. Please mark it as an enhancement. |
Alternatively, if reverse-engineering and copying the Civilization pathfinding algorithm is planned, it can be marked as a bug. I say these things about reverse-engineering because of this project by Deadcode with 100% accuracy in porting the entire DOS game, Snipes with only access to the binary, and adding features to it. https://www.vogons.org/viewtopic.php?f=7&t=49073 Someone with a similar level of reverse-engineering skill could do similar with Civilization, or parts of it. It is reasonable to guess that someone could find the pathfinding algorithm inside CIV.EXE and port it to C# for use in CivOne. |
On the Civfanatics forums, Darkpanda and Gowron have picked apart a lot of the inner workings of the games. A lot of this project wouldn't have been possible without that work. I'm going to improve the GoTo algorithm in the next version... |
would using algorithms such as A* be useful? |
I am not familiar with A*, what is it? |
A* is a common node traversal algorithm. Wikipedia has more information about it. https://en.wikipedia.org/wiki/A*_search_algorithm |
Thank you, I'll read it. |
It would be ideal to use a superior algorithm to the one employed by Civilization, as Civilization's does not fully utilize the railroad system to minimize movement points spent for traversing the path. A* with priorities per node type (tile type) would always create an optimal path, which is what the user hopes for when they use GoTo. Using A* has that advantage, plus it is very well-documented. |
A* is used in many games (e.g. Rimworld). However if Civfanatics explains the original algorithm you might as well use it. In any case I think Goto wasn't much used in Civ1, but perhaps this is rash judgment based on my own experiences. |
For the record, I use GoTo often in Civilization with obvious direct routes before railroad to minimize manual and potentially distracting movements. |
As an old Civ1 fanatic I was always frustrated with the goto function in Civ1. |
Cool! Would you have priorities per node type (tile type) to take advantage of roads and railroads? |
Sure, that is the main reason why I would like to implement AStar in CivOne. It is very frustrating when units "derail" from a road/railroad when using "goto". |
Hey, thank you for your proposal. I would love it to have a better pathfinding algorithm implemented in CivOne, but when doing so, can you make the algorithm optional (via a Patch setting). I want to keep vanilla gameplay (including its flaws) available for those who want it. |
About use of AStar algorithm in the "goto" command: Have a pending pull request on that. If someone has a really large continent saved, please check it out |
My Settlers unit in this screenshot started in London and I used GoTo to send it to the tile where the cursor is pointing, but the GoTo ended where the Settlers unit is currently standing.
The text was updated successfully, but these errors were encountered: