© |
Wraparound Maps
|
PHOST implements one model of a wraparound universe. In a wraparound universe, ships that fly off the "edge" of the map appear on the other side of the universe. Thus, the universe behaves more like a sphere (or a torus) than a plane. For example, in the original VGA Planets map, you can fly from (1010,2000) due west (heading of 270) and after 20 LY of travel you will appear on the other side, at (2990,2000), where you will continue on your journey flying due west.
A wraparound universe allows players to make more use of all areas on the game map. Depending upon placement of homeworlds, there need not be any more "dead" areas that take a long time to reach and may never even be explored. A wraparound universe also gives each player more neighbors, thus leading to greater interaction between players. Races on opposite sides of the universe that used to be distant unknowns can now be neighbors.
PWRAP and Sphere are two external programs that also implement wraparound maps. But these programs only move ships so that they wrap around the edges of the universe. PHOST implements true wraparound support for all game functions, including wraparound minefields, wraparound ship scans and sensor sweeps, etc.
You can still use PWRAP or Sphere with PHOST if you only want simple ship wraparound implemented in your game. Using PWRAP or Sphere along with PHOST's built-in wraparound feature is not recommended.
PHOST only implements a wraparound universe if the AllowWraparoundMap config option is enabled. The wraparound region is a rectangle which confines all map objects (ships, planets, minefields, etc.). Any ship, for example, that exits the wraparound region reappears within the wraparound region on the other side. The WraparoundRectangle config option defines the wraparound region.
Note that unlike ships and minefields, planets outside of the wraparound region are not remapped onto the region. If a planet is outside of the wraparound region, then PHOST pretends that the planet does not exist. This allows custom maps with fewer than 500 planets to be used. In this scenario, unused planets are placed far away from the usual universe center (for example, planets may be placed at X-ordinates of 0 or 4000). If these faraway planets were to be remapped onto the wraparound region, they would not be very far away any more.
The WraparoundRectangle config option is an array of 4 values. The first 2 values define the X and Y co-ordinates (respectively) of the lower-left corner of wraparound region. The last 2 values define the X and Y co-ordinates of the upper-right corner of the wraparound region. For example,
WraparoundRectangle = 1500,1000,2500,3000
defines the following wraparound region:
Note that, since PHOST 3.3c, the extreme top and right coordinates (Y=3000 and X=2500 in this example) are no longer part of the map. In older versions they were, which could lead to the strange situation that a ship that moves from Y=2999 one ly to the north would end up at Y=3000, while one that moves 2 ly to the north and back one ly to the south would land at Y=1000.
No co-ordinate of the wraparound region may be less than 0 or greater than 10000. In fact, it is recommended that the wraparound region be located away from these boundaries (e.g., don't make the lower-left corner closer to the origin than (1000,1000)) for proper operation of many external programs.
The WraparoundRectangle config option has no effect on PHOST operation unless AllowWraparoundMap is enabled.
Wraparound universes can be a challenge to work with when you have to imagine your ships flying from one edge of the universe to another within a single turn. Landing on planets on the opposite side of the map, for example, requires much planning. Fortunately, some client-side programs are currently available that replicate the map (i.e., they tile the plane with the map) so that cross-boundary motions are much easier to visualize and plan.
VPA 3.51, the alternative DOS client program, allows for square wraparound maps centered on (2000,2000). The size of the wraparound square is configurable. Non-square regions not centered on (2000,2000) are not yet supported. Movements across the wrap boundary are handled simply as if the map was physically replicated on the other side of the boundary. This allows for accurate fuel estimates and positioning.
EchoView, a Windows information tracking utility, also displays square wraparound maps centered on any position and with arbitrary size. Non-square regions are not yet supported. EchoView also helps you plan hyperjumps (including two-step jumps) across the wrap boundary.
The way PHOST implements wraparound for ships is described below. The same algorithm applies to minefields. Planets are not moved, but if they are located outside the wraparound region, then PHOST pretends that they do not exist.
When PHOST performs ship movement, the X and Y co-ordinates of the ship are considered separately. Each co-ordinate that is outside the bounds of the wraparound region is simply offset so that it once again lies within the region. This is done by either adding or subtracting the length of one edge of the region. For a more precise description, see the list of formulas on the "Detailed Operation" page.
Examples:
Aside from the motion of ships, there are other game processes that are affected by a wraparound map. In all cases, the correct outcome of these processes can be estimated by simply assuming that the wraparound region (and its contents) has been physically replicated so that it tiles the plane.
For example, a minefield of radius 100 LY is centered at (2000,1000). The wraparound region is the usual VGAP universe, the square defined by the corners (1000,1000) and (3000,3000). A ship travels from (2000,1100) south across the wrap boundary to (2000,900) which maps to (2000,2900) after the wraparound (total trip length of 200 LY). The ship will be travelling through the minefield for the complete journey, since the lower half of the minefield extends into the upper portion of the map.
Here are the game processes affected by a wraparound map:
Be careful when setting long waypoints for your ships. If the waypoint distance is large relative to the size of the wraparound region, your ship will move in an unexpected direction. This is because PHOST will move your ship along the shortest possible path towards its waypoint, possibly using a wrap boundary to make the journey shorter.
For example, with the usual wrap region defined by (1000,1000) and (3000,3000), your ship at (1100,1100) sets a really long waypoint to (2900,2900). Instead of moving north-east, PHOST will move your ship south-west across the wrap boundary towards (900,900), which maps to (2900,2900).