Freeciv
Advertisement

In Freeciv, many game rules are based upon the distances between two entities. Players may wish to know how these distances are calculated.

There is no single answer applying to everything in Freeciv. This is because:

  • Map topology - tiles may be Hex or Square
  • "Distance types" - Freeciv uses 3 distinct ways to calculate distance depending on the mechanic involved.

Distances on maps with Square tiles[]

On a game with square tiles, there are three possible ways to calculate distance:

Real Distance[]

How many moves a unit with no limitations (e.g., airplane) takes to go from tile A to tile B.

Chebyshev distance

Real Distance

Manhattan Distance[]

Non-diagonal moves between tiles. That is, |x+y|, where x is the east-west distance and y is the north-south distance.

Manhattan distance

Manhattan Distance

Euclidean Distance[]

This is the true mathematical distance between the center of one tile and the center of another tile, which can be expressed by the Pythagorean Theorem. Distance2 = X2 + Y2 or, Distance = √(X2 + Y2).

Euclidean distance

Euclidean Distance

👉🏼 To avoid decimals, Freeciv uses a "shortcut version" of Euclidean Distance called Square Map Distance, which is Distance = (X2 + Y2). It effectively models the same thing as Euclidean distance, but keeps to integer numbers without needing decimals or square roots.

Which Game Mechanics use which Distance Types[]

element type
Action legality on nearby tiles Real
Paratrooper Range Real
City Corruption Real
CLASSIC Trade Revenue (distance-based) Real
Migration between cities Real
dispersion (game setting) Real
Attacks Real
Bombard / Special Attacks Real
Minimum distance for Trade Routes Manhattan
Cost to Bribe a Unit Manhattan
Cost to Incite a City Manhattan
City Vision, distance Euclidean
City Radius (workable tiles), distance Euclidean
Unit Vision, distance Euclidean
Vision distance for Military Bases Euclidean
Permanent tile ownership distance, cities Euclidean
Border calculations, cities Euclidean
Visibility of Stealth types Euclidean
Visibility of Submarine types Euclidean

Hexagonal Topology[]

Freeciv was originally designed as a Square Tile topology only. The introduction of Hex topology required the conversion of rules, formulas, and mechanics into their nearest simulacra when games are played on hex maps:

  • REAL DISTANCE remains unchanged, the least number of moves between Tile A and Tile B.
  • MANHATTAN DISTANCE and REAL DISTANCE become identical under hex topology.
  • EUCLIDEAN DISTANCE remains the true mathematical distance between the centers of Tile A and Tile B.
Advertisement