Skip to content

Networking

This section covers Hytale’s networking layer and packet handling system.

The Hytale server uses a sophisticated networking layer based on Netty with support for both QUIC (UDP) and TCP transports. The protocol uses little-endian byte order, Zstd compression for large packets, and variable-length integer encoding.

[4 bytes] Length (little-endian)
[4 bytes] Packet ID (little-endian)
[...] Payload (may be Zstd-compressed)
FeatureDescription
Byte OrderLittle-endian throughout
CompressionZstd for large packets
VarInt7-bit encoding, max 5 bytes
StringsUTF-8 with VarInt length prefix
TransportQUIC (UDP) primary, TCP fallback
Max Payload~1.56GB (0x64000000 bytes)
public interface Packet {
int getId();
void serialize(@Nonnull ByteBuf buffer);
int computeSize();
}
import com.hypixel.hytale.server.core.io.adapter.PacketAdapters;
import com.hypixel.hytale.server.core.io.adapter.PacketFilter;
import com.hypixel.hytale.server.core.io.adapter.PlayerPacketFilter;
// Player-specific filter (only fires for in-game players)
PacketFilter filter = PacketAdapters.registerInbound(
(PlayerPacketFilter) (player, packet) -> {
// Return true to consume/block the packet
return false;
}
);
// Cleanup when done
PacketAdapters.deregisterInbound(filter);