Playing with friends over P2P, without port forwarding
No renting a server, no touching the router, nothing to install. One of you opens their world, passes round a link, and the rest join. The game happens between your browsers directly.
How it works under the hood
P2P multiplayer uses WebRTC, the same technology behind video calls in the browser. There is a signalling service whose only job is the introduction: it puts the two browsers in touch and helps them work out a route to talk over. Once the introduction is done it steps aside, and the game data travels directly between you.
That is what makes port forwarding unnecessary. On a traditional server, guests have to reach your machine, which is why the router has to be configured. Here it is the WebRTC negotiation that finds the route, crossing home routers without you having to touch them.
Whoever opens the world is the host: their browser is the one simulating the world and saving it. Guests only see and act on that simulation.
Creating the invite link
Go into your world and, from the pause menu, open the game to your friends. That generates a link pointing at the site with your session's identifier added to the address (you will see something like ?connectPeer=…). That link is the invitation: copy it and send it wherever you like.
Whoever opens it lands straight in your world, with no sign-up and nothing to install. A browser is all they need.
The host cannot close the tab. The world is running there. If the host closes it, reloads, or lets the machine go to sleep, the game ends for everyone.
Friends without accounts
Besides the one-off link there is a deliberately simple friends system: your browser generates a random friend code and stores it on your machine. No sign-up, no email, no password. You give it to whoever you like, they add you with that code, and from then on you can see each other whenever one of you opens a game announced to friends.
When you share, you can choose whether the game is announced publicly, only to your friends, or not announced at all, working solely for whoever has the link. The code is meant to be read aloud or typed: it leaves out characters that get mistaken for one another, like zero and the letter O.
How many people can join
There is no artificial cap. The real limit is the host's machine: it keeps the world running and, on top of that, a separate connection with every guest. The more people, the more work for that machine and the more upload bandwidth it eats.
The practical advice is to start with a small group and work up. If the host starts to stutter, or guests see blocks placed and then undone, you have gone past what that machine or that connection can take. Let whoever has the best PC and the best upload be the host.
If the connection fails
The most common cause is the type of network. On ordinary home networks the two browsers find a direct route without trouble. On mobile networks, university and office networks, though, it is common for the network to block that direct connection; a relay server is then needed to forward the traffic in between. The client tries this automatically, but it is the first thing to break when somebody is behind a restrictive network.
Things to try, in this order:
- Have the guest use another network. Switching from mobile data to home wifi (or the other way round) solves a large share of cases.
- Regenerate the link. Close the shared game, open it again and hand out the new link. Session identifiers do not last forever.
- Turn off VPNs and blockers. A VPN, a corporate proxy or an aggressively filtering extension can stop the negotiation dead.
- Check the guest's browser. It has to be a current browser, and in private mode some configurations block WebRTC.
- Make sure the host is still in. It sounds obvious, but it is the real reason behind a lot of "it won't let me in".
One warning about local testing: if the host is running the site on their own machine, on localhost, the link it generates only works inside their network. To invite somebody from outside, play from the published site.
If what you want is a genuine Java server rather than a game between browsers, there are two routes: joining an existing server or running one on your own PC.