Page 1 of 1

city radius in hex topology

Posted: Wed Dec 05, 2018 9:17 pm
by Wahazar
How works city radius in hex topology? In square topology there is usually few squares for each radius increment, whereas hex topology (version 2.6) require higher steps - which values guarantee real increment of city radius?

Re: city radius in hex topology

Posted: Thu Dec 06, 2018 5:38 pm
by Ignatus
City radius is just a maximal distance to a city map tile from the city center. For tetragonal topologies, there are diagonal tiles that are farther from the center then their straight-positioned neighbours, so you get 5 tiles at squared radius 1, 9 tiles at 2, 13 at 4 etc. At hex topology, there is all the same, just the hexagones are situated in more circle-like structures. For this reason, sq.radius 1 means 7 tiles and sq.radius 2 brings nothing more, you need 4 to advance to six more tiles, but this looks not good and ruleset authors use 5 for the full ring of 2 tiles away. And to inscribe into a circle tiles 3 steps away, you need 10 (see experimental/effects.ruleset). You use the hexagonal values for playing on both hexagonal and rectangular maps; within the maximum allowed sq.radius 25, this shows pretty circles on rectangular maps too. Rulesets for now can't adjust effects like City_Radius_Sq in accordance with non-binary game options, but they AFAIK can force a specific topology.

Re: city radius in hex topology

Posted: Thu Dec 06, 2018 7:25 pm
by cazfi
Ignatus wrote:Rulesets for now can't adjust effects like City_Radius_Sq in accordance with non-binary game options
There is requirement type "Topology" just for adjusting ruleset to work optimally with both hex and square topologies.

Re: city radius in hex topology

Posted: Sat Dec 08, 2018 1:43 pm
by Wahazar
Ignatus wrote:At hex topology, there is all the same, just the hexagones are situated in more circle-like structures. For this reason, sq.radius 1 means 7 tiles and sq.radius 2 brings nothing more, you need 4 to advance to six more tiles, but this looks not good and ruleset authors use 5 for the full ring of 2 tiles away.
Radius 4 give full ring of tiles around:
size_4.png
size_4.png (48.63 KiB) Viewed 6033 times
- at least for 2.6 version. Radius 5 doesn't change anything, unless 9. Numbers of tile layers surrounding city center is just a sqrt(city_radius) rounded down to int.
In case of square topology, things are more complicated, you got 4 tiles for size 1, 8 tiles for size 2 or 3, etc.

Re: city radius in hex topology

Posted: Sat Dec 08, 2018 8:53 pm
by Ignatus
Hhmph... well, I've never tried to change radii's settings myself. Then I don't understand what is 1 for the radius and what coordinates it is applied to.

Re: city radius in hex topology

Posted: Sat Dec 08, 2018 10:08 pm
by Wahazar
Ignatus wrote:Then I don't understand what is 1 for the radius and what coordinates it is applied to.
city_radius_sq and city_vision_radius_sq are a squared distance from city tile to the most far tile under city influence.
Thus city tile itself have 0 radius_sq, radius_sq = 1 give 1 additional tile "circle" around center, radius_sq = 4 gives 2 additional circles (because 2^2=4) etc.
Which hex coordinate system is used in freeciv? Cube? Offset? Axial?

Re: city radius in hex topology

Posted: Sat Dec 08, 2018 11:52 pm
by madmax
Maybe these comments, "graphics" and tables help?
https://github.com/freeciv/freeciv/blob ... ity.c#L185

Re: city radius in hex topology

Posted: Sun Dec 09, 2018 2:38 pm
by Corbeau
Maybe this instead? :)

Code: Select all

*        0    1    2    3    4    5    6    7    8    9   10
   *
   *  0                25   25   25   25   25   25                -5
   *  1              25   16   16   16   16   16   25             -4
   *  2           25   16    9    9    9    9   16   25           -3
   *  3         25   16    9    4    4    4    9   16   25        -2
   *  4      25   16    9    4    1    1    4    9   16   25      -1
   *  5    25   16    9    4    1    0    1    4    9   16   25   +0
   *  6      25   16    9    4    1    1    4    9   16   25      +1
   *  7         25   16    9    4    4    4    9   16   25        +2
   *  8           25   16    9    9    9    9   16   25           +3
   *  9              25   16   16   16   16   16   25             +4
   * 10                25   25   25   25   25   25                +5
   *
   *       -5   -4   -3   -2   -1   +0   +1   +2   +3   +4   +5