If you haven’t heard of Minecraft, well, we hope you enjoyed your rip-van-winkle nap this past decade or so. For everyone else, you probably at least know that this is a multiplayer, open world game, you may have heard that running a Minecraft server is a good job for maxing out a spare a Raspberry Pi. Which is why we’re hugely impressed that [PortalRunner] managed to squeeze an open world onto an ESP32-C3.
Of course, the trick here is that the MCU isn’t actually running the game — it’s running bareiron
, [PortalRunner]’s own C-based Minecraft server implementation. Rewriting the server code in C allows it to be optimized for the ESP32’s hardware, but it also let [PortalRunner] strip his server down to the bare essentials, and tweak everything for performance. For example, instead of the multiple octaves of Perlin noise for terrain generation, with every chunk going into RAM, he’s using the x
and z
of the corners as seeds for the psudorandom rand()
function, and interpolating between them. Instead of caves being generated by a separate algorithm, and stored in memory, in bareiron
the underground is just a mirror-image of the world above. Biomes are just tiled, and sit separately from one another.
So yes, what you get from bareiron
is simpler than a traditional Minecraft world — items are simplified, crafting is simplified, everything is simplified, but it’s also running on an ESP32, so you’ve got to give it a pass. With 200 ms to load each chunk, it’s playable, but the World’s Smallest Minecraft Server is a bit like a dancing bear: it’s not about how well it dances, but that it dances at all.
This isn’t the first time we’ve seen Minecraft’s server code re-written: some masochist did it in COBOL, but at least that ran on an actual computer, not a microcontroller. Speaking of low performance, you can’t play Minecraft on an SNES, but you can hide the game inside a cartridge, which is almost as good.
Thanks to [CodeAsm] for the tip. Please refer any other dancing bears spotted in the wild to our tips line.
My respect and my condolences
Someone was also written a minecraft server in bash: https://sdomi.pl/weblog/15-witchcraft-minecraft-server-in-bash/
There have been quite a few. I was thinking specifically about one on an 8-bit AVR, but it only ran a very simple world. Yet it allowed him to do crazy things like toggling real world output from the game. Funnily, his later iteration from ’14 is also called ‘World’s Smallest Minecraft Server’.
https://hackaday.com/2012/11/16/avr-minecraft-server-lets-you-toggle-pins-from-the-virtual-world/
I like how other people solve it in different ways. Where this ESP32 version hosts a playable game, as where the AVR has more of a proof of concept feel.
Ok, because-we-can. But in real-world it’s enought to use esp-32 as signalling server for werbrtc.
Ehm…
https://www.youtube.com/watch?v=YNrFOClrzTA
that was a demostration on a limited world, that detected levers flipped for a LED strip, while yes thats the “smallest” server but this does alot more and is playable
Seems the anti-spam system didn’t really like my link to CNLohr’s 10 year old video on running a Minecraft server an an AVR. Search for “CNLohr World’s Smallest Minecraft Server” to check it out!
First-time posters get quarantined, and it’s the weekend. :) Sorry for the wait.
Sensible policy, but would be even more sensible if I was made aware of this when i posted :-)
Man this is fun. I didn’t know there were so many Minecraft-compatible servers. I want this micro server for a digital pet.
And it’s x86_64 compatible? AND a Cosmopolitan binary that can run on all systems? This is checking so many boxes …