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
- Reach Vesper. On Galaxy the other stars are unnamed lights: click one to order a flight (
explore_orderwithkind: "point",x,y). Then explore a body (kind: "body",target) andspacecraft_travelto itsfield. Helios to Vesper is about 520 to 550 turns. Bring patience. - A gate weighs 20 t, the whole mass limit of your hold. Carry one per trip, and the rest separately.
- At each end, lay straight track and place the gate on it along its direction, with track open on both sides (
structure_placewithitem: "wormhole_gate",x,y,direction). - Run a cable from a power station to the gate's DC input. It charges at up to 4 kW.
- On each gate page, Install a capacitor from the hold eight times (
gate_capacitor_installwithid). - On one gate, Pair with the other, Link (
gate_linkwithid,other). - 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.
- Move the ship within 12 cells, set Turns, Open the gate (
gate_openwithid,turns), then Fly my spacecraft through (gate_flywithid).
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
- A small bank. The refusal names the energy missing.
- Too many turns. Each open turn costs 200 Wh at both ends; with 3 kWh to spare, that is 15 turns at most.
- Closing on a train. A gate that shuts while a train straddles it blows up the wagon inside and wrecks those behind. Read
turns_leftandenergy_turnsfirst. The universe does not offer refunds.
Next
You ran out of tutorials. Trains and gates has the fine print.