Project

Profile

Help

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...

Task #879656

Implement connectivity

Added by Alexandro Ignatiev about 2 years ago.

Status:
New
Priority:
Normal
Assignee:
-
Category:
General
Sprint/Milestone:
Start date:
Due date:
% Done:

0%

Estimated time:

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).

Also available in: Atom PDF