-
Notifications
You must be signed in to change notification settings - Fork 0
Overview
Patchwork is a peer-to-peer implementation of a Minecraft server.
Unlike Minecraft, maps in Patchwork do not occupy the entire 3D space of the explorable world. Instead, maps are necessarily limited in at least one direction. This allows us to combine multiple "maps" together to form a "patchwork". Here is a very simple Patchwork consisting of two square maps:
This separation of maps is what enables us to distribute the load across peers. Each peer owns their own set of Maps, and by combining those maps they control with some that they don't, they form their own Patchwork. This Patchwork is unique to them- each peer could have a different layout of maps. Here's a diagram illustrating this:
In this example Peer A has connected to Peer C. C however, has not connected back to A, so A's map does not appear on their Patchwork. And though they are both connected to D, they do not agree on where D's map is.
From the perspective of the players, as long as both Peers are running the same software, nothing happens. The goal is that moving between the maps is seamless, it should be difficult for the players to even determine where the boundaries are in certain layouts.
From the perspective of the server, it will begin forwarding packets received from the client to that peer and allow the peer to apply its game logic. The goal here is that when standing in a Peer's map, it is as though you logged into their server directly.
- Decouple the people you play with from the save state you use. Normally a server has its own map and if you want to play with the people who use that server you have to join that server and start from scratch. With Patchwork you can bring your map with you wherever you go
- Decentralized Authority. In the world of client-server applications you require a hierarchy of moderators to set rules that determine how the game is played on their server. There can potentially be issues if the users and moderators disagree on how to enforce the rules. With Patchwork each Peer has its own autonomy.
- Freedom from shared physical space. Everybody can be adjacent to whatever they want to be, since the adjacency of your map to other maps has no effect on other peers. You could have hundreds of players all being directly adjacent to the same map.
- Share Map Components. Finite maps can be shared with others, or duplicated multiple times within your own world. For example, you might design some sort of mechanical device on a single small map, then allow other people to download that map and append it to their Patchwork.
- Dynamic Layouts. Over the course of a normal game, players will want access to different kinds of maps. If they need more wood for a construction project, they'll want to be adjacent to a forest. With dynamic layouts they can append a forest to their patchwork, then remove it once they're done.
- Implementing it was a problem that was tricky enough to be engaging while still being very doable
There is no central authority, so I'd argue that it is. The more uniform the distribution of players is across different positions in the XZ (horizontal) plane, the more distributed we get. If all players are within a single map, then its as though they all logged into that single peer and we aren't getting any of the advantages of P2P.
- If you want to try it out for yourself, you can follow the installation guide
- If you're interested in reading more about the implementation, check out player anchoring and the rest of the articles on the sidebar

