Connectivity and resources

What would you like to see in Freeciv? Do you have a good idea what should be improved or how?
Post Reply
Ignatus
Elite
Posts: 644
Joined: Mon Nov 06, 2017 12:05 pm
Location: St.Petersburg, Russia
Contact:

Connectivity and resources

Post by Ignatus »

Connecting to strategic resources (henceforth luxuries included) and to other cities is a central topic of Civ3 that was enough good to be includet into consequent commercial games. Here are ideas how to bring it into Freeciv.

1. In terrain.ruleset, to the [resource_*] sections we append "strategic" boolean option. Maybe we want to get some "Fuel" from just "Woods" terrain, then we put into the "extra" property some really never generated extra just for graphics and name, and fill a table sources={"terrain", "extra"} (may work independent for real extras). Ability to collect resources from an owned tile not occupied by a hostile unit is enabled by "Tile_Resource_Amount" effect that can get resource extra in "Extra" requirement; effect value of each present resource (probably we don't put too much of them in one place) appears there, you should append extra visibility_reqs to block invisible ones' effects. We can also generate a resource in cities by "City_Resource_Amount" effect , something like Civ4 "Great Hits" that are produced just by a wonder in a city. Maybe in future development we'll add a way to put random numbers on such tiles that signify how reach or poor is this specific mine.

2. Some unit types get "CityConnector" role. The connectors are virtual units (I don't like the idea of Civ5 traders that creep the map automatically and you have to guard these dumb robots) that are used to find the path from a city that fits their build reqs to a resource tile or another city, in commercial games ownership of tiles and cities on the way is ignored for this purpose. A city can manage all possible types of connectors in one turn but each one path observes only one, without ability to load in a boat and then continue by a continent. If the path is found, tiles are connected. Airport connection may be checked by ability to airlift such units between cities (but without further movement), airlift counters ignored. Cities of the same player that are connected one to another into a connected graph form a connectivity cluster and can use any unit of the stategic resources connected to any of them. Maybe we should furtherly think of a way to prohibit transporting certain resources by certain connectors (e.g. coal by planes).

3. There is a requirement range "Connected" that tests for resources in the cluster of the target city and allows to introduce various effects. We can use it also for goods (but can't we drop them with this system?) and wonders requirements, e.g. we can reduce corruption for cities connected to our capital. A unit or a building may either require a resource for being built (then one resource enables any number of them, Civ3 style) or consume it (a unit of the resource is no longer available to the cluster until the unit or building exists, and it is destroyed or weakened if the source is lost). Some Civ4 buildings can consume resources optionally and convert a unit of them to some output each turn.

4. Connection clusters of different players may trade to foreign one by a treaty if a city tile of one is in connected area of the another, thus a unit or more of the resource disappears at one side and appears on the another (in Civ3 treaties enabled trade agreements only between clusters of capitals).
Ignatus
Elite
Posts: 644
Joined: Mon Nov 06, 2017 12:05 pm
Location: St.Petersburg, Russia
Contact:

Re: Connectivity and resources

Post by Ignatus »

5. An amendment should be made to require Harbor in both coastal cities. Either we require that both connectors must reach another end or for the required building introduce some flag "ConnectorDestRequired".
6. With this system we can have some different trade route concept for routes between cities mostly resembling Civ5 system (but with less dependence on automoving). A city can found a trade route to another one (some ruleset-defined conditions met) if any connectors (here better named "traders") from it can reach the target. Establishing a route may cost some gold proportional to the distance in steps. After establishing, the establised civ gets some advantage (mostly fast expiring) but if the dest city has an appropriate trader it also gets benefits (Civ4 unidirectional routes are possible but boring). Each turn the path is recalculated through accessible tiles (probably, for advanced traderoutes we should turn on diplomatical obstacles; in Civ5 there is "blocade" naval mission to block some sea around from traders); only if there is no open path left the route is blocked. The traderoute may be expirable in certain number of passes of the connector back and forth.
7. For the basic traderoute value, we need population, distance, trade tile/building output, goods (they are necessary here because spread luxury and strategic resources this way would be too much) etc., mostly like now. Per turn one gets only part of the value proportional to part of the path that the trader can pass(so longer routes expire slower but give not much more, maybe the distance effect should be adjustable to 0). The total number of traderoutes for a city can be also limited like now, but in commercial games the capital supports very many (and indirect) traderoutes, that is better done by some connectivity cluster mechanism.
8. I suggest to make city traders a bit more real units behaving much like city defenders but not actually placed in the city unit list or on the map, just you see your and opposite end traders on a special city pad. They also are numbered by two effects, get veteranship from veteran_build or activity (mostly for just trading a long time with small work vet.chance but see below). You should make some citizens to work merchants to produce effect points for more traders that are distributed by existing trade routes (trader type maybe auto-selected) automatically by CMA or manually. Let the traderoute produce a specific maximal outcome that is distributed between the sides proportionally to move points/path length invested, but not more than 100%. If the cities give more points, they start to concur for the path's tiles with "Trading_Strength" effect and veteranship bonuses (maybe random winning for each tiles but why not a stable share); the trader moves lost in concurrence go to the opposite side as gold and/or happiness. You may also enter a trade war against another civ: on trade routes between your cities your traders will attack foreign ones destroying or damaging them, so they get less move points (but so may you; in mutual trade war attack or defense priority will be random). In this war traders may get hardened.
Ignatus
Elite
Posts: 644
Joined: Mon Nov 06, 2017 12:05 pm
Location: St.Petersburg, Russia
Contact:

Re: Connectivity and resources

Post by Ignatus »

Or maybe we leave trade routes just for strategical resources (or introduce cap-to-cap trade mechanism but I don't like it) and introduce a simpler and in some aspects more realistic system for other things - moving caravans is probably not the biggest fun in the game and you have a lot of other aspects to work on. Just let connected city clusters of different nations, if diplomatic agreements allow it, exchange some trade points and some luxuries to more or less mutual benefit. Firstly, basic trade for i-th cluster T_0i is just sum of trade outputs of all its cities. Then, each nation has protectionistic policy effect from 0 to 100% (probably a multiplying slider involved) that tells what share of a bonus from mutual trade is the nation going to leave for itself, let its value normalized into [0;1] be p_i. Then additional trade for i-th cluster from trading with foreign j-th one
T_ij = F * T_0j/(T_0i+T_0j) * (f_ij*T_0i*(1-p_j) + f_ji*T_0j*p_i) * B(c_{i+j}),
where B(c_{i+j}) is a bonus function of number of continents where one or both of the clusters have a city, F is a bonus coefficiency for foreign trade and f_ij, f_ji are shares of foreign trade that each cluster sends to the another that is proportional to the expected profit from a trade unit,
f_ij = (1-p_j)B(c_{i+j}) / ( B(c_i)/F + sum[k~i] (T_0k/(T_0i+T_0k) * (1-p_k) * B(c_{i+k})) )
and the full trade of a cluster is
T_i = sum[j~i] T_ij + (1-sum[j~i] f_ij) T_0i B(c_i)
and this value is shared proportionally between all the cluster's cities. As it can be seen, there is no route length here, just bigger clusters on different continents mean bigger distances. And for luxury trade, we just make a treaty that for N happiness points supplied from any of our clusters having the resource to any of the partner's connected clusters, a gold is paid to us; so we avoid the dumb rule that a tile with Spices will make happier either a nation of 1 city or a nation with 100 cities, but you need another such tile to supply both. To balance the game from making a luxury resource tile an endless cash cow, AIs shuld be taught to make alliances on terms "if one conquers this tile from these scroodges, he must set prices at maximum M".
Ignatus
Elite
Posts: 644
Joined: Mon Nov 06, 2017 12:05 pm
Location: St.Petersburg, Russia
Contact:

Re: Connectivity and resources

Post by Ignatus »

A minimal ruleset data format that can support at least Civ2 traderoute bonuses should look somehow like this:

Code: Select all

[connectivity_raiload]
;/*TRANS: city A connected to city B by what */
name = _("by railroad")
city_reqs = {"type", "name", "range"
 "Tech", "Railroad", "Player"}
tile_reqs = {"type", "name", "range"
 "Extra", "Railroad", "Local"}
traderoute_bonus_pct = 50
; goods = list of possible goods (all by default)
For traderoutes, the connectivity must be direct, but for just "Connected" req all connectivities work. For the requirement that from a coal tile we need not just a road but a railroad we need also a line that specifies possible resources (all by default but for "by road" and "by airline" we specify only light enough ones). That though means we won't be able just to make a struct connectivity object that stores all the resources and is referred by several cities.
Also, we'll need a way city advisors (maybe autosettlers, maybe AI only) should direct workers to build trade routes and settlers to make pinch point cities, and AI should be smart enough to send military units to defend the working parties from captuing and the routes from pillaging.
User avatar
soundnfury
Posts: 28
Joined: Sat Apr 11, 2020 12:09 pm

Re: Connectivity and resources

Post by soundnfury »

That sounds like a lot of work, but we could get at least some of the value of strategic resources without implementing the connectivity side of it; just have a requirement that tests whether the resource is on any workable (or perhaps worked?) tile within the City, Continent, Player or Alliance range. (It would be nice to have properly tradeable strategic resources, perhaps by diplomatic agreement, but having resources able to be automatically shared with allies is better than nothing.)

I think this is worth doing, for the sake of encouraging players to build an ecumenical empire, with far-flung colonies in resource-rich regions, rather than the convex contiguous blob that seems to happen naturally in freeciv games today. (Though, to get the main feature — resources required to build units, such as Horses for cavalry or Iron for swordsmen — we would also need to add generalised requirement vectors to unit production, which currently only has tech_req and impr_req.)

Luxury goods could also use this system; e.g. a ruleset could have for each luxury type an Effect that adds 1 lux to the citycenter tile if that resource is available.

This should be able to smoothly enough incorporate connectivity when that does get added, and in the meantime observing how this affects play (particularly multiplayer) may help illuminate what aspects of connectivity and quantity (Civ4-style 'consume') are actually important to have.
Creator of the Aviation ruleset. Try it out today!
Post Reply