Zurückgelegte Entfernung

Ship movement is computed in exact numbers. PHost computes the angle to the ship's waypoint, and moves it there using double-precision floating point. Thus, it is possible that a ship hits a mine after 17.3 ly at coordinates (2351.56, 1792.35). For reporting, and for actually placing the ship in the game universe, it has to round.

New_position =
   (Waypoint_X, Waypoint_Y)
                     ...wenn Distance_moved = Distance_to_waypoint
                        (Ziel erreicht)
   (Position_X + Ceil(Distance_moved * Cos(Heading)),
    Position_Y + Ceil(Distance_moved * Sin(Heading)))
   ...mit
      Heading = ArcTan(Waypoint_X - Position_X, Waypoint_Y - Position_Y)

Zwei interessante Eigenschaften dieser Formel:

  • Because of the Ceil(...), PHost guarantees you to be able to move your maximum distance. A distance of 81 ly can always be covered with Warp 9, rounding effects will never reduce it below. Regarding fuel consumption, the excess is free.
  • Durch Rundungseffekte kann es passieren, dass Minentreffer etwas außerhalb eines Minenfeldes gemeldet werden.