Skip to content

Several processors

One processor is one queue of lines. Two run in parallel — and that is the only way to speed up without changing the block

tick 0
Sensor0
=
in
Sensor1
=
in
Write2
Write3
Operation4
=
@counter0number
copperLeftnullnull
leadLeftnullnull
samplesnullnull

Two processors and a cell between them. The top one takes the readings off the store and puts them into memory, the bottom one reads them out of there and prints the sum. Each is busy with its own job and runs at its own speed.

For speed. A hundred-line program in a micro processor gets through an iteration once every fifty ticks. Cut it in half, place two processors — and each half will run twice as often. That is the only way to speed the work up without changing the block: setrate only lowers the speed.

For order. A separate processor for the turrets, a separate one for the factory, a separate one for the display: each small, each understandable, and one breaking does not bring the rest down.

For links. A processor’s link range is limited: a micro processor reaches ten tiles. A base is wider — so there will be several processors out of sheer geography.

Way Good for
a memory cell numbers and objects, many and for a long time
reading a neighbour’s variables one or two values, with no extra blocks
a global flag a “yes/no” between world processors
a unit’s flag a mark that has to travel with the unit
the building itself when the neighbour can see the same store anyway

A cell is the most ordinary option: it is visible to both, it survives an edit to the program and it holds sixty-four values.

Nobody. The processors are not synchronised: each runs in its own turn, whenever a tick falls to it. Two things follow from that.

Many. The game happily holds hundreds of processors, and what usually runs out is not the game but the person: ten processors talking through a single cell are hard to debug.

The sensible middle is to split by job, not by lines: one processor is responsible for one thing entirely and does not climb into anybody else’s.

Unofficial fan project, not affiliated with Anuke. Mindustry sprites, fonts and translations © Anuke, used under GPL-3.0; Fira Code under OFL-1.1. Site code is GPL-3.0.