in Freeciv, often replaced with: Square Map Distance
sub-article in the series Distances in Freeciv
Definition[]
The Euclidean Distance between two tiles on a map is the true mathematical distance between the centers of each tile.
On a map of square tiles, this is calculated by the Pythagorean theorem. That is, if x is the east-west distance between tiles and y is the north-south distance between tiles, then:
- Distance2 = x2 + y2, or:
- Distance = √(x2 + y2)
A "shortcut variant" of Euclidean Distance is Square Map Distance which is Distance = x2 + y2. It effectively measures the same thing but avoids square roots and the complex decimals caused by them.
Euclidean Distance in Freeciv[]
Euclidean Distance and its shortcut placeholder Square Map Distance are one of three different ways Freeciv may calculate distance for certain in-game effects and mechanics. It is used in distance calculation for the following mechanics:
- City Vision distance
- City Radius distance (workable tiles)
- Unit Vision distance
- Military Bases, vision distance (e.g., Fortress, Airbase, etc.)
- Permanent city ownership of tiles under a certain distance
- Border calculations, distance in sphere of influence from cities
- Visibility of Stealth type units
- Visibility of Submarine type units
Graphic Illustration[]

Euclidean Distance
Please see the article Radius to see the exact same info-graphic rendered as Square Map Distance, to understand how Square Map Distance is used in Freeciv. This also has a larger grid for the above info-graphic.
Hex Maps[]
On hexagonal tiled maps, Euclidean Distance is essentially the same as on square tiled maps: the true mathematical distance between the centers of Tile A and Tile B.
Notes[]
- In Freeciv server, Square Map Distance is rendered by the function:
int sq_map_distance(const struct tile *tile0, const struct tile *tile1)
, in:common/map.c
- The Euclidean distance is rendered by taking the square root of that function. This is usually unnecessary as the program code exclusively stays within Square Map Radius units of measure for all Euclidean mechanics.