Tutorial 10: a gate to another star

Goal: a shortcut between Helios and its nearest star, Vesper.

What you need

A fortune: 2 wormhole_gate (400 000 MT each), 16 capacitor (8 000 each), track, and a power station at each end.

Steps

  1. Reach Vesper. On Galaxy the other stars are unnamed lights: click one to order a flight (explore_order with kind: "point", x, y). Then explore a body (kind: "body", target) and spacecraft_travel to its field. Helios to Vesper is about 520 to 550 turns. Bring patience.
  2. A gate weighs 20 t, the whole mass limit of your hold. Carry one per trip, and the rest separately.
  3. At each end, lay straight track and place the gate on it along its direction, with track open on both sides (structure_place with item: "wormhole_gate", x, y, direction).
  4. Run a cable from a power station to the gate's DC input. It charges at up to 4 kW.
  5. On each gate page, Install a capacitor from the hold eight times (gate_capacitor_install with id).
  6. On one gate, Pair with the other, Link (gate_link with id, other).
  7. Wait for both banks to fill. Each end pays 2 kWh plus 0.5 Wh per thousandth of an AU, then 200 Wh a turn. For about 54 AU that is roughly 29 kWh of a 32 kWh bank. Stars much beyond 59 AU are out of reach of one pair.
  8. Move the ship within 12 cells, set Turns, Open the gate (gate_open with id, turns), then Fly my spacecraft through (gate_fly with id).

The gate also has a default script that answers GalaxyNet messages. The gate must be online:

DEFAULT_TURNS = 6
MAX_TURNS = 240

def turns_asked(payload):
    if type(payload) == "dict":
        payload = payload.get("turns")
    if type(payload) == "float":
        payload = int(payload)
    if type(payload) == "int" and payload >= 1:
        return min(payload, MAX_TURNS)
    return None

def reply(base, ok, text):
    gate.log(text)
    net.publish(base + "answer", {"ok": ok, "text": text})

def ask(base, status, payload):
    turns = turns_asked(payload)
    if turns == None:
        turns = DEFAULT_TURNS
    if status["state"] == "open":
        reply(base, False, "already open")
    elif status["remote"] == None:
        reply(base, False, "this gate has no pair")
    else:
        bank = min(status["energy_wh"], status["remote_energy_wh"])
        spare = bank - status["cost_wh"]
        if spare < status["hold_wh"]:
            reply(base, False, "a bank is short: %d Wh, %d Wh to open and one turn of hold" % (bank, status["cost_wh"] + status["hold_wh"]))
        else:
            allowed = spare // max(status["hold_wh"], 1)
            gate.open(min(turns, allowed))
            reply(base, True, "opening for %d turns" % min(turns, allowed))

def tick():
    if not net.online():
        return
    status = gate.status()
    base = "me/" + status["owner"] + "/gate/" + status["name"] + "/"
    if not memory.get("subscribed", False):
        for word in ["ask", "close", "clear"]:
            net.subscribe(base + word)
        memory.set("subscribed", True)
    for message in net.inbox():
        topic = message["topic"]
        if topic == base + "ask":
            ask(base, status, message["payload"])
        elif topic == base + "close":
            memory.set("closing", True)
            reply(base, True, "will close when the train is clear")
        elif topic == base + "clear" and status["state"] == "open":
            if memory.get("closing", False):
                memory.set("closing", False)
                gate.close()
                reply(base, True, "closing: the train is clear")
            else:
                reply(base, False, "clear ignored: no closing was asked")

What you should see

State open, a turning ring on the map, and your ship out the far side, in front of the other gate.

Three common mistakes

  1. A small bank. The refusal names the energy missing.
  2. Too many turns. Each open turn costs 200 Wh at both ends; with 3 kWh to spare, that is 15 turns at most.
  3. Closing on a train. A gate that shuts while a train straddles it blows up the wagon inside and wrecks those behind. Read turns_left and energy_turns first. The universe does not offer refunds.

Next

You ran out of tutorials. Trains and gates has the fine print.