

Solutions can then be further optimized to take less time and use fewer instructions. The player lays out instructions, starts up the factory, observes errors and corrects them, iterating until the puzzle is solved.
SPACECHEM TF2 LEVEL SOFTWARE
Like a good software specification, each puzzle is clearly presented as a black box defined only by its inputs and outputs. SpaceChem and programming involve similar challenges: laying out simple instructions to achieve a complex result while managing limited time and resources. The waldoes are like threads operating on shared memory space, and sync nodes are functionally similar to semaphores (operations that tell threads to signal and wait.) Operating two waldoes simultaneously in SpaceChem forces the player to confront the same shared resource problems as parallel computing. Parallel waldo management is akin to parallel programming, and they share the same perils: deadlock, starvation, race conditions, etc. This coordination is facilitated by the sync node, which tells a waldo to wait until its twin has also hit a sync node. This analogy is enforced mechanically: a factory “crashes” if two atoms collide on the grid, since you can’t store two values in the same memory address.Įach factory has two waldoes, and they must be properly coordinated as they move through time and space. Each coordinate on the grid can therefore be considered a unique memory address.

The amount of memory in SpaceChem’s “cache” is governed by the area of the grid (8 x 10). Data must be written from the cache to a register in order to be manipulated directly by the CPU. The cache is a larger, cheaper form of memory, but it is slower to read and write. If grabbed molecules are like data in registers, then molecules left on the grid are cached. Just as a waldo can only grab one molecule at a time, computers have very few registers and must therefore rely on caching. Conceptually this is analogous to storing data in registers, a form of computer memory that is accessed very quickly and that the CPU manipulates directly. In other words, a grabbed element is more readily and rapidly available than one lying elsewhere on the grid. When a waldo grabs a molecule, it gains the ability to perform instructions directly on it. Like processors, waldoes are the engines that drive the control flow of a SpaceChem factory. The waldo’s analogue in computing is the processor, a hardware component that sequentially executes basic operations defined by machine code. They can grab, drop, rotate, sync, bond, fuse, request input or dispatch output. The waldoes follow the path and sequentially execute any instruction they come across. The player commands two circular “waldoes” by laying out paths and instructions for them. I’d like to elaborate on these manifold similarities, as well as explore how games like SpaceChem could be used to promote procedural literacy. The methods used to tackle challenges in SpaceChem are akin to real techniques used by computer programmers.

While chemistry is the theme, on a mechanical level it has more in common with programming. The game challenges you to build a factory in order to transmute the given input molecules into the given output molecules. SpaceChem is a remarkable puzzle game about fake chemistry.
