Freeciv
Advertisement
Forums: Index > Development > Distance


Changing trademindist (default to eight) to six. Following method for the calculation, #vert x 1 + #horiz x1 + #diagonal x 1.5. For rectangular grid, which is the only one used in practice, at least for the warclient. What is this modification trying to achieve ? Following observations are stange

  1. valid trade cities on vertical are height moves away
  2. valid trade cities on the diagonal are four moves away

The new calculation method is closer to the position resulting from using the pythagoran theorem. Another justification is that when the island shape is like an ellipse. The trade routes that result is steange.

With this proposed method for changing trademindist from height to six.

  1. cities on diagonal are still four moves away; 4 x 1.5 = 6.
  2. cities on vertical are now six moves away: 6 x 1 = 6.
  3. cities on horizontal are now six moves away: 6 x 1 = 6.
  4. the following drawing show added placement in green.
Citytradedist


--Seggil 15:09, February 8, 2011 (UTC)




Why is there mixed use of manhattan distance and real distance in the game? For example why is it that traderoutes are based on manhattan distance? Units can move diagonally. --Tjal 13:21, February 19, 2010 (UTC)


Kernigh writes: Freeciv has at least three types of distance:

  • Manhattan distance: , as for trade routes.
  • Step distance: , as for citymindist. (In Wikipedia, this is Chebyshev distance.)
  • Real distance: , the Pythagorean theorem.

Since Freeciv 2.1, vision uses real distance: each unit or city sees the tiles in a circle around itself. (This is more obvious if you build an AWACS.) This allows vision to be consistent with both square and hex maps.

Trade routes ought to use real distance, but players would have difficulty to know if cities are far enough. Trade routes instead use Manhattan distance, so players can count tiles. (But I cannot count Manhattan distance on a hex map!) If I count Manhattan distance less than 9, then I know how two cities are too close for trade route. Both Manhattan distance and step distance allow players to count tiles, so the decision to use Manhattan distance instead of step distance for trade routes does be arbitrary. --Kernigh 02:34, February 21, 2010 (UTC)


What you call step distance is actually named real distance in Freeciv. The third type of distance is square distance, using Pythagorean theorem, but not doing square root: . --Pepeto 12:02, February 21, 2010 (UTC)

Advertisement