GPS Hosts

From ComputerCraft
Jump to navigation Jump to search

For GPS clients (devices using gps.locate) to function, GPS hosts are needed. A GPS host is a computer with a modem (or several modems, in some cases) running a GPS host program, such as the built-in gps host (others include the Opus OS GPS server and TrilateratorGPS by gollark). The role of a GPS host is just to respond with its position to pings on the GPS channel, so its position must be set either manually or using existing GPS servers. The combinations of position and distance from multiple GPS hosts allow clients to find their positions using true range multilateration.

GPS host setup

Generally GPS service for a dimension is provided by 4 GPS hosts positioned close to each other. With normal wireless modems these are generally placed high up to maximize communication range, but with ender modems this is no longer necessary. With the built-in gps host program, 4 separate computers with a single modem each are used for this. To set up a computer as a GPS host, place a modem on it, then edit its startup.lua file to contain the following (substituting in the actual coordinates for each computer): shell.run "gps host <x coordinate> <y coordinate> <z coordinate>". This will make gps host run on startup, with your specified coordinates provided to it. There are programs available to automate constructing and configuring these, as well as alternative GPS host programs which only use one computer. For information on use of these, please consult their documentation.

Distances are calculated from the position of the block the modem is placed on (usually a computer or full-block modem), and not the position of the modem itself. You can find the position of the computer easily using the "Looking at" information in the F3 debug menu. Ensure that your GPS hosts are configured with the correct position, or GPS fixes will be inaccurate.
Separate GPS servers are required for each dimension. Ender modems are recommended so that GPS service is available everywhere within one dimension.
A common and effective arrangement of GPS hosts.