Minecraft and Forge: Try This Amazing Way to Visualize Logic

I’ve got virtual circuits on the mind lately. There are a myriad of tools out there that I could pick up to satisfy this compulsion. But the one I’m reaching for is Minecraft. I know what you’re thinking… a lot of people think Minecraft is getting long in the tooth. But chances are you never tried some of the really incredible things Minecraft can do when it comes to understanding logic structures. This goes way beyond simple circuits and easily hops back and forth over the divide between hardware logic and software logic.

Traditional Circuit Simulation

Circuit simulation is a very cool idea — arrange virtual electronic components on the screen and test the circuit prior to assembly. Of course major EE programs do in fact have circuit simulation built right in. They’re not a substitute for practical testing, but are crucial to helping the engineer understand the abstract concepts that pop up in electron theory.

On the lower end, some online layout programs have rudimentary connectivity indicators — in Fritzing the contact point turns green once it’s connected, or red if contact is broken. Circuit123 claims to offer the ability to visualize electrical activity in a circuit but it’s almost a joke — there’s an LED that appears to light up, and a motor with a turning shaft, and that’s pretty much it. It also, notably, lacks the measurements that make it more than a novelty.

There are more serious tools that do a good job of helping engineers design circuits. SPICE programs allow engineers to prototype circuits on the schematic level. And of course we here at Hackaday have been in love with Falstad since discovering it a few years ago. Al Williams did a great dive into understanding logic circuits with it not long after that.

These all help the human mind visualize what’s going on with all of those electrons. What they don’t do is help you wrap your noggin around programmable components. Where do you look if you want to better visualize what’s happening in a program? You can’t drop a RPi icon with a Python script on it into one of these simulators, and it’s a damned shame. Put bluntly, they do not address software’s logical structure at all — you can’t see an if/else or while work on the screen.

Ironically, it took a game to really do a good job at immersing people in an engineering-rich environment. I am of course talking about Minecraft.

Indulge Me While I Go Down the Cubiform Rabbit Hole for a Moment

Since its debut, Minecraft has become known as an engineer’s game — complicated structures can be built with a variety of materials, and different elements work together following very readily understood rules. It appeals to all age levels and it can be played with or without monsters and fighting, making it a favorite among kids of all nerdiness levels.

Minecraft’s analog for electronics is Redstone, a magical ore filled with uh… magical power that somewhat resembles electricity. There are switches, lamps, comparators, repeaters, and other elements also found in the EE world. Wiring takes the form of “redstone dust” that is sprinkled in trails above and next to the blocks to be powered.

Very early on it was realized that you can use Minecraft’s Redstone elements to make simple circuits and logic gates. For instance, the image to the right shows an OR gate. Flick the switch and the piston actuates, pushing or pulling the Redstone Block (the red cube) so that it contacts one or the other lamp. The switch is the piston’s power supply, so you can substitute a Redstone signal for the switch to get the same effect.

You can see how you can use different combinations of those elements to create other logic gates. Furthermore, you can create more complicated structures the same way. A quartet of Redstone Repeaters in a loop makes a timing circuit, for instance, releasing pulses of Redstone energy at regular intervals.

As game development progressed, Command Blocks were introduced, serving as primitive computers meant to operate in the background — they do not appear on any menus, and can only be created with console commands. They are also powerful, able to affect any element in the game. However, very quickly they got hijacked by engineers as well. For instance, this guy created a BASIC interpreter using Command Blocks. Working with world-controlling software WorldEdit, you can do a lot of crazy things.

Another exciting element in the game, Minecraft also released a Raspberry Pi version of the game, allowing you to not only create portable versions of the game but far more importantly, it can run Minecraft in conjunction with world-interacting Python scripts. Not only can you control the game world with this rig, the game can also control the RPi — this in-game light switch is a great example. You can also control an Arduino that is plugged into a PC running the game. MCreator is custom software that allows serial control of an Arduino through Minecraft and presents a drag-and-drop, no-code interface.

But It’s Not Really Electronics!

It is true that Minecraft’s approach carries with it a distinct fantasy element. It’s not trying to show off resistors and capacitors. Redstone Dust traces don’t behave like wires, and Redstone Comparators work in unexpected ways. Power supplies come from surprising places — torches, really? — and work in unrealistic ways.

Okay, so it doesn’t teach electronics in the literal sense. But it does teach engineering — it teaches you logic, to make the best of a limited palette of components, to research the capabilities of each component, and to approach a project from a perspective of planning it out from start to finish with a clear idea of what is supposed to happen and how it will happen.

It helps hone an engineer’s sensibilities — it’s not good enough to make it simply work. How do you create the most elegant solution? When you max out your RAM with dodgy code, you can’t visualize how bloated it is. But when your Minecraft circuit consists of a factory-sized labyrinth of tangled elements, you can pretty much see it. You can see the loop, you can stand on it. You can see the Redstone traces light up with power. It gives you a new perspective on how the elements come together.

Sometimes you can even create cool things that simply work — the image above shows a 20-channel NOT Gate with a power supply in the center (visible as a tiny yellow dot) triggering 20 Redstone Torches. While normally on, this rig turns off the torches as long as the power supply is positive. How cool is that?

Minecraft Computing Levels Up

The number one problem of creating circuits in Minecraft is that they really don’t look or act like the real deal. The classic windmill-jousting project of enterprising Minecraft hackers is the clock. Can it be done? Never mind accuracy, can you create the thing in less than castle-sized enclosure? Something that would be relatively simple in the real world doesn’t work, or barely works, in the game.

Part of the problem is the wiring. Redstone dust automatically connects to every adjacent conductive surface, so you have to insulate by raising one strand or insulating with an empty block. This creates two problems. First, you have really huge labyrinths of wiring that stretch on for what seem like football fields in of game terrain. Plus, Redstone Dust wiring all looks the same, and when you get into complicated structures it’s easy to follow the wrong trace.

Now, if only someone could create a mod that would make Minecraft’s Redstone parts act more like electronics! Fortunately, there is a modding community to which to turn.

Mods for Electronics-Like Minecraft

Minecraft’s creators have been very cool about casual users writing mods for the game, and in 2012 released their Forge API to facilitate this creativity — just another of the game’s nod to engineers. Many casual modders have used Forge to make cosmetic changes only; for instance, giving people’s Minecraft projects a Halloween theme. Forge goes way beyond that, however, by allowing users to overwrite the Java building blocks (ha) of the game. You can literally change Minecraft into a different game.

As with any open-source project, many different modders worked on different parts. For instance, ForgeMultipart changes one of the core tenets of the game, which is that each block has only one thing going on with it. Among other advantages, it allows faux-electronic components to get much more compact. Another cool mod was the Forge Relocation API used to transport blocks around the game world.

Those two mods, along with a few others, have come together as Project: Red, the most ambitious attempt yet to introduce (more) realistic electronic elements into the game. Some of its features include insulated wires with 16 different colors, as well as bundled wires so multiple signals can cross over the same block. This is where that MultiPart API comes in, allowing multiple signals to enter the same block at the same time.

Insulated wires only connect to other wires of the same color and do not power any support blocks the way Redstone Dust would, and vice versa — if a support block becomes powered by another source, it doesn’t affect the power level of the wire. Wiring in Project: Red also can be placed on the undersides of blocks, unlike dust. There are multicolor LEDs, even though there isn’t colored light in Minecraft.

Where Project: Red gets really sick is when you get into the ICs. They’re the same ones you’d expect: timing circuits, logic gates, sensors. In essence, Project: Red takes those room-sized circuits and shrinks them down to a single block, kind of like the real world! For those of you pining for a Minecraft clock, there are double 7-segment displays, each controlled by 16 signals. Powering a wire lights up a matching segment, with the 8th and 16th lighting up the decimal points. Your Steve can change the settings of any IC with a screwdriver.

One of the new elements that most excites me, and where the true computing power of the game will become evident with this mod is that network pipes transport not packets of data, but game blocks. Employing ICs that detect block type, it becomes easy to see how such a mod could be used to make a fairly sophisticated CPU.

Project: Red was created by college student [MrTJP] with contributions from other mod creators, and you can help support his efforts on Patreon. The following video does a good job of describing the project.

Simulating Electronic Circuits, For Realsies

While Project: Red intrigues, there are still many artifacts from the game that interfere with it being an actual simulator of electronic circuits. Does a simulated circuit that works oddly from an electronics standpoint, but realistically from a logic standpoint, offer enough? Does the VR angle offer any advantages? Is being able to walk around and literally inspect every connection and component better than looking at a schematic on-screen?

I’m not sure, but I feel like a programming and design environment — like Minecraft but realistic — that teaches about components and logic at the same time, would be a great tool for development and education. Let’s get on it!

18 thoughts on “Minecraft and Forge: Try This Amazing Way to Visualize Logic

  1. Let’s start with the biggest inaccuracy in the article: Forge is a 3rd party API, not related to Mojang (Minecrafts developer) at all.
    Second, ForgeMultiPart (which, despite the name, doesn’t have any relation to Forge) is outdated, it was superseded by MCMultiPart library by [Amadornes]. It has much wider mod support and is updated to the current version of Minecraft (1.12). [Amadornes] is also the author of (soon to be updated) Super Circuit Maker which allows players to make much denser integrated circuits.

  2. Some additional Minecraft mods you may find interesting on the topic, and make great additions to Project Red:

    Super Circuit Maker – Let’s you build up your own logic on those tiles, including multiblock/multi-tile structures.
    ComputerCraft, or OpenComputers, both integrate fully with the bundled cables of Project Red and give you Lua scripting abilities.

    Those work with Forge and are in the curse repos (or whatever they are calling it now that twitch bought them)

    1. OC is to be preferred over CC as it has a much more realistic approach to computers, so if you love to play survival they are a much more rewarding mod.
      And if you don’t like Lua as your “CPU” you can always install a 6502, Z80 or even an ARM CPU as an addition mod to OC. And on top they don’t reset when their chunk gets unloaded, they only pause. So overall OC is just the better mod here.

  3. This needs to be combined with the CA article posted earlier today. The truth is that Minecrafts redstone works like a CA. It happens to look like an electronic circuit, but it really does not work like one. The problem is that most redstone logic is dependant on localized independent power sources in the form of switches, redstone torches, and a few other blocks.

    1. “The problem is that most redstone logic is dependant on localized independent power sources”

      That isn’t the case with the logic gates in the red power mod. I’m also not sure it matters when only discussing the logic gate functional level.

      After all, your NOT gate IC also requires an independent power source as well does it not? Usually labeled in the form of “Vcc” or the like. It would be hard to use your input pin voltage to power the output pin with a standard NOT gate, seeing as you expect the output to be on and providing voltage when there is no voltage on the input pin.

  4. Project:Red is actually an open-source revival of a closed-source mod called RedPower, developed by Eloraam who hasn’t updated the mod since Minecraft v.1.4.6 (which was released several years ago).
    Other cool mods include Thermal Expansion, which adds automation machinery such as Itemducts, which allow items to be transported and sawmills that give a higher return of wooden planks per log.

    Thanks for the article! The technical bits were really good.

    1. Those games are great, but Minecraft has some benefits as an introductory tool for kids.

      Teaching a whole new environment just delays the actual learning and discovery. If the majority of the kids present have played Minecraft (which is extremely likely) then having them do things inside that world will be as intuitive as Lego or Snap Circuits, except they are even more attentive because it’s Minecraft and that’s enough to get them excited.

      Or, for people like me who already know this stuff and also play Minecraft, it’s great to shoehorn that sort of functionality into what you’re already doing. Sure I could build an adder anywhere, but by building it in Minecraft I have the benefit of connecting it to my little cake factory and optimizing production with it.

      When I was teaching freshmen classes on logic design, I’d pull up Minecraft during tutoring sessions to provide some examples during tutoring sessions. I had the map files for a nicely organized 4-bit CPU, and would fly around showing students how the different circuits (adders, registers, etc.) combined to form something useful. Not so useful in the game, but that’s not the point.

      Around the same time I was running a server of my own and there were some tech-minded high school students playing with us. I built a “Redstone Academy” and would grant access to special mods (wireless transcievers, fast clocks, etc.) to players who could build and demonstrate the basic logic gates, and build a circuit that implements a truth table I gave them. I don’t think most realized they were learning anything useful, but it’ll come in handy when they get to college and have to build an adder out of 7401’s.

    1. I’m a former developer of the Java version of Minecraft (not Notch; a number of Mojang staff have left over the years) and pretty much never stopped cringing from the beginning of this article to the end.

      The simple fact of the matter is that a redstone torch is a NOT gate (with restrictions), redstone dust is an OR gate (with restrictions), and that’s about all you need to know in order to start making useful redstone circuits, unless you’re cataclysmically stupid. With a NOT gate and an OR gate you can make the universe, it’s Turing-complete. If you want to get really fancy, a redstone repeater is a diode.

      Sure, it’s not 100% analogous to “real” digital logic, but it’s more similar to how electricity actually works than this execrable article would indicate: If you have multiple outputs on one line of redstone dust, you’ll want to use redstone repeaters as buffers. If you want to make a clock, you just hook up an odd number of NOT gates (redstone torches) in a cyclic chain, what is this “making a clock is sooooo hard” nonsense? And in terms of needing to account for delays due to needing repeaters to extend a signal past 15 blocks, have you never heard of the term “propagation delay” when it comes to designing actual silicon?

      This article is ridiculous. It jumps into the out-of-date deep end of the pool while ignorantly giving the middle finger to the notion of familiarizing yourself with more basic concepts first. Which I guess is apropos of nothing given the number of “hacks” featured here that use a Pi or an Arduino to do something that would otherwise require about 15 minutes of thinking and a handful of discrete components. Christ.

      1. I think the clock this article talks about is not a clock in the technical sense (i.e. a regularly switching signal) but a device that shows the time. That could be fairly complex to create in unmodded Minecraft (not that I’ve tried).

  5. Having made a 7 segment display up-down counter using redstone in vanila minecraft back when I had absolutely no idea on what electronics design is, well, I’d blame minecraft as one of the reasons for why I am currently in the field of electronics.

    Also, if you enjoyed this aspect of minecraft, you should checkout Zachtronics Industries games. Namely SpaceChem, Infinifactory, TIS-100 and Shenzhen I/O.

    From logic, automation, assembly coding, to embedded systems design. It’s like work but you don’t get paid with money. Just fun and satisfaction from solving puzzles. Hahaha

    P.S.
    Not to mention also that zachtronics is responsible for the minecraft source.

    1. TIS-100 is excellent. It’s not quite real Assembly, but it’s a plausible dialect and friendly enough to work with. I generally point people towards it when they say they want to learn Assembly, because it introduces the concepts without getting mired in hardware, emulators, assemblers, registers, etc.

    1. – No redstone
      – The mods and support aren’t even comparable

      I’ve used Minetest and it is indeed nice. Unfortunately, just like how the Orange Pi is superior to the Raspberry Pi in every measurable way, sometimes the inferior option is better because of how much smoother the experience is and how many powerful tools have already been built by the massive community.

      And besides, Minecraft is effectively open source anyway. It’s easily decompiled and deobfuscated, you just have to go that extra step yourself.

  6. I would love a game that was about digital logic, but not a puzzle game. I’d like a control/automation setup where you have have to build all the control logic at gate level, creating your own integrated circuits along the way. Start off with relay based systems then vacuum tubes and progress down the tech tree.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s