CityWorkingTiles & Borders algorythm

What would you like to see in Freeciv? Do you have a good idea what should be improved or how?
Posts: 35
Joined: Tue Mar 11, 2014 9:54 pm

CityWorkingTiles & Borders algorythm

Postby monamipierrot » Fri Mar 14, 2014 10:55 pm

Again, an old post of mine from GreatTurn/CivLAnd forum. Some intricated but I think it is an important matter.

IMHO, We have to redesign CityWorkingTiles (tiles that a city can work) & borders algorythm.

They both should be movement-terrain-infrastructure-sensible.

E.G.: The territory (borders) of a player should depend on how easy it is to reach its tiles from a city given a x3mps imaginery unit, maybe ignoring railroads. This way, at the beginning the territory of a new found city could be very small, expecially if found on hills/mountain area. With some roads, the borders could expand and reach a maximum theorical radius of a 9 tiles-large square. Actually it will at most look more like a circle than a square. And if we don't build roads over mountains, these will likely be the uttermost borders of our empire. With sea/lake it could be quite a problem, but I would use the same algorythm, providing a land-to-sea-or-sea-to-land 1mp-penalty for the imaginery unit. This would mean that a sea city can extend a border on a 3 tiles radius over the sea, and maybe reach close islands. An inner city is likely to extend borders only on water tiles which are next to shore.

Similarly, a city could work tiles which are reachable with some fixed mps, which could be 1 (recommended) or 2mps, ignoring railroads. This way (1mp), from the beginning of the game, you can work ONLY tiles which are next to city (if it is not on a river), and will reach that valuable coal only if you build a road to it, or to a tile next to it. A non-coastal city will then have chance of working only ocean tiles next to the shore.
These algorythm would provide a design based almost entirely on infrastructures (roads) builded by player. this could disturb some of players who want territory to be affected by city size. But city size could also be implemented by making the total imaginery unit mps be a function of city size. E.g. it could be cubicroot(citysize), rounded down.
This way, to reach 2mp (and 6 squares of theoretical distance), one would need a 8sized city. 27 is required for 3mp, and only a huge 64sized city could have a 4mp, e,g, 12 square distance territory size.

A city could work any tile that a imaginery unit could reach.

HERE I APPEND SOME OLD vERSION OF THE TEXT I WROTE LONG TIME AGO (+2 year) which contains more ideas:

{I noticed that Experimental ruleset in Freeciv 2.3 now have a new algorythm bound to the city radius, which I didn’t understand. I wrote this before notice it, but it is still interesting for future developing}
I don’t like very much the territory algorythm. It looks like the city territory radius is always the same, just slightly bigger at sizes 3 and 8. and spawn across seas to another continent (small inner seas, for some reasons, are considered land by the algorythm).
With a a new algorythm Territory could be smaller for smaller cities, and it could be bound to geographical features.
For example, the rule may be:
-” the territory of a city is the subset of tiles which a imaginary normal land or sea unit located inside the city and with mp=sqr(citysize), could reach with one move.”
To have a even smaller territory, substitute the square root with a cubic root. Roads rivers and railroads DO affect this calculations but, in order to avoid, a infinite territory spawning by railroad, we can set the maximum distance=citysize.
If there are no roads/rivers at all, the shape of a 4+ city would tend to a rounded square.
I tried to imagine this algorythm to some real-game maps of mine and it draws very realistic territories with “natural” borders.
To calculate wether a tile is of a player or of the enemy would be a matter of remaining mp for our imaginary unit: the player with more remaining mp (or, fairer, the % of original mp) owns the tile. In case mp are =, wins the nearest. A conservative rule could be also apply.
When calculating the root of the imaginery unit, the presence of enemy units or even their ZOC may be used in the calculations, but I would recommend not to. I find more logical that only cities and occupied Fortress DO impose ZOC in territory calculations.
In order to reach overseas shore or distant sea tiles (for BIG cities), the rule may allow the imaginery unit to change type (from sea to land or viceversa) at the cost of 1 full mp. Some improvements may affect the mps of the imaginary unit.
Of course territory should affect tile working also: a small city may not be able to work all city radius tiles, and should wait for growth or roads to reach that valuable gold on the mountains!
Here’s the mp radius, rounded to the nearest, of the cities:

3mps etc.

Posts: 1803
Joined: Tue Jan 29, 2013 6:54 pm

Re: CityWorkingTiles & Borders algorythm

Postby cazfi » Sun Mar 30, 2014 11:12 am

Too bad the old forum with all the discussions about adjusting borders have been lost. There have been many opinions (often opposite to each other) how borders should operate, and as the wishes have been incorporated in the system (without overriding the old ones), it's far more complex than I'd like it to be. Even I often have to think for a long time why certain tile ends up owned by a certain nation rather than the other.

Some of the key features:
- game.ruleset defines the speed at which border radius from a city increases when city grows, terrain.ruleset has radiuses for bases
- Border source always claims at least the tile it's on
- Within city workable radius, other border sources can not steal the tile from the city (but can own it to begin with)
- In addition to border radius, border sources have also "strength" at which they claim tiles -> stronger wins
- Border source must have higher strength than currently tile owning one to steal the tile (no change of owner every turn between equal strength border sources)
- Usually ocean tile gets claimed if it's adjacent to border source
- Ocean tile can get claimed also when it's mostly surrounded by land tiles from the same continent (bay)
- Ocean tile is not claimed if there's multiple continents adjacent to it