Ticket #46051

Implement direct connectivity

Date d'ouverture: 2022-11-09 09:04 Dernière mise à jour: 2022-11-12 07:15

5 - moyen
5 - moyen


A sidekick of #45946, to test some things on a simpler case (no need of caching or iterative pathfinding). Make a requirement for CivII style connectivity, i.e., that a given unit class may walk from target city to target tile by a crow flight trajectory (FYI, CivII path pattern diagram may be seen here but we'll hardly reproduce it precisely). Additionally to this requirement, we introduce ruleset parameters:

  • minimal dipl.rel. with a unit to pass through a tile,
  • minimal dipl.rel. with a city to pass through a tile,
  • minimal dipl.rel. with a tile owner to pass through a tile,
  • may we pass through cities/bases lacking native terrain or road,
  • unit class maximal connecting distance.

We'll need to include tile (of the nearest gov center) parameter into Output_Waste_Pct effect and introduce Surplus_Waste effect (see #42246) to actually remake CivII rules (-2/3 of shields waste if a direct road to gc ~applied over halving by Courthouse~ but only surplus shields are subject to waste). That all is for another tickets.

Ticket History (3/6 Histories)

2022-11-09 09:04 Updated by: ihnatus
  • New Ticket "Implement direct connectivity" created
2022-11-09 09:06 Updated by: ihnatus
  • Details Updated
2022-11-09 09:11 Updated by: ihnatus
  • Details Updated
2022-11-09 21:08 Updated by: ihnatus

CivII rules of connectivity (for caravan/freight bonuses, traderoute outputs and waste):

  • non-allied military units block paths;
  • cities without rail are not included in the path;
  • (at least for traderoute annual) path is determined destination to source;
  • maximal road/rail distance checked is 22;
  • (a bug not to reproduce) any city of source civ met in the path is counted as reaching the end.
2022-11-12 07:15 Updated by: ihnatus

First, yet untested, patch. While I have started a topic on what should "direct path" look alike, I have done it with the simplest realization. It yet works with mostly hardcoded CivII rules (e.g. 22 tiles distance max) that should be unhardcoded later.

Maybe something should be done with const modifiers around step_towards() function, I got lost in them.

(Edited, 2022-11-12 07:17 Updated by: ihnatus)

Attachment File List


You are not logged in. I you are not logged in, your comment will be treated as an anonymous post. » Connexion