Multi-Threading in Minecraft with Folia

In today’s blog post, we will write about something that’s a bit more technical than usual. Specifically, we will take a look at the new fork of Paper called Folia, which is designed to address the bottleneck of Minecraft servers running on a single thread.

Minecraft is famously a single-threaded game and has been since its first release. So, with Folia being able to run multithreaded, it could very well be the future of Minecraft servers. Running a game on multiple threads would allow for a more efficient game with greater performance.

There have been previous attempts to break Minecraft into separate threads, but none of them have been implemented successfully. So, let’s hope that the developers over at PaperMC manage to make something out of Folia.

What is Folia?

Folia is a fork of the very popular Paper, which is a fork of Spigot, which is a fork of Bukkit. It is developed by PaperMC and will allow dedicated Minecraft servers to utilize multithreading to address the constant bottleneck of Minecraft servers running on a single thread.

Folia is a complete overhaul of Minecraft’s core game loop. By building the core game loop from scratch, they have managed to implement multithreading and regionalized ticking. This results in a huge boost of performance for Minecraft servers with a lot of players, such as Skyblock or SMP.

It is worth noting that Folia still is very much in development and any usage should be considered to be experimental. This means some builds may be unstable and cause issues with your server. Should you be interested in the development, you can find more information on their GitHub.

Benefits of Folia

As we mentioned in the beginning, there have been many failed attempts at introducing multithreading to Minecraft, all of which have been plagued with bugs and game-breaking behavioral changes. In contrast, Folia is built on a strong foundation by experienced developers.

Multithreading

Ticking of chunk region in parallel

Much faster chunk loading

Many forks of Paper have attempted to optimize server performance further, but with limited success due to the main tick loop still running on a single thread. To overcome this, Folia has made some drastic changes to the main tick loop.

This could not have been done by simply creating a fork of Paper and building on top of that version of Minecraft. A complete overhaul was needed, and that is precisely what has been done with Folia.

How Does it Work?

Folia is specifically designed to enable multithreading in dedicated Minecraft servers. Developed with the goal of improving server performance and reducing lag, Folia works by distributing the processing load across multiple threads, allowing tasks to be executed simultaneously.

Comparing this to how Minecraft has been, and still is, running on a single thread, the performance boost with Folia is significant. For example, with tasks being executed simultaneously, you could have multiple players spread out all over the map without any noticeable loss of performance.

By breaking up sections of chunks into regions that can be ticked independently, Folia enhances the responsiveness and fluidity of gameplay. To summarize, Folia is a very optimized version of Minecraft that allows game processing tasks to be divided among multiple threads.

Who’s it For?

Those who would benefit the most from using Folia are those with large dedicated Minecraft servers. Especially if the number of players is in the hundreds, multithreading could allow for even more players to join the server.

Game modes such as SMP and Skyblock, where players are spread out all over the map, would definitely benefit from using Folia as it could fully utilize the regionizer and provide additional performance boosts that weren’t achievable on Paper.

Conclusion

So, could Folia be the future of scalability for Minecraft? Well, they sure have come a lot further with the development than any of the other attempts at bringing multithreading to Minecraft. But unfortunately, there’s still a lot that needs to be done before Folia is ready for the masses.

However, we are very impressed by what the modding community continues to develop and create for Minecraft. There seems to be no end to the creativity and skill, and it shows in projects like Folia. Okay, that’s all for this blog post. See you in the next one!


Posted

in

by