Overview
Minecraft Community Edition supports both split-screen local multiplayer and network multiplayer. The game uses a client-server architecture where one instance acts as the authoritative server and others connect as clients.Multiplayer Architecture
Client-Server Model
MinecraftServer.cpp:69 and MultiPlayerLevel.cpp:26
Network Flow
Split-Screen Local Multiplayer
Local Player Management
Up to 4 players can play on the same console:Minecraft.h (referenced in Minecraft.cpp:861)
Adding Local Players
Minecraft.cpp:989
Viewport Assignment
Players are assigned screen regions based on count: 1 Player: Full screenMinecraft.cpp:883-986
Network Multiplayer
Connection Establishment
MinecraftServer.cpp:168
Player Connection Lifecycle
1. Connection RequestPlayer Synchronization
Server Player
The authoritative representation:- Position and rotation
- Health and hunger
- Inventory changes
- Experience
- Effects (potion, fire, drowning)
Client Player
Client-side prediction and rendering:- Input (movement, jumping, crouching)
- Block breaking/placing
- Item usage
- Inventory actions
World Synchronization
Chunk Packets
Chunks are sent as the player moves:- Chunks are zlib compressed
- Reduces network bandwidth by ~80%
- Client decompresses on receive
MultiPlayerLevel.cpp:876
Chunk Unloading
MultiPlayerLevel.cpp:389
Block Updates
Single Block:Block Change Tracking
Client changes are reverted pending server confirmation:MultiPlayerLevel.cpp:16-24 and MultiPlayerLevel.cpp:127-150
Entity Synchronization
Entity Spawning
Movement Packets
Small Movement (relative):Entity Data Updates
- Entity on fire state changes
- Crouching/sprinting changes
- Drowning bubbles change
- Name tag changes (if supported)
Entity Removal
Connection Management
Client Connection
MultiPlayerLevel.cpp:44
Server Connection
MinecraftServer.cpp:168
Pending Connections
Local players connecting to local server:Minecraft.cpp:1049
Packet Processing
Server-Side Handling
Client-Side Handling
MultiPlayerLevel.cpp:118
Disconnect Handling
Disconnect Reasons
Graceful Disconnect
MultiPlayerLevel.cpp:606
Removing Players
Minecraft.cpp:1163
Network Optimization
Slow Queue System
Reduces packet spam for less critical updates:- Entity metadata updates
- Non-critical inventory syncs
- Effect particles
MinecraftServer.cpp:63-65
Packet Batching
Multiple small packets combined:Update Frequency
Different update rates for different data:- Position: Every tick (20 TPS)
- Health: On change only
- Inventory: On change only
- Time: Every 20 ticks (1 second)
- Chunk visibility: On enter/exit range
MinecraftServer.cpp:1477
Related Systems
- Game Loop - Network packets processed every tick
- World Management - Chunk synchronization
- Entity System - Entity network updates
Key Takeaways
- Client-Server Model: One authoritative server, multiple clients
- Split-Screen Support: Up to 4 local players with separate viewports
- Chunk Streaming: Dynamic loading as players explore
- Entity Tracking: Only entities in range are synchronized
- Prediction: Client predicts movement, server corrects
- Compression: Chunk data compressed for bandwidth efficiency