< Constellation Games: Subscribe!
From Hiroshima to the Moon >

[Comments] (1) Programmable Minecraft 1: Circuit Layout: I had two distinct kinds of ideas about making Minecraft more programmable, so I'm going to do two posts. (The end of this post explains why I was thinking about this.) This first post is all about circuit design. I'm not trying to get to Python or even ZZT-OOP here, just trying to pull Minecraft up from the "do your own wiring" level without betraying its aesthetic. I don't really build mechanisms in Minecraft because the primitives are so primitive. I got plenty of that in college. I suspect other people are in the same boat, or at least other boats in the same flotilla.

If you're really into redstone circuits then any of this stuff may, for you, betray the Minecraft aesthetic. If so, take heart, for I am not a Minecraft developer and I doubt anything like this will ever be implemented except in a mod, for performance reasons if nothing else. (Here are some mods with blocks for logic gates and basic digital functions.)

My second post will be about ways to programatically interact with the environment, and I think even purists will be able to appreciate that. For now, here are ideas for making circuit layout easier.

Infraredstone repeater: When this block receives a redstone or infraredstone signal on one side, it sends out an infraredstone signal on all other sides. Infraredstone works like redstone, but it's a beam that operates across line-of-sight, rather than a current through a wire. This makes wiring easier and can also be used to make electric eyes, since an intervening mob/opaque block will block the signal.

Logic gates: Don't make players build their own logic gates out of redstone and torches. Just provide them ready-made. Logic gates don't have to be ugly boxes labelled "AND" and "XOR". I really like how a redstone torch acts as a NOT gate. You could add objects to the game that happen to act as logic gates if you hook them up correctly. For instance, the infraredstone repeater, as described above, acts as an OR gate.

Data: Now it's gonna get heavy. I want you to imagine that data itself is an object in Minecraft. You can carry it around and put it in chests and hold it in your hand and dig holes in the dirt with it. Data has no use, but unlike other objects, which are stackable up to 64, data is stackable up to 255. This lets you carry around an eight-bit value in one slot.

How do you get data objects? One way is to use a:

Display: like a tiny chest for data. It has space for one eight-bit value, and on all sides of the block it displays its current value in a big font (using IBM's CP437 character set, like ZZT). You can right-click a display and use keyboard input to set its value to any keyboard-enterable character. If you chain multiple displays together, you can type more than one character at a time, as you can when placing a sign.

A display has an "input" side and an "output" side. If you stick a redstone torch on the "input" side of a display, a single data object will appear inside it, it will start showing a ☺ (character 01 in CP437), and the "output" side will go live with a redstone signal.

But instead of the 1-bit signals of normal redstone, a display block sends and receives data through an 8-bit data bus. Basically I'm increasing the bandwidth of redstone from one bit to eight. Existing equipment such as redstone repeaters will work on an 8-bit signal just as they currently work on a 1-bit signal. Instead of "1", a redstone torch sends "00000001". If you type an "A" into a Display, a stack of 65 data objects will be placed in it, and its output side will read "01000001". By the same token, if you open up a Display and dump a stack of 65 data objects into it, it will start reading "A".

Now that we have redstone data buses, we can support some more interesting blocks:

Multiplexer: Takes two redstone bus signals: "input" and "select", and outputs a redstone bus signal. A single-block multiplexer is useless and never outputs anything, but if you chain two of them together you get a 1-bit multiplexer whose "select" chooses between two input signals based on its low bit. You can chain together up to 256 multiplexer blocks to use all eight bits of the "select" signal.

Similarly, you can chain together up to 256 Demultiplexer blocks to make a demux. I originally proposed a Register block, but the Display is almost a register already--it just needs a "set" line so it doesn't change whenever its "input" line changes.

Perhaps at this point, even non-purists are thinking, "Leonard, all these fancy blocks are spoiling my enjoyment of Minecraft! I like laying out complicated circuits in three dimensions so that I can make a frigging flip-flop! Well, I don't like that, exactly, but I do like having a relatively small number of core blocks, and I don't like where this Multiplexer/Demultiplexer/Register business is going!"

That's why I'd like to introduce you to The Item World. I learned of this insane concept when Dr. Aaditya Rangan showed me the Disgaea series of RPGs. In Disgaea, you can go through a dungeon and kill a demon and collect a sword, just like in any other RPG. But only in Disgaea do strong magics exist that let you go inside the sword, where you'll find another dungeon full of demons, which you can kill to level up the sword.

The Item World is a crazy time-sink in an RPG, but it's a really useful time-sink when you need to lay out circuits. The circuit layout program I used in college had an Item World: you could lay out a circuit with logic gates, then zoom out a level and treat that circuit as a tiny black box in a larger circuit. Minecraft could do this too. Let's introduce a block called the:

Computer. When you place this block and right-click it, you're sent into a translucent 15x15x15 room which you can decorate as you see fit. You can build sophisticated mechanisms inside the Computer block, but to the outside world it looks like a single-block black box.

The bottom four rows of one wall form the display. By putting Display blocks on this wall, you can achieve the same effect as putting a sign on a block. Only here, the message on the sign can be dynamic. This lets you do display output and keyboard input.

Opposite the display wall is the input wall. If you send an 8-bit redstone signal to the side of the Computer block opposite the display, then inside the Computer, every block on the input wall will go live with that signal. Every other wall of the block is an output wall. An 8-bit signal sent to any block of that wall will leave the Computer and be emitted by the corresponding side of the Computer block. If you send more than one signal to an output wall, they get ANDed.

With Computer blocks you can implement a logic gate, a multiplexer, a demultiplexer, or a register in a single block, without adding any code to Minecraft itself. Of course, you can put one Computer block inside another. Since this will not actually be implemented, let's suppose you can nest Computer blocks to arbitrary depth.

Building a sophisticated system will still be a huge pain if you have to craft every AND gate by hand. So I'll also introduce a new crafting block, the:

Replicator. This device takes raw materials and produces a copy of its input. Non-redstone example: I want to make a torch. I drop an existing torch into the Replicator. It says: "Gimme 1 stick and 1 coal." I drop a stick and a coal into the Replicator, and it spits out a torch. That's stupid, but you get the idea. Now say I spent five hours building and debugging a Computer block that acts as a shift register. I want another shift register. I drop my Computer into the Replicator. It says "Gimme 861 redstone, 201 sticks, 52 wooden planks, 8 stone, 29 cobblestone, etc. etc. etc." I dump all that stuff in and it gives me another shift register.

OK, you get the idea. The next post in this series will take a much different tactic. I'll accept that circuit layout isn't going to get easier, and suggest some blocks that can be used to make fun maps that aren't currently possible.

[Part 2]

Filed under:


Posted by dbt at Sat Nov 19 2011 17:28

I would play with your mod. Hell, now I'm thinking about writing one... :)

[Main] [Edit]

Unless otherwise noted, all content licensed by Leonard Richardson
under a Creative Commons License.