Skip to content

Add alternative routes and tile distance display#175

Open
sasoder wants to merge 28 commits intoSkretzo:masterfrom
sasoder:path-dists-and-alternatives
Open

Add alternative routes and tile distance display#175
sasoder wants to merge 28 commits intoSkretzo:masterfrom
sasoder:path-dists-and-alternatives

Conversation

@sasoder
Copy link
Copy Markdown

@sasoder sasoder commented Jul 27, 2025

Fixes #169, maybe some aspect of #120

Adds two new features to help players compare different travel options:

image
  • Alternative paths: show multiple teleport options after the best path. Configurable count (0-10) via new "Show alt. paths" setting.
    image

  • Path length: all paths can now show their tile distance in parentheses for easier comparison.
    image

@Skretzo
Copy link
Copy Markdown
Owner

Skretzo commented Jul 28, 2025

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?

@sasoder
Copy link
Copy Markdown
Author

sasoder commented Jul 28, 2025

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:

image image

@Skretzo
Copy link
Copy Markdown
Owner

Skretzo commented Jul 28, 2025

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.

@sasoder
Copy link
Copy Markdown
Author

sasoder commented Jul 29, 2025

@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!

image image image

@BeniReydman
Copy link
Copy Markdown

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!

@Skretzo
Copy link
Copy Markdown
Owner

Skretzo commented Aug 27, 2025

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 Skretzo deleted the branch Skretzo:master August 28, 2025 14:29
@Skretzo Skretzo closed this Aug 28, 2025
@Skretzo Skretzo reopened this Aug 28, 2025
@sasoder
Copy link
Copy Markdown
Author

sasoder commented Aug 28, 2025

@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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Next best path

3 participants