Hacker News new | past | comments | ask | show | jobs | submit login
Minecraft mod that runs RISC-V Linux (curseforge.com)
100 points by ToruiDev on Jan 11, 2022 | hide | past | favorite | 34 comments



In the past, I found incredible to being able to program in Lua in ComputerCraft, controlling not only redstone and moving robots, but also being able to interface with the web and serial ports, but this, this is (or can be) a whole new world inside the Minecraft modding space. Amazing!


Out of curiosity, is this available in multiplayer, and if so, which physical machine is the "host"? Is it the Minecraft server or is VM execution somehow replicated on the clients (first player that enters an unloaded chunk?)?


AFAIK the host in ComputerCraft were the server.

I remember how some people done quarries in the 1.4-1.7 versions of Minecraft (I don't exactly remember which) by simply putting a chunk loader object from other mod and programming the robot to mine it. The robot had a diamond pickaxe and could drop and get items, so when the inventory were full, it could drop all of the objects in a chest or other place.


At least with OpenComputer on 1.7.10 the "vm" runs on the "server" which is either the multiplayer server or the client if in single-player mode.


Kernel and rootfs appear to be built using buildroot https://github.com/fnuecke/buildroot/tree/sedna/board/sedna-...

The github of the mod https://github.com/fnuecke/oc2


I'm so happy to see it! I had much fun with original OpenComputers, back then I used to wonder if ditching custom Lua OS and running micro Linux VMs would be possible. OpenComputers 2 is the answer, and I'm happy to see it's in active development by OpenComputer's author and most active contributor.

It's early in development, but I see in the source code it comes with some basic networking, with IPs, DHCPs and so on. I think it's possible to build real networks inside the game, or will be possible at some point. Can't wait to try it out later. Very exciting!


I'm eagerly waiting for certificate training with minecraft. Might make certificates like LPIC more accessible and ease the initial barrier to entry.


As someone who has never played Minecraft except for creative mode without mods with a 6yo. Could someone explain to me what this mod does and what the concept of Robots is?

Does this enable programmable computers and programmable robots that have their own "agency" to work for you?

And on a related note: Are there other mods related to (learning) programming that can be used by kids (6-8yo)? I'm specifically looking for something to teach my daughter and it would be cool if she could do that inside a game she already knows how to control.


Even without mods, Minecraft supports programming mechanisms (albeit not robots). redstone blocks can be used like logic gates, to construct traps, play music, open doors or build factories. People have implemented ALUs in redstone.


Not just ALUs, but full blown processors with things like branch prediction. The last that got a good deal of attention was Sammyuri's "Chungus 2", from December last year.

It runs at 1 Hz though, about 1000 times slower than an Atari 2600.


1 Hz is unironically an amazing achievement in minecraft. 20 Hz is the theoretical maximum without abusing bugs, and higher values are technically possible through 0-tick pulsing but most likely so utterly devastating to design that you'd have to be the worst kind of masochist to start trying.


Redstone is absolutely miserable to use. Even the simple task of moving signal around is a chore. Even though it can be used to do anything with the magic of NOR gates and Turing completeness, it is an outright hostile environment for learning about programming, logic and electronics.


Somewhat agree, however I think it's because building redstone actually requires some materials science type knowledge. i.e. how different materials and physical structures affect the redstone signal.

Redstone blocks vs redstone torches, and their relative strengths/purposes. Torches on sides of normal blocks with signals entering the side of the block. Using normal blocks to prevent redstone signals from connecting (particularly when going up or down stepped inclines). Space requirements to allow a signal to drive a block and not just terminate the signal next to a block.

These are all game analogues of laying out P and N state semiconductors, or conducting signals from one area of a chip to another and maintaining their signal quality, when designing ICs. Granted, these processes are hugely automated by tooling, but someone has to know, learn and understand how the materials science works in order to develop those tools.

This is why I'm surprised I've not yet seen a VHDL/Verilog compiler for minecraft redstone. Converting a gate array and netlist into a minecraft world feels like a relatively simple challenge for anyone with the knowledge, but I guess it's too niche of a project? Or I'm just not looking hard enough for it.


> This is why I'm surprised I've not yet seen a VHDL/Verilog compiler for minecraft redstone.

https://github.com/itsFrank/MinecraftHDL

https://devpost.com/software/mcverilog


> it is an outright hostile environment for learning about programming, logic and electronics.

Calm down, it's just a building game where it happens that you can learn quite a bit about logic. I'd trying to get my 5 y.o. niece into it, since I find it to be a much better game for children compared to those pointless freemium mobile games.

Minecraft is fantastic for how simple it looks on the surface.


I do not disagree with that at all! I played Minecraft for the first time before it even had multiplayer, and I'm currently running a survival server for my friends. I think it's a great game for people of all ages, I just don't think it's any good as a "programming" game.

I guess my bias is that I played Garry's Mod with the Wiremod addon before Minecraft was even a thing, and it personally taught me a lot more about programming and logic than Minecraft ever could.


Minecraft is all about collecting resources and crafting, both can easily automated with 'robots', there are amazing builds and many fun scripts, up the whole oses (window managers?) built with the lua Variante of this mod.

Years ago when I learned about networking at school, I built a WiFi mesh in Minecraft for example.


OpenComputers has players build one or more machines (either "computers" which can't move, or "robots" which can) and then the conceit is those machines seem to run a primitive DOS^W [Edited: I think it's actually Linux?] with floppy disks (flying robots, but booted from floppy disks, hey it's only a game) and they can run Lua programs you write. This mod (OpenComputers II) is a "spiritual successor" to OpenComputers.

It's full blown Lua, albeit running on the imaginary computer inside Minecraft. You can write complex Lua programs, if you want to and know how, and they can cause say, your robot to fly around building things, or realise its battery is low and it should come back for more juice.

So yes.

[The Minecraft mod community has people come and go, and it's not at all uncommon for the idea behind a mod to long outlive the interest of the first person who implements it, so that both projects pass from one author to another and also new projects come along that do more or less the same thing but are being actively maintained while a previous project became moribund. Minecraft is great but it's not the whole world and people move on. So e.g. the vast number of different items in typical modded worlds are unwieldy with Minecraft's built in systems for crafting etc. but soon somebody invented "Too Many Items" a mod which provides an interactive interface to the list of all items. Successors have included: "Not Enough Items" (very famous) and "Just Enough Items" (popular today and so people just say e.g. "Recipe in JEI" and assume you'll know what they meant). OpenComputers II thus isn't as "inevitable" as something like Python 3 was where the existing maintainers are making another one, but it sounds like for your purposes the fact it's RISC-V isn't crucial so I'd stick with plain OpenComputers at least for now ]

OpenComputers is IMHO as a non-parent somewhat suitable for what you're talking about, but it really depends how much she likes Minecraft. The OpenComputers default is to give you a clunky Nano (I think) editor, if you love Minecraft you'll forgive that because hey it's inside Minecraft. But otherwise even at age six it might already be annoying that this text editor is so primitive, yet six year olds aren't going to have the patience to bootstrap themselves a full-blown Emacs, I don't have patience for that and I'm in my forties. So if that's becoming an obstacle, outweighing the fun of being inside Minecraft, a more conventional beginner's programming environment might be appropriate. (If it's just a minor annoyance it is possible to write code in a "real" editor on the big computer and copy-paste it into OpenComputers but I have not done that)

There are a few other mods that have ideas which are core to computing but don't directly teach programming, in particular Integrated Dynamics has some pretty fancy predicate building that feels to me like it would teach some fundamentals about logic and debugging logical systems (is there a Pig stood on this sensor? Is it a full-grown pig? Are there at least two other pigs in this pen? Then let's pick this pig up and send it to the other pen...), but it's not very near the start of ID's progression, so again if Minecraft isn't a big interest already she's unlikely to see the interesting bits before losing interest.


NEI remains and continues to grow, GTNH has back ported many of the JEI features to 1.7.10.

It is pretty easy to import code into OpenComputer once setup - see NIDAS https://github.com/S4mpsa/NIDAS


It'd be awesome if I could SSH in to the VMs and edit from Emacs on my desktop. I'd also like a pony.


I mean, all of that sounds pretty do-able if you put the work in. Ponies? Not a problem. However in my experience the more sophisticated the animal behaviour in my modded Minecraft the less I like it.

Vanilla Minecraft cows produce milk if you click them with a bucket to put the milk in. Convenient. Some packs though provide real cattle. You need a cow, and a bull, and they need to be together with plenty of good food, and then the cow becomes pregnant. So you wait until she gives birth, steal her calf and now you can get milk. Or, you can decide actually you don't need milk that badly and the cows should get on with their lives unmolested.

I don't entirely sympathise with the people who wrote Better Than Wolves, but, you know, their water powered machinery is probably better than wolves considering the effort that went into each feature...


I can't seem to find any info on how the linux enviroment interfaces with the minecraft world. Is there a minecraft.ko or a minecraftd running inside the vm?


From the documentation:

> Many devices are so-called high level API (HLAPI) devices. This means they are not controlled using regular Linux drives, but via a simple RPC system, employing JSON messages over a serial device.


I've been working on speeding up floating point calculations for the RISC-V emulator used by this mod. The trouble is Java doesn't have full IEEE 754 support, specifically features like rounding rules and exceptions. So to support these in the emulator, floating point calculations are done in software.


With OPenComputer on 1.7.10 we call out to a compiler .so library for the Lua interpreter which I assume could do floating poin correctly.


Ah yes that could work. Was a little weary about packaging native code, but if other mod developers are doing it it might be a good path.

I'm currently working on calling the C fenv API using the new Java Foreign Function & Memory API, all from pure Java.

To be clear, I'm not the dev behind OC2, just messing with it as a hobbie.


I'm frankly a little disappointed that Linux hasn't been ported to redstone yet.


If it can't play doom, it can't run linux.


Is it limited to up to 6 memory-mapped redstone signals? I think it would be cool if we can manipulate a matrix of redstone lamps as a large display.


In the original open computers the limiting factor was the interface between the mod block and the outside world, 6 sides on that block correspond to 6 signals. For a large array as proposed you can network many mod blocks together behind the display, giving you access to many more "sides" to emit signals from.

Whether that's made it into this variant is unclear, I haven't messed around with it. In theory it should be possible though.


Can someone provide a how-to on installing/using curseforge without getting involved with 0verw0lf?


Basic instructions:

1. Download the mod and its dependencies from Curseforge (should be 3 JAR files: oc2[1], sedna[2] and markdown_manual[3])

2. Install MultiMC[4], run it and sign into your Minecraft/Microsoft account

3. Click the Add Instance button in the toolbar and choose Vanilla version 1.18.1, give it a name if you like and click OK

4. Click Edit Instance in the sidebar for the new instance

5. Click Install Forge on the right sidebar and select the latest version

6. Select Loader mods in the left sidebar

7. Click Add on the right and select the three JAR files you downloaded in step 1

8. Click Launch down the bottom

Usually it's simpler to install mods with MultiMC if they're already in a modpack, but these mods don't appear to be in one currently.

[1] https://www.curseforge.com/minecraft/mc-mods/oc2/files

[2] https://www.curseforge.com/minecraft/mc-mods/sedna/files

[3] https://www.curseforge.com/minecraft/mc-mods/markdownmanual/...

[4] https://multimc.org/


These mods are what I always want when I play minecraft.


I have good memories of writing lua scripts for controllers for industrial mods. It feels good to watch the little virtual machine run. Plus if I screw up I don't actually blow anything real up.




Join us for AI Startup School this June 16-17 in San Francisco!

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: