Skip to content

Performance

Dylan Brose edited this page Aug 30, 2026 · 3 revisions

Performance

DNS stays cheap if you only talk when a machine is paired and a job needs work. How often you poll is what costs.

Pair gate

  • Track pair with onPair / onUnpair / isPaired. The client already loads your pack’s pair entries once.
  • Do not start new jobs on unpaired machines. A job already in progress may finish locally after unpair (outputsReady while unpaired is unpaired, no drain).
  • forgetPair on your machine break if isPaired, and on unpaired replies (forgetPair also drops machine pull).

Jobs and I/O

  • Prefer signal: true. Start or inspect the job on onWake (and on onPair, or after a successful finish if you chain). Do not poll every advertised machine every tick to see if a job can start.
  • outputsReady once at job complete. DNS retries drain when storage or power unblocks and wakes you if items actually moved.
  • Polling outputs (signal omitted) runs about once per second. Use that only when you cannot signal.

Energy ("ipc")

  • subscribeEnergyPull(at, wantPerTick) while paired and the buffer is not full (even with no job). wantPerTick is usually remaining room.
  • subscribeEnergyPush(adapter, canPushPerTick) while you have surplus to push into DNS.
  • Do not subscribe in a per-machine per-tick loop.
  • Return watts you cannot store. Send less than allocated on collect if you cannot give that much.
  • Unsubscribe when full / empty / your block break. The client unsubscribes machine pull on unpair. Do not drop Adapter pull/push on machine unpair.
  • After world reload, re-subscribe already-paired machines yourself (Installation). Re-subscribe Adapter pull/push at the Adapter you remembered or found again.
  • One-shot: subscribe, handle that block on the next offer/collect, unsubscribe.
  • "dorios": do not subscribe; DNS writes the tank.

Register

  • clearAdapters, addAdapter for each machine type, then one register({ source }) per world load. Do not rebuild and re-register every tick.

Coordinates

  • Items and craft: Gateway only (hasTag("xxdmogxx_dns:gateway")).
  • Pair, wake, outputsReady, and machine ipc pull: your machine's coordinates.
  • Energy stock, Adapter pull, and Adapter push: the Power Adapter you chose (hasTag("xxdmogxx_dns:energy_port")). Remember it or find it again — DNS does not pick one from your cables.

Do not save Machine Interface coordinates.

Clone this wiki locally