city radius in hex topology

Contribute, display and discuss rulesets and modpacks for use in Freeciv here.
Post Reply
Wahazar
Elite
Posts: 362
Joined: Mon Jul 02, 2018 1:49 pm

city radius in hex topology

Post 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?
Augmented2 ruleset/modpack for freeciv2.6: http://forum.freeciv.org/f/viewtopic.php?f=11&t=91047
Ignatus
Elite
Posts: 644
Joined: Mon Nov 06, 2017 12:05 pm
Location: St.Petersburg, Russia
Contact:

Re: city radius in hex topology

Post 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.
cazfi
Elite
Posts: 3077
Joined: Tue Jan 29, 2013 6:54 pm

Re: city radius in hex topology

Post 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.
Wahazar
Elite
Posts: 362
Joined: Mon Jul 02, 2018 1:49 pm

Re: city radius in hex topology

Post 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 6032 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.
Augmented2 ruleset/modpack for freeciv2.6: http://forum.freeciv.org/f/viewtopic.php?f=11&t=91047
Ignatus
Elite
Posts: 644
Joined: Mon Nov 06, 2017 12:05 pm
Location: St.Petersburg, Russia
Contact:

Re: city radius in hex topology

Post 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.
Wahazar
Elite
Posts: 362
Joined: Mon Jul 02, 2018 1:49 pm

Re: city radius in hex topology

Post 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?
Augmented2 ruleset/modpack for freeciv2.6: http://forum.freeciv.org/f/viewtopic.php?f=11&t=91047
madmax
Veteran
Posts: 56
Joined: Sun Mar 26, 2017 5:34 pm

Re: city radius in hex topology

Post by madmax »

Maybe these comments, "graphics" and tables help?
https://github.com/freeciv/freeciv/blob ... ity.c#L185
User avatar
Corbeau
Elite
Posts: 1291
Joined: Mon Jan 13, 2014 11:13 pm

Re: city radius in hex topology

Post 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
--
* Freeciv LongTurn, a community of one-turn-per-day players and developers
* LongTurn Blog - information nexus with stuff and stuff and stuff
* Longturn Discord server; real-time chatting, discussing, quarrelling, trolling, gaslighting...
Post Reply