HostedRedmine.com has moved to the Planio platform. All logins and passwords remained the same. All users will be able to login and use Redmine just as before. "Read more...":https://support.plan.io/news/187
Task #879656
openImplement connectivity
0%
Description
Let the game check if a city is connected by some mean by some route to a tile (particulary, a location of another city).
In Civilization II, you can get +50% trade route output from road connection to the destination or +100% for railroad connection [but the path is checked by a flawed "critical path" algorithm that we have no interest to reproduce], if no railroads, +50% are added from airports in both cities (that balances the losses of trade route output from knowing certain techs); also, a road to a capital decreases shield waste on 1/3. In Civilization III and later, the connectivity is not only the main way to fight corruption but is much of the game and is necessary to share and trade resources (strategical resources are needed for units and buildings, luxury resources are adding luxury to all connected cities, since CivIV there are also food/health resources that help growth): to use a resource you must own a tile (or have a factory on it; in some versions amount of the resource depends on special tile improvements) and have a free road to this site from your city, or make a trade agreement with another civ that owns it and that has connectvity between the resource, the supplier's capital and your capital where the resource is delivered. Additionally to (rail)road and air connectivity, there is sea connectivity (sequence of water tiles not occupied by enemy units + Harbours in both cities).
While strategical resources should be probably left to v.3.2, we could have a minimal support of connectivity for v.3.1. My vision of the roadmap:
1.a. Introduce connectivity type structure. Ruleset description should look like this:
[connectivity_air] name = _(" by airway") value = 4 trade_bonus = 50 connected_range = FALSE
1.b. Introduce effects "Tile_Connected" and "City_Connected". To use a connectivity type, a city must have "City_Connected" value bitwise intersecting with the connectivity type's value and have a path to the tile in question each tile of which does it with its "Tile_Connected" effect:
[effect_connect_air] type = "Tile_Connected" value = 4 [effect_connect_air_city] type = "City_Connected" value = 4 reqs = {"type", "name", "range" "Building", "Airport", "City" }
It's probably necessary that we use bits 1...128 for adjacent connectivity and bits 256...32768 (16384?) for cardinally adjacent connectivity (may be useful for programming access by rivers).
2. Track innerly city clusters of a player. Cities in a cluster are connected to each other in some way, the cluster numbers for each player that has some connectivity to a tile is stored in it; each city also stores numbers of its cluster. If two clusters meet due to terrain changing, they merge; also, if terrain change breaks a cluster in pieces, it is split.
3.a If two trade partners are connected by a connectivity type that has a trade bonus (check both cities City_Connected and adjacent tiles' clusters), the trade route gets the bonus (maximal one possible). The bonus is both for one-time profit and for trade per turn.
3.b. Code the aforementioned bonuses into civ2 ruleset.
4.a. Introduce new requirement range "Connected". Clusters of types with positive
connected_range
hold a cache of small and great wonders present, if clusters of two different types that both have connected_range
share a city, their caches are ORed. (In some future version, the clusters would likely have a vector of counters of present strategical resources working in a similar way). Maybe we could additionally introduce a building flag "SharedToAllies" that will make a wonder connected to allied civs' cities.4.b. Make in Civ2 ruleset waste effect reduction due to being connected to Palace.
5.a. Teach AI workers to build infrastructure outside city radii. (Better would be if it will consider also needs to transport military forces around, and to prevent invasions by such roads...)
5.b. Teach AI to send guards to protect the workers outside of city radii, and maybe even to protect trade ways from pillaging by barbarians (a commonn CivIII mid-game task).
Updated by Alexandro Ignatiev 5 months ago
Just for information, best CivII formula for caravan one-time bonus connectivity multiplier I've found ([https://apolyton.net/forum/civilization-series/civilization-i-and-civilization-ii/76838-calculating-caravan-and-freight-delivery-payments here]) in percents is
100 + (50 if road path) + (50 if railroad path [I suppose, railroad always coexists with road]) + (50 if both have airports) + (50 if both have airports and intercontinental) + (50 if src has Superhighways) + (50 if dst has superhighways)
For annual revenue of the route, probably, only road and railroad bonuses apply.
A road to the capital reduces shields waste on 1/3.
Again, CivII looks only "straight go-to path from dst to src disregarding terrain" roads (and erroneously believes that any city of src owner met while following it is already src; that all I don't want to reproduce). Any foreign (non-allied?) unit on the road makes it impassable.
Updated by Lexxie L 5 months ago
Again, CivII looks only "straight go-to path from dst to src disregarding terrain" roads (and erroneously believes that any city of src owner met while following it is already src; that all I don't want to reproduce). Any foreign (non-allied?) unit on the road makes it impassable.
The pathfinding in Freeciv actually has the power to do it already. Follow my thought experiment. A virtual unit who is native to NOTHING except the road-type, tries to find path from src to dest. if (success) connected==true; Similar solution for ocean. So this feature is not a far-off dream-land but can maybe be done in 1-2 days!
Updated by Alexandro Ignatiev 5 months ago
Lexxie L wrote in #note-2:
Again, CivII looks only "straight go-to path from dst to src disregarding terrain" roads (and erroneously believes that any city of src owner met while following it is already src; that all I don't want to reproduce). Any foreign (non-allied?) unit on the road makes it impassable.
The pathfinding in Freeciv actually has the power to do it already. Follow my thought experiment. A virtual unit who is native to NOTHING except the road-type, tries to find path from src to dest. if (success) connected==true; Similar solution for ocean. So this feature is not a far-off dream-land but can maybe be done in 1-2 days!
Yup, that was my idea too. I'll try to post some tickets in nearest future. Likely, we should run connectivity tests only at player's turn start (right before city processing), when the city changes hands or when a building (dis)appears. I had a look through Unciv game code, we likely could do it in a somehow similar way for now.
My current road map is:
"Connected"
effect (tile to city), that forms connectivity clusters at certain moments;"ConnectedBy", %UnitType%, "Tile"
requirement that sometimes is used in that effect (but not only it);"Connected"
range for certain other requirements (to reproduce commercial games, "Resource" and "CityState", "Capital" reqs seem to be enough) that uses connectivity cluster data;"Trade_Revenue_Bonus_Pct"
effect (a simple percentage multiplier to add civ2 effects without a huge table of logarithms);- something to modify trade route annual output as well;
- minor other related things.