Minecraft servers are famously single-threaded and those who host servers for large player bases often pay handsomely for a server that has gobs of memory and ripping fast single-core performance. Previous attempts to break Minecraft into separate threads haven’t ended successfully, but it seems like the folks over at [PaperMC] have finally cracked it with Folia.
Minecraft is one of (if not the most) hacked and modded games in history. Mods have been around since the early days, made possible by a dedicated group who painstakingly decompiled the Java bytecode and reverse-engineered it. Bukkit was a server mod back in the Alpha days that tried to support plugins and extend the default Minecraft. From Bukkit, Spitgot was forked. From Spitgot, Paper was forked, which focused on performance and gameplay mechanics. And now from Paper, Folia is a new fork focused on multi-threading.
A Minecraft world is split up into worlds (such as the nether or the overworld) and chunks. Chunks are 16x16xZ vertical columns of blocks. Folia breaks up sections of chunks into regions that can be ticked independently. Of course, moving to a multi-threaded model will cause existing plugins to fail. Very little was made thread-safe and the idea is that data cannot move easily across ticking regions. Regions tick in parallel, not synchronously.
Naturally, the people benefiting from Folia the most are those running servers that support hundreds of players. On a server with a vanilla-like configuration only around a hundred or so players can be online. Increasing single-core performance isn’t usually an option past this point. By moving to other cores, suddenly you can scale out significantly without restoring to complex proxying. Previous attempts have had multiple Minecraft servers and then synced players and entities between them. Of course, this can cause its own share of issues.
It’s simply incredible to us what the modding community continues to develop and create. It takes deep patience to reverse-engineer the system and rearchitect it from the outside. The Folia codebase is available on GitHub under a GNU GPL 3.0 license if you’d like to look through it.
oh hell yeah that sounds wonderful for getting MC servers more populated! at least, the fact that someone’s working on this, sure, the plugins need to be adjusted and such, but it’s still an important direction to hack into
can’t deny, the Minecraft hacking scene is fascinating, feels like there can never be enough HaD articles about it
“640K ought to be enough for anybody”
bill gates used the same constrained mentality for anything he touched.
microsoft entire offering is nothing more than disjointed code stuck together with greed.
I’m no Microsoft fanboy, but you really can’t lay this one at Microsoft’s feet.
Minecraft was around for several years before Microsoft bought it.
It started in 2009 and was released in 2011. Microsoft bought it in 2014.
Its single-threading existence started all the way back at the beginning, before Microsoft ever got hold of it.
https://en.wikipedia.org/wiki/Minecraft
If yer gonna bash Microsoft, at least make sure you’ve got the right hammer in hand.
So you say they bought the code 8 years ago and only now they have fixed it. It didn’t take 8 years for them to write a whole operating system from scratch. Just think they could have rewritten Minecraft from scratch as a modern piece of software but no, they bolted on a multithreaded hack and it took them 8 years to do it.
Microsoft hasn’t “fixed” it. The article is about a group of hackers who have made a modded Minecraft server. The Minecraft server that Microsoft delivers is still single threaded.
It’s also worth noting that it’s not like this server is suddenly infinitely scalable or anything either: it’s geographically multithreaded, but individual regions are still single-threaded, so I’m guessing an overly-complex single region can still blow things up (which I think they show as an example on that page).
So it’s not exactly like it’s an automatic win over the single-threaded server in all use cases.
So you are telling me that Microsoft has invested absolutely zero R&D into their Minecraft purchase and are just milking profits? OK this sounds just like the Microsoft that has been pushing one new UI after another on the same old same old Windows kernel for decades now. Their customers are surely suckers.
That’s not what anyone, including the article, said at all.
X is notorious for this sort of thing, best not to feed them.
Yeah I was being too nice to Microsoft, giving them credit when none was due. Shame on me.
Oh, come on. Don’t tell me you think they make every new version of Windows from scratch too! There are dialogue boxes in Windows 11 that haven’t been touched since XP. They’re not exactly bursting with spare time.
Microsoft has famously been extremely hand-off with the development of Minecraft Java Edition, and even if they weren’t, they’ve got more important things to worry about than the performance of a videogame that 12 year olds play. The fact that Minecraft is single threaded sucks but is pretty much solely Mojang’s fault.
The age rage on the server I owned back in the early days of Beta (and was, at the time, the largest in the country), the age span of our players was 13-68. Gaming is not just “for little kids” and I can assure you, people of all ages play Minecraft.
And don’t lay it on Java either. It has had non blocking multithreaded io for years.
That he said that has been repeatedly dismissed by himself as well as those around him at the time. Anything he may have said was most likely describing the current platform.
Nobody at the time would have believed that any amount of memory would have been “enough” given the chance to get more.
bill gates never said that
That quote was taken out of context, and is not what folks claim it was.
On the other hand, Gates and Mickey$loth do have a long history of “we know what you want better than you do despite how often you tell us we’re wrong”.
Hmm ticks across chunks or these regions not being equal could really mess with the redstone game mechanics, but as long as you can seamlessly hand players off from core to core, load stuff at the region boundaries without major glitching (like pigs walking between the region and not turning up for a noticeably number of ticks) and the region boundaries are marked so you can avoid building over them with anything really tick sensitive then this could be huge for those that still play MC. Running a MC server (especially modded) for even a relatively small number of synchronous players has often had performance troubles.
Yeah I think their use case is more of a traditional, players are spread out over a larger area without too many players in one spot (survival, anarchy, skyblocks, etc). I think if redstone events are happening over a large area, the region would grow to encompass the whole redstone creation.
Yup, if you read the Regioniser logic documentation, it basically only separates regions if there’s a large unowned area around it. You could definitely have a case where it essentially becomes identical to the single-threaded case because all activity is confined (or there are no areas of inactivity).
Tbh one core could handle a large number of chunks. A better model would be to isolate groups of players in groups of chunks with boundaries between them.
Though the more interesting scenario is the typical mmo one, ie GW2 when they announced living world and did the big Karka attack…literally everyone in the game going to the same small island and performance/everything went to shit.
I imagine the same problem exists here, minecraft has quite a log of vertical space, so what if every player on a large server enters the same chunk. Unfortunately minecraft can’t really be instanced.
How many chunks a core can handle is going to be so wildly varied by what is happening in those chunks, and on how much ram/cache it has access to for keeping it all ‘loaded’.
As bringing MMO player counts into one chunk would be nearly impossible in MC without admin cheats I really don’t see that being a sane failure mode to worry about – the scope of the world and basis of the gameplay means MC in general would be self load balancing in that sense. Even if every player on a server was asked to try to get to co-ordinate x,y,z it would take them ages and many would end up respawning far far away many many times before the crowd really gathers…
Plus it would probably kill the players PC faster than the server too – all those entities to render in one space would I think make the client chug before the server notices, certainly something I’ve seen in the past testing with heaps of summoned pig etc. But that was long long ago and on Bukkit servers I was running, not kept up with how the client or server performance have changed in years now.
“A better model would be to isolate groups of players in groups of chunks with boundaries between them.”
That’s what they’re doing. You might be being confused by the article’s wording (I was at first) where it says “Folia breaks up sections of chunks into regions that can be ticked independently” – that should be worded “Folia *groups* chunks into regions that can be ticked independently.” There’s a “merge radius” around each region that prevents a region from staying isolated when another region grows too close to it.
I can’t help but wonder what happens if people don’t spread out across all these regions that are multi-threaded. On most servers I’ve been on people clumped together around spawn for the most part, within walking distance of it.
I’ve never seen more than a few players clustered together at a time – even if they all use the same shared base many are always off exploring, mining, etc.
Also not sure it will be an issue anyway – as long as you and mobs can cross these region boundaries smoothly and quickly. With that rapid transfer you can just make these regions smaller and have as many as you need to cope with the CPU load on each chunk.
I’d rather you support and promote the FOSS alternative MineTest, which all the cool kids play, and write mods for.
As someone who’s been playing Minecraft (on and off) for several years, MineTest just feels too uncanny valley for my tastes. It’s close to feeling like Minecraft, but that just makes the differences stand out and annoy even more. Also, last I checked (within the last 12 months) it was hard/impossible to use Minecraft’s textures and didn’t have a lot of the features of the last several updates. All in all, it’s a lesser experience, if you’re coming to it from Minecraft. (If I were starting fresh and never played Minecraft before, it could be an interesting place to start, though.)
Also, the HaD post points out just some of the many many ways Minecraft has been hacked (aka modded), including the multi-thread server focus of the article, so it seems like a perfect topic for HaD to cover.
sure did love using spitgot
Slight correction there: Before there was Bukkit, there was hMod, the original server wrapper for Minecraft’s early multiplayer in the Alpha days. I know, because I used to run a server for some of my friends and myself. Didn’t have any plugins that I can think of, just barebones hosting a world and letting players connect. No /spawn, no warps, no protections, nothing. And every time you died, you respawned at a random location.
That’s why we always created a town called Nullington at 0,0 on every world we started.
It had to offer some benefits, right? Otherwise why even use it instead of just the plain server?
I don’t think there was a plain server available from Mojang at the time yet.
hMod’s purpose was to provide a plugin API; I think demon256 is just remembering such early days that little of note had been developed against said API so far.
There were basically no plugins that we knew of at the time, and hMod itself was in very early stages of development. :)
Minestom is a multi-threaded server platform that has been around for years now.