13 ms·
How we built an auto-scalable Minecraft server for 1000+ players
- chews 5y agoThis is nice magical software. Well done.
- Jaxkr 5y agoThank you! It’s very early, but I hope it’ll be useful.
- ZoomerCretin 5y agoI’m curious to know how or if this solved any of the issues inherent with multithreading. Moving the threads to new processes can’t fix race conditions.
- Jaxkr 5y agoIt utilizes a rollback-based system to mitigate races between Minecraft servers. I’m writing up some formal documentation on it now, I really wanted to have that done before this project was exposed to the scrutinizing Hacker News community, but I can’t control what people share! :) Stay tuned.
- winrid 5y agoUsing rollback is surprisingly popular in games. For example, CSGO servers will rollback if a client fires a shot at a player ducking around a corner, and on the shooter's screen the shot lands, but on the other players screen they had dodged the bullet - the server will "rewind" and say the shot hit.
- imtringued 5y agoIt didn't but it's a very beautiful bandaid. So beautiful in fact people might ignore that it is hiding a scar.
- crazy_horse 5y agoHow did MMOs like Asheron's Call and Wow handle this?
- mysterydip 5y agoFor WoW, at a very high level, instancing and sharding. Players are spread across realms. The zones are so large that by nature players will be spread out leading to less interactions. Raids are instanced to just your party. In areas with natural congestion (such as auction houses), things could lag at times. While combat and movement is realtime, it's mostly waiting for timers, so the latency and bandwidth requirements are reduced compared to a first person shooter for example.
- jonathanlydall 5y agoWith WoW they would obviously run each continent as an independent “instance”, but for Wrath, they clearly had multiple servers handling Northrend. There were places where mobs would not path over which was where the two “instances” would overlap. WoW later introduced a kind of dynamic overlay of the same open world area from two realms where it was not very populated in the area so that players would be more likely to actually see other players. There was also a feature where you could party up with a friend on a different realm and you would transparently be playing on their server in the open world (with restrictions like not being able to trade with them). I haven’t played WoW since Mysts, so I don’t know how it’s changed since, but WoW was definitely more complicated than just sharding and instancing.
- mysterydip 5y agoYou're correct, I was referring to vanilla WoW which is all I played. It has definitely evolved since then, thanks for the info!
- tialaramex 5y agoYeah, WoW's combat is effectively just a MUD, to the extent your position matters it's only very approximate even though the animations look much more precise. The Darkmoon rabbit fight made this extremely obvious, because the mob is tiny (it's just a rabbit, it's a reference to The Killer Rabbit of Caerbannog in Monty Python and the Holy Grail) but it's a public fight with potentially dozens of people trying to attack this rabbit at the same time with huge swords and casting spells and stuff, which looks completely ridiculous, but it's a joke so, it's OK that it's silly.
- Jaxkr 5y agoHi, I made this! Was gonna wait until it was downloadable and the documentation was more complete before posting it on HN. Thanks for sharing it though. The Minecraft setup will be available and useable by anyone Wednesday of next week. More documentation and a roadmap will follow shortly after.
- gravypod 5y agoThis is very impressive work! Do you plan to make WorldQL highly available? It seems like if it died you'd loose the server.
- Jaxkr 5y agoThank you for your kind words! WorldQL uses Postgres under-the-hood to store permanent information. I was inspired by companies like TimescaleDB which build new functionality on top of Postgres’s rock-solid base. Any high-availability solution for Postgres will also be available for WQL.
- gravypod 5y agoDo the clients of WorldQL (the workers) know how to gracefully fail over when WorldQL fails?
- Jaxkr 5y agoNo. They fail very ungracefully. But it’s something I’m planning to implement in the future.
- xupybd 5y agoDo you use postgis for spatial queries?
- Jaxkr 5y agoNo. All spatial queries use WorldQL’s in-memory k-d tree implementation and are not used for permanent world alterations. For the Minecraft world catch-up example, it’s as simple as querying Postgres for block records in a certain chunk after a certain timestamp. No fancy spatial stuff happens on the Postgres side.
- saulrh 5y agoIs there any chance of this supporting modded servers? Performance is universally the limiting factor on modded minecraft; if you're not careful you can start having performance problems only thirty hours into a single-player world, and I've never seen a modded server support more than three or four players without severe lag setting in quickly.
- Jaxkr 5y agoI’ve gotten this question a lot. At the moment it’s not a priority because it’s frankly too challenging right now. However, once the documentation is complete, someone could hypothetically implement it using https://github.com/magmafoundation/Magma-1.16.x https://github.com/magmafoundation/Magma-1.16.x
- tialaramex 5y agoI've never ended up playing modded multi-player. I mostly play skyblock type packs, and it doesn't feel like a good match to that experience. It would be cute if Azure credits could be paying for a VM that's just running Compact Machines I never visit the inside of anyway, while the places my character actually goes are running near me. For example, once you've built it, who visits the inside of that first Compact Machine in Claustrophobia that's just a self-powering battery full of uranium, water and thermoelectric generators? You'd drown in there anyway if you visit for more than a few seconds. But it still needs simulating.
- binkHN 5y agoFWIW: WorldQL is free for your first $50k in gross revenue.
- 63 5y agoImpressive work! There's a lot of potential here, but probably within a pretty limited market. Outside of 2b2t and maybe Hypixel, is there really anyone who wants 1000 players on the same world? Is the small market the only reason why a solution like this hasn't been created before, or are there bigger complications that aren't listed or haven't come up yet, or maybe the technology wasn't available? Surely someone like Hausemaster who stands to gain substantial amounts of money from this has looked into it before, right?
- 7373737373 5y ago> is there really anyone who wants 1000 players on the same world Of course! One of the few games that is massively multiplayer all in the same persistent, connected world is Eve Online, and the dynamics that arise from its economy and faction warfare are fascinating!
- JCharante 5y agoalso Planetside 2, think Battlefield (the FPS) but way bigger map (around 8kmx8km I think)
- Atemu12 5y agoPlanetside 2 holds the Guinness world record for the largest online FPS battle with 1158 players: https://www.guinnessworldrecords.com/world-records/101165-most-players-in-an-online-fps-battle https://www.guinnessworldrecords.com/world-records/101165-mo...
- xboxnolifes 5y agoTons and tons of server would love having 1000 people in 1 world. The reason that hub servers generally have multiple servers of the exact same same concept (factions, towny, pixelmon, etc) is in no small part because of limitation in lag due to population. Hell, even using this to support the same (roughly standard) 300 person limited server but not have to disable the more lag inducing problems is a plus.
- jonathanlydall 5y agoInteresting timing. I play with a few friends on a modded 1.7.10 server and we’ve decided to restart with 1.16 due to the lag having become untenable. We run it on an i7 machine at my house dedicated to it, so it’s not a hardware issue. Like clockwork the server would freeze for about 5s about every 30s. Using opus our best guess is that it’s unloading chunks and the GC is happening. We’re going to run 1.16 now which I hope has some performance enhancements and so that we can use more modern Java 16 runtime with its nicer GC systems. I’m also hoping that Minecraft has at least since moved chunk generation off the main thread since there was no good reason for world exploration slowing down things like it did. I also built a JavaScript redstone simulator website and I’m curious how you will handle that and other block updates at server boundaries.
- lostlogin 5y agoI run it on a headless Ghost Canyon Nuc with a Xeon and plenty of ram. There are only 2 of us and if one of us types a message you know it’s about to come in as the game lags so hard. There is something not quite right. 1.7.10
- mintplant 5y agoJust to clarify, WorldQL is hosted-only software, right? No on-premise? If I tie my game to WorldQL, do I have any options if WorldQL goes under (other than re-engineering everything)? Not to diminish the impressive work on display here - I've just been wondering this since I saw your r/gamedev post.
- Jaxkr 5y agoIt’ll be self-hostable too. I need to be clear about that on the homepage. Thanks for your question.
- denvaar 5y agoLove the font on this site. Looks like you can find it here: https://brailleinstitute.org/freefont https://brailleinstitute.org/freefont
- ninjin 5y agoIndeed, it sadly looks like it comes with some custom non-commercial license though [1], rather than something more standard like the SIL Open Font License [2]. Feels like an odd choice for a non-profit entity, but non-commercial clauses tend to creep in with good, idealistic intentions as it can be difficult for those new to open/free culture to realise how hairy and counterproductive they can be in the end. [1]: https://www.brailleinstitute.org/wp-content/uploads/2020/11/Atkinson-Hyperlegible-Font-License-2020-1104.pdf https://www.brailleinstitute.org/wp-content/uploads/2020/11/... [2]: https://en.wikipedia.org/wiki/SIL_Open_Font_License https://en.wikipedia.org/wiki/SIL_Open_Font_License
- Jaxkr 5y agoI don’t know if this is correct. I’m getting Atkinson Hyperlegible from Google Fonts and it seems to allow commercial use: https://github.com/googlefonts/atkinson-hyperlegible/blob/main/OFL.txt https://github.com/googlefonts/atkinson-hyperlegible/blob/ma...
- ninjin 5y agoI think you are correct. What probably happened is that I read the license wrongly when it started talking about “sales” (FSF apparently has a note related to this “oddity” [1]). Having a second look at it, I now think it looks a lot like the SIL Open Font License. Thank you, I stand corrected. [1]: https://www.gnu.org/licenses/license-list.html#Fonts https://www.gnu.org/licenses/license-list.html#Fonts
- blackcat333 5y agoamazing work. i have been designing my own back end for an mmo in my free time off work. this will help me alot. much thanks for this.
- deleted 5y ago[deleted]
- longcommonname 5y agoThere are very few servers that would really benefit from this. But perhaps the reason is that it's incredibly difficult to form large communities in minecraft. I could see this really changing how users interact with each other.
- lostlogin 5y agoPerhaps, but the comments here suggest a lot of players would love to try it.
- tdeck 5y agoI'm always amazed by how so much Minecraft innovation is driven entirely by hobbyists. For years Minecraft was unplayable on many machines without the Optifine plugin. Even with a huge corporation behind it, Microsoft didn't build the capacity for large-scale servers, and the very large paid servers seem to use region based sharding with portals. This project is truly exciting.
- c7DJTLrn 5y agoI liked to hack around with Minecraft in the past but I'd always end up in despair at the state of the game from a technical POV. The Java version of the game is just horribly slow and unoptimised. The game doesn't even have a real modding API, it's all reverse engineered. Seeing chunks pop in really takes away from the experience. The C++ version ("Bedrock") performs much better but is not compatible with the Java edition, doesn't have the same player count, isn't moddable, and is heavily Xbox-inated and Microsoft-ened.
- bobsmooth 5y agoLike all good things it started small and has had decades of building atop old code.
- Natfan 5y agoMinecraft servers aren't really great at region-based sharding. Mojang have not yet added a "transfer packet"[0] which would allow for region-based switching. For the most part, one would need to re-join the server under a different proxy pool located in their desired region, usually accessible via a subdomain (us.example.com, eu.example.com) [0]: https://hypixel.net/threads/why-do-we-need-transfer-packets.1390307 https://hypixel.net/threads/why-do-we-need-transfer-packets....
- kaolabear 5y agoI had the impression that most of the server's cpu time is used for simulating the game's content, not the players themselves. Most of the available cpu time is usually spent on monster AI and monster physics. I assume that WorldQL is also used to store monsters besides the blocks, otherwise my understanding is that players cannot interact with monsters from other servers. Is it possible to create redstone circuits on different servers that then interact with each other?
- L3viathan 5y agoNear the end of the article: > We're planning to introduce redstone, hostile mob, and weapon support ASAP.
- xupybd 5y agoHow many hours have gone into this? Was this all on top of a 9 to 5?
- LennyWhiteJr 5y agoI used to play on a pretty popular MMO-style server called [CivCraft](https://www.reddit.com/r/Civcraft/ https://www.reddit.com/r/Civcraft/) that unfortunately became a victim of its own success due to the large player count. It would often have 250+ players who would build these massive redstone machines and the server TPS would grind to a halt making it unplayable. After a few years it attempted a re-launch using an approach similar to to the first one mentioned in the article. There were multiple worlds and as you approached the border of one world it would teleport you to another adjacent world. It was cool, but was jarring and suffered from its own complexity issues. Anyway, this project is super cool. I would have loved to see something like it 10 years ago.
- the_gipsy 5y agoAh yes I immediately thought of civcraft too. > a victim of its own success due to the large player count. It would often have 250+ players who would build these massive redstone machines I always thought the redstone restrictions resulted in too many bots.
- ianhawes 5y agoFWIW the sharding at worldborder approach is still the preferred way to shard in CivCraft-inspired servers. IIRC the CivCraft 3 sharding happened in the middle of a continent, so you could feasibly be chasing someone and both would be switched to a separate world mid-chase.
- imtringued 5y agoThere is a dedicated game like that: https://play.eco/ https://play.eco/
- andrewzah 5y agoReally excellent work. Is this going to be open-sourced at some point?
- lwansbrough 5y agoHmm, I still think spatially allocated servers offer the best scalability. You would just have to approach it a little differently. Server boundaries could move based on where the population is via delaunay triangulation (instead of fixed boundaries), and servers could share high-importance information with their immediate bordering neighbours. (This would be recognized as ghost data on the neighbouring servers.) You could even go further and have neighbours share ghost data with their other neighbours at a lower fidelity/frequency. A virtual distributed actor system could potentially be used to address any potential downtime or resource waste created by unpopulated zones. I've been playing around with some of these ideas but haven't been able to turn them into an actual implementation, so kudos to you for actually doing it!
- Jaxkr 5y agoThanks for your comment. Spatially allocated servers was my original implementation! There’s a link to a video demo in the blog post. You are definitely correct that spatial sharding is easier and more robust. This new approach was primarily made because I thought it would be fun and cool :P
- mbo 5y agoThis appears to be spatially allocated system that an acquaintance of mine worked on https://github.com/PureGero/MultiPaper https://github.com/PureGero/MultiPaper
- bobsmooth 5y agoThat's really freakin' neat. Something MC players have been dreaming about forever. I hope you're successful and every server starts using it!
- z3t4 5y agoBeing able to serve 1000+ players in a spatial "MMO" game is like the holy grail of netcode programming... > Here's a demonstration showcasing 1000 cross-server players, this simulation is functionally identical to real player load. The server TPS never dips below 20 (perfect) and I'm running the whole thing on my laptop. If it can run on one laptop, why does it need horizontal server scaling? :P You don't really know where the bottle-necks are until you put 1000 actual players on the same "server".
- zachrip 5y agoThe laptop can run multiple copies of a single threaded program (and spread those on diff cores)
- Jaxkr 5y agoThanks for your comment! That demo is primarily meant to demonstrate the efficiency of the message broker and packet code as if there were 1000 players on different MC servers all forwarding their positions through WorldQL. I’ll make it more clear.
- Jweb_Guru 5y agoI would be a bit cautious about inferring server tick rates from the performance on one machine unless you are mostly planning to scale to lots of cores rather than lots of servers, since dealing with access latency can otherwise kill many promising attempts at parallelization even when the contention itself is no big deal. It's likely you are already aware of this and have designed the benchmark to compensate, of course :)
- paraph1n 5y ago> Being able to serve 1000+ players in a spatial "MMO" game is like the holy grail of netcode programming... What do you mean by holy grail? Is it not something that's already accomplished by several games/MMOs? Unless "spatial MMO" means something specific here.
- z3t4 5y ago
- TheFreim 5y agoI've been running and doing minor plugin work on minecraft servers for years, getting close to a decade, and I've wanted this for so long. This would be a game changer for some modes I play.
- jayd16 5y agoInteresting but this is kind of a big caveat. >redstone, hostile mob, and weapon support Aren't these the slow things? Is it just player position and map data that's synced through a central DB? I would assume the bulk of the work isn't done yet.
- the_gipsy 5y agoYes but crossing servers seamlessly is a huge step forwards.
- stjo 5y agoA couple of weeks ago I made https://playmcnow.com https://playmcnow.com with the opposite idea - have many super lightweight servers for small groups of players. Instead of saying to friends “register to digital ocean, pay $5 and get a Minecraft box”, I can host thousands of worlds for them. I made a custom minecraft proxy (similar to bungeecord but A LOT less resource intensive) that starts the real server when someone attempts to connect to it. 200 lines of go for the proxy and about as much for the http front end in django :).
- c-fe 5y agoThis looks very nice, would have loved this back when I played more MC with friends. I havent tried it since I am not on my gaming computer, but how would this work in practice? Will I have access to the server to e.g. download the world I'm playing on as a backup?
- stjo 5y agoI haven’t gotten around to implementing such functionality. Although I wish I could monetise it, right now it’s just a hobby project and don’t put much work into it.
- ianhawes 5y agoYou should honestly look to monetize this. The MC server community is constantly plagued with hosts that will cram as many servers onto a box as possible, but they insist on the “always on” approach which IMO is pointless. Someone did an automated survey a year ago of all public Minecraft servers and found the number of servers exceeded the number of players.
- tekknik 5y agoHow is this different than realms? I think realms is even cheaper in some cases. https://www.minecraft.net/en-us/realms-for-java https://www.minecraft.net/en-us/realms-for-java
- Kinrany 5y agoWonder if it can be pushed further: have more servers than players, with different mods but with the ability to move items (and players) between servers as long as they're compatible.
- ThatPlayer 5y agoI wonder how well this would run on a Raspberry Pi 4 cluster.
- funshed 5y agoGetting the two players in different servers to sync and see each other seems a headache. Instead can you not dynamicly change the border(s) think Gerrymandering.