Add alternative routes and tile distance display
Fixes #169, maybe some aspect of #120
Adds two new features to help players compare different travel options:
-
Alternative paths: show multiple teleport options after the best path. Configurable count (0-10) via new "Show alt. paths" setting.
-
Path length: all paths can now show their tile distance in parentheses for easier comparison.
This is a nice addition!
Would it not make more sense to list the alternative paths in ascending order from shortest at the top to longest at the bottom, similar to how most people read a book?
- It uses async pathfinding with iterative A* with tp options used in the better path removed.
Is there any particular reason why are you using A*? Could you not simply let the BFS pathfinder continue running once it found the shortest path?
private final Set<TransportId> excludedTransportIds;
Why are you creating a new TransportId class instead of using Set<Transport> excludedTransports to keep track of the excluded transports?
Thank you!
During testing I actually started with shortest at the top, but found that always having the best teleport in the same place on the tile made it much less confusing, since the number of lines and their height changes as you adjust the alternatives count.
You're right on the other parts, I replaced TransportId with Set<Transport> now, much cleaner.
Let me know if you want to have the order reversed and I can change that as well. Making it a different color is also pretty nice actually, lmk:
During testing I actually started with shortest at the top, but found that always having the best teleport in the same place on the tile made it much less confusing, since the number of lines and their height changes as you adjust the alternatives count.
Good point. Keep it the way you did it with the shortest at the bottom.
Making it a different color is also pretty nice actually, lmk:
A different colour for the shortest path is a nice addition. You could also make that configurable too, since the white text is already configurable.
@Skretzo I ended up reworking it from scratch by aligning more with the existing codebase + your suggestions. It also solved some bugs. You can now also select a color for the best path if alternatives are showing!
This is a fantastic change! Let me know if there's anything I can do to help push this into the next published build. I also want to bump this!
This is a fantastic change! Let me know if there's anything I can do to help push this into the next published build. I also want to bump this!
Hehe, I have not made it easy for other people to contribute, since I keep changing the code. So they constantly need to fix the conflicts. I have a few things I want to test myself, but haven't had the time to do it yet.
@Skretzo let me know if you're down to merge the pr if I resolve the conflicts and I'll get on it :) or are you currently working on architectural changes that might affect it?
I'm currently pretty low on time so happy for @BeniReydman to co-author if that helps move things forward