One of the most successful games about programming had the player write assembly code for a processor that never existed, another shipped with thirty-odd pages of documentation that the developers quite seriously recommended printing out and filing in a binder, and a third, made on a budget of a few thousand, sold almost a million copies, even though only 2% of buyers ever made it to the end of the game.
All three games were made by one studio of five people (by the end, that is, it started out as one), but then they shut down, because engineers are usually bad at making games about engineering for non-engineers.
When I started digging into which games about electronics even exist, it turned out that the developers of games about that very electronics try to get rid of the electronics in their game at the first opportunity. Because it's hard, hard to build, hard to present to the player, hard to weave the rules and puzzles into the story... Writing an applied circuit simulator for your own needs and tuning it to your own whims is just a work task.
So transistors get replaced with logic gates, voltage is represented by two discrete states, and wires become simply a way of passing information between components rather than physical objects with resistance and a certain chance of turning into a heating element.
And I understand the developers, because there are perfectly reasonable grounds for doing it this way. But to understand why, you have to dig a little into the history of the engineering puzzle genre, which over the last fifteen years has managed to acquire its own name, a peculiar audience and a set of design patterns that are sometimes rather nice to break.
The TL;DR at the end will be about my own game for engineers.
Most classic puzzles are built around a state space inside which the game has hidden one or several solutions in advance, and the player has to figure out how to get to those states. In a sense the designer has already done all the interesting work, and now the player just has to walk the same path, the classic "golden path" that works in every other game with even a hint of a quest in it.
With engineering problems it's a completely different story, because the developer often knows only the requirements for the result and the set of available tools, but doesn't necessarily know at all what the solution will actually look like, and this too has a name, "wayfarm", and it usually turns up very rarely in games, since it demands a lot of the designer's resources and time. You know the examples very well - "Crazy Machines, Minecraft, Fallout, BG, Terraria, DF", few and far between, but every one of them a hit, as they say.
Back to engineering... say there's a task to build a device that turns on a light bulb for five seconds when a button is pressed. In a regular puzzle we place predefined components on the board until we get the sequence the author had in mind. In an engineering puzzle we can build a timer out of a capacitor and transistors, use a counter with a pulse generator, or just do the whole thing on a microcontroller if one happens to be in the list of available parts, and each solution will have its own drawbacks.
The real characteristics of the resulting solution will depend heavily on exactly which components are available to the player, so the problem acquires independent optimality criteria, and a solution that's good by one criterion can turn out to be pretty bad by another. Once a solution has more than three variants, the complexity of balancing it any further grows quadratically, adding headaches for the designer. That's actually why three ways to complete a quest is the "gold standard" in regular games, and people try not to do more, because the chance of breaking everything goes up very sharply. In regular games, but not in all of them.
It's around this very "complexity" of engineering work that Zach Barth built most of the games of his studio Zachtronics.
KOHCTPYKTOP
In 2009 Zach released a small browser game called KOHCTPYKTOP: Engineer of the People. In it the player works as an engineer at a semiconductor plant and gets assignments to design integrated circuits that are assembled directly from layers of metal and of semiconductor with different types of conductivity, meaning the player hasn't been handed a ready-made AND, OR or NOT yet, and those have to be manufactured somehow too.
The game was, of course, a fairly loose representation of the real chip design process, in particular it took a few technical liberties, but the very idea of going one level below the familiar logic elements was pretty interesting.
The Soviet theme was somewhat more modest than you might guess from the title, and players were invited to work out for themselves what all of this has to do with communism, but it is in there. KOHCTPYKTOP was one of a whole series of free browser games by Barth, which also included Infiniminer and The Codex of Alchemical Engineering, and ideas from these small games later flowed into game jam games until they turned into standalone commercial products of Zachtronics, which has since become history.
SpaceChem
In 2011 SpaceChem came out, the studio's first commercial game, in which you had to program manipulators inside a reactor, making them move atoms, create and break chemical bonds and put out the required molecules. The idea grew out of The Codex of Alchemical Engineering, and Barth also told a GDC audience how, while visiting Gas Works Park in Seattle, he got the idea of combining chemical bonds with a system of pipelines. What came out was something in between programming, designing production lines and a spatial puzzle.
SpaceChem has a fairly detailed postmortem on Game Developer, if you're curious to read it and get a sense of how small independent games were developed back then. Seven people worked on the project, all of them had day jobs, and they worked on the game in their spare time for about a year. The cash budget came to about 4000 dollars, and no profit was expected at all.
SpaceChem came out on January 1, 2011 at 20 dollars and sold more than a million dollars' worth in total, but for all of SpaceChem's commercial success it had a serious design problem. The developers of SpaceChem were engineers with no game development experience, and they figured that if a user had bought a tool (the game), then presumably they'd want to use every capability of that tool, which is probably logical...
So they put fifty levels into the game, gradually raising the difficulty and adding new mechanics, and since the game also had a full-fledged storyline, in order to find out how it all ended the player had to somehow solve the hardest problems as well. As a result the game easily stretched out to forty-plus hours, and only 2% of players reached the ending.
But the remaining 98% didn't think the game was bad, it's just that some had their fill in the first ten hours, some spent a few evenings optimizing a reactor they'd grown fond of, and some hit a wall with a problem that needed more time than they were willing to spend on it. The problem was that a significant part of the content they'd built was designed for engineers who are used to solving problems.
Histograms instead of honor rolls
Another rather interesting thing in SpaceChem was the histograms showing how many elements other players had used and in how many cycles their solutions completed the task. A regular global leaderboard in an engineering puzzle turns pretty quickly into a list of a few people who spent as much time optimizing one particular level as everyone else spent on the whole game.
But if you show players the distribution of results, it turns out that even while being pretty far from the record, a player can tell how reasonable their solution is in the first place, and this feature is what sold Zach himself to Valve, who invited him to build the mechanics of that service for the whole of Steam.
Number of elements in player solutions:
5 │ ▏
6 │ ███
7 │ ███████████
8 │ ███████████████████
9 │ █████████████
10 │ ██████
11 │ ███
12 │ ████ ◄ Your result
13 │ █
14 │ ▏
And there's no need whatsoever to show other players' actual circuits, because the interesting part is precisely the hunt for a way to cut down the number of elements, not copying a solution someone has already found. For a game designer there's a separate bonus here, since the players themselves show which levels they consider hard and what needs tweaking in the game.
TIS-100, or documentation as gameplay
In 2015 Zachtronics released TIS-100, which looks a lot like a tool for debugging a multiprocessor system that wandered into the games section of Steam by accident. The idea grew out of another project, The Second Golden Age, which turned out too big for the team, so that problem was split off into a separate project and then into a game, developed in parallel with Infinifactory.
The player was given an old computer with an unusual architecture, a set of compute nodes, each of which ran its own small program and exchanged data with its neighboring nodes, and conceptually it looked roughly like this:
INPUT
│
▼
┌─────────┐ ┌─────────┐
│ CPU 0 │◄──►│ CPU 1 │
└────┬────┘ └────┬────┘
│ │
┌────▼────┐ ┌────▼────┐
│ CPU 2 │◄──►│ CPU 3 │
└────┬────┘ └────┬────┘
│ │
▼ ▼
OUTPUT OUTPUT
The capabilities of each node were quite limited, which forced the player to spread the work across processors and handle the synchronization by hand, while also trying to squeeze the program into the available number of instructions.
The game came with a full fourteen-page manual written in the spirit of early-eighties microcomputer documentation, which the developers recommended printing out on paper. For a modern game designer this is very strange, because for decades the industry had been steadily getting rid of any need to read or do anything before starting to play, and here reading documentation was not only brought back but even put on the product's list of core features. I have to say it worked for them, my stack of pages is still lying around somewhere, although I never did finish the game. The documentation was also part of the setting at the same time, adding to the atmosphere of a "physical device".
TIS-100 cost seven dollars, which Barth later considered too low a price, since it could have cost four times as much, which is how players and Steam itself later valued it. Of course, actual sales happened at various discounts, in different regions and as part of various bundles, minus Steam's cut, and it turned out that Barth got back about 50 cents per copy.
SHENZHEN I/O and electronics without electronics
The studio's next game, SHENZHEN I/O, came out in 2016 and offered not just programming some strange hardware, but taking a job as an engineer at a fictional Chinese electronics manufacturer.
The idea came after Barth got to know Andrew Huang, who ran a blog about Shenzhen, around which a huge infrastructure for developing and manufacturing electronic devices had grown up.
Once again the player received assignments from colleagues and customers and designed boards out of microcontrollers, memory, screens and other components. On top of that you had to write small programs that made all this stuff work somehow, but unlike TIS-100, where the hardware was already given, here it had to be designed too, taking into account the cost of components and the limitations of the board itself.
SHENZHEN I/O was good in every respect, but for the sake of reaching a wider audience most of the usual electronics problems were happily thrown out of the game, although at first this was presented as a core mechanic. The player doesn't have to think about whether there's enough current to power the connected devices, why noise shows up on the line, or how a microcontroller managed to stop working even though nobody changed anything. So the wires in SHENZHEN I/O carry logical information between components, and the main difficulty of the game lies at the level of how the devices interact and the code written for them, and with no physics, most of the problems that come with it are gone as well.
The studio continued the TIS-100 experiment and once again turned the documentation into a core feature, bundling a manual of thirty-odd pages that you were again invited to print out and read cover to cover. The result was an amusing contrast with an industry that usually tries to remove from a game everything that keeps you from starting to play right away, while at Zachtronics the technical documentation for a fictional microcontroller turns out to be marketing material.
Opus Magnum
In 2017 the studio, by now eight people, went back to the ideas of the old browser game The Codex of Alchemical Engineering, which SpaceChem had already grown out of earlier. That's how Opus Magnum came about, in which the player took on the role of an alchemist and built machines out of mechanical arms that rotate and move particles of matter between various work areas.
Solutions were scored on the cost of the machine, the area it took up and the number of cycles, and players were allowed not to build their solution around some optimum found in advance, and there were deliberately no in-game rewards for optimization. That is, if a player built a huge machine that takes up half the screen and produces one molecule per hundred cycles, but still meets the requirements of the task, the game accepts it just fine.
The further fight over cost and performance, however, played out between the player and their own sense of beauty, plus a little bit with other players, giving rise to the "minimizing" of solutions, and this was helped along by a very simple feature of the game itself that let you make GIFs of your solutions and share them. And every such piece was at once a showcase of what the game could do and the work of a particular player who wanted to show off the thing they had built.
There's a fundamental difference between a trailer in which the developer tells you what interesting things you can do in the game and a clip in which someone has already done one of those interesting things.
Where did all the amps and volts in games go
If you put together the games listed above plus a small wagonload of other, less famous ones, it turns out that in practically every one of them we work with some language for describing a system's behavior: assembly, logic gates, mechanical arms or entire production lines. But in every case the game developer limits in advance the number of possible states of individual components and the rules for moving between those states. With analog electronics this trick works worse, and an ordinary NOT logic element can be conceptually represented in code:
bool update(bool input)
{
return !input;
}
If the input state has changed, we recompute the output state and notify every element connected to the output. This is, of course, a heavily simplified description of a digital simulator, which can have signal propagation delays, undefined states, feedback loops and other quirks, but it's enough to get the principle.
Now try putting a transistor with a few resistors in place of that one logic element. The base of the transistor can sit at practically any voltage within the circuit's supply voltages, the collector current depends on the transistor's operating mode, and the connected load affects the voltages and currents in other parts of the circuit. And if you add a capacitor, the state of the circuit starts to depend on its previous state as well, since under normal conditions the voltage across a capacitor doesn't change in a jump, and for a simple RC circuit charging from a constant source it looks like this:
U(t) = Usource × (1 - exp(-t / RC))
With a resistance of 10 kΩ and a capacitance of 100 µF the RC time constant will be one second, and after one second the voltage across the capacitor will reach about 63% of the source voltage, after three seconds it will be 95%, and only after five seconds will it reach 99%.
But if the player hooks an additional load onto this circuit, the original expression may no longer describe the behavior of the resulting circuit, so in the general case an analog simulator works as a system of equations describing the state of the entire electrical network, and those equations have to be solved all over again every tick, roughly like this:
while (simulation_running)
{
build_circuit_equations();
solve_node_voltages_and_currents();
update_component_states(dt);
update_measurement_devices();
simulation_time += dt;
}
On top of that, for nonlinear components the solution may take several iterations, and picking too large a time step means that some of the transients will be computed with insufficient accuracy... which is a problem, because the circuit starts behaving strangely.
A circuit can work almost correctly, correctly with some parameters and incorrectly with others, correctly for the first second, or correctly right up until someone hooks a load up to it, so checking a game assignment has to be more involved than simply comparing output values too.
Say we want the player to build a device that puts out a voltage of around five volts, and we can check the output voltage at one specific moment in time, but then the player can potentially build a circuit that puts out the required five volts only at that specific moment and spends the rest of the time busy with something else entirely.
Consequently, the task specification has to describe the allowed voltage range, the signal settling time, how long the device runs and, if it matters for the task, how it behaves under load. At some point it turns out that we started out making a game and ended up writing technical specifications for the manufacture of electronic equipment.
Why there are so few analog puzzles
Among the games I managed to find on Steam, practically all the projects that claim to simulate analog electronics are either fairly small or very simple. For example, 101 Circuits asks the player to build circuits so that the signal on the oscilloscope matches a given signal. This is a natural way of checking an assignment in analog circuit design, if you're an engineer.
The developers of Electronics Puzzle Lab, on the other hand, simply warn on the game's page that it simplifies electronics and is not an electrical circuit simulator. The project turned out to be much harder than the author expected, the interface was never brought to a state where it could be properly tested on users, and in the end it all came down to about five levels, so having a mathematical model of an electronic circuit doesn't by itself solve the main problem.
Or there's the fairly well-known browser simulator CircuitJS, which originally grew out of Paul Falstad's simulator and already knows how to compute the behavior of a large number of different electronic components and show the results clearly, but I couldn't find a single released commercial puzzle game built on its principles, and after all it's a circuit simulator meant for people who are already "in the know", not a game.
So making a simulator that computes an electronic circuit correctly is one task, and making a person who had no idea how a transistor works before launching the game actually enjoy designing a circuit with a transistor in it is a completely different task, and the two have very little in common.
Now let's try making a game about a Soviet research institute
If you've been reading my articles for a while, you probably know that I didn't start out in game development at all, but at a real research institute that built hardware for all sorts of hush-hush facilities, and the air of the Soviet school of electronics was still very, very fresh in there, if you can put it that way. And I wanted to show and pass on a little piece of that atmosphere, especially since most of the people who were junior research fellows back in the 70s are hale and cheerful, get around at a decent speed and still tinker with things, telling very funny stories.
As for the analog electronics simulator, it more or less came about by itself, all I had to do was dig up the phone numbers of my former mentors and refresh a couple of textbooks in my memory. The simulator, by the way, is an honest one and doesn't particularly care what difficulty level the player is currently at.
If Ohm's law says that too much current is flowing through a resistor, the resistor will dissipate the corresponding power, even if the player hasn't reached the chapter about power yet. So the main way of controlling difficulty becomes not changing the rules of the simulation, but limiting the number of available components, parameters and ways in which the player can interact with the circuit.
And the level designer, instead of handing out the whole assortment of radio parts right from the first level, has to make a puzzle out of a power supply, a light bulb and a few resistors in such a way that the player discovers the relationship between resistance and current on their own while experimenting.
Then comes the ability to measure voltage, then one more component is added, then a capacitor, a transistor, and somewhere further along the campaign all this stuff starts turning into oscillators, amplifiers, registers and counters, but the physical rules on the first and on the last level stay the same.
And then the testers discover that circuits can be optimized, even though this was never originally built into the mechanics. You can tie optimization to the cost of components, power consumption, occupied area and other characteristics of the circuit, but if the device meets the spec, then it's probably not worth forcing the player to shave another three kopecks off its cost before showing them the next chapter. Then again, whoever really cares about those three kopecks will most likely go after them on their own.
Documents turned out to be an interesting moment too, I tried with all my might to get the technical reference out of the game, because if some level can't be beaten without reading a few pages of specially written explanation of the order in which to connect the components, then the level most likely needs a bit of reworking. But in testing it turned out that the assignment notebook, the factory instructions and the newspapers can also be part of the game world, along with all the fuss around paperwork.
In lieu of a conclusion
I like that over the last fifteen years games about engineers have become more interesting and less engineer-y, but in the case of a game about analog electronics it's precisely the physical side of the process that turns out to be the most interesting part of all.
If you replace voltage with a logical one, current with the mere fact that a signal is present, and drop resistance altogether as unnecessary, designing circuits becomes much easier, but a pretty big layer of engineering problems disappears from the game, the very problems for whose sake the whole simulator was started in the first place.
The game's demo is on Steam, https://store.steampowered.com/app/5618740/ELECTRONIKA_8. The game was made by a team of six over a little more than a year, I'm bad at design, so I wrote the code for the simulation engine, since my hands still remember all those formulas even twenty years on. If you suddenly feel like helping promote the game or just want to ask for a key for yourself... don't be shy.
All articles