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

Feature request: Avoid unfriendly CS territory in pathfinding #12718

Open
2 tasks done
hackedpassword opened this issue Dec 29, 2024 · 3 comments
Open
2 tasks done

Feature request: Avoid unfriendly CS territory in pathfinding #12718

hackedpassword opened this issue Dec 29, 2024 · 3 comments
Labels

Comments

@hackedpassword
Copy link

Before creating

  • This is NOT a gameplay feature from Civ VI, BNW, or outside - see Roadmap
  • This is NOT a gameplay feature from Vanilla Civ V or from G&K - If so, it should be a comment in Missing features from Civ V - G&K #4697

Problem Description

Hills and forests etc incur a movement penalty/cost of 2, thus movement calculations will route around these tiles if there's a lower cost route. CS territory does not appear to be considered when routing a path, so CS territory is disrespected, which becomes a relations issue for non-friendly CS's when ending movement in their territory.

Related Issue Links

No response

Desired Solution

A couple suggestions for when a path to the destination is found to cross through unfriendly CS territory:

  1. Treat non-friendly CS borders like rivers or embarking, incurring some negligible cost deterring pathfinding through
  2. Same, but applied to CS owned tiles

Any added cost shouldn't affect movement reachability, so maybe +0.01 per CS tile. If this concurs.

Alternative Approaches

Same as above broken down into 3 UI selectable options:

  1. deter - lowest cost
  2. prevent - medium cost
  3. avoid - pathfinding only considers CS territory if the destination tile is owned by the CS

Additional Context

I wonder if such checks could be made possible with performance in mind. But would there be a performance hit if those tiles were internally layered into the same movement cost consideration as any other terrain/feature (avoiding a per-tile ownership {invoking hash map madness!} check).

@yairm210
Copy link
Owner

If your point is to improve the pathfinding, the title is misleading

A quick win is avoiding similar paths, which we can do by ordering the tiles we check
But even this is not a guarantee because the algorithm stops checking after it finds one optimal path, even if there could be another optimal path that also doesn't go through CS territory - it just makes it more likely

@yairm210 yairm210 changed the title Feature request: Add movement cost to CS territory Feature request: Avoid unfriendly CS territory in pathfinding Dec 29, 2024
@hackedpassword
Copy link
Author

Screenshot_20241229_135338

Improving pathfinding isn't the goal, the algorithm does a fantastic job of that already. This is about being smarter, like avoiding zone of control.

@yairm210
Copy link
Owner

That's part of the pathfinding algorithm though
You don't want the travel to ACTUALLY be longer, only for the pathfinding to treat it as such

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants