$ show FirstGearGames/FishNet
FishNet is a comprehensive Unity multiplayer networking framework providing a full client-server architecture with RPCs, sync types, prediction, scene management, observer conditions, and multiple transport backends (LiteNetLib, Synapse, Yak). It employs IL code generation via Mono.Cecil to auto-generate serializers and RPC stubs, achieving high performance and low bandwidth usage. The codebase is well-structured with extensive use of partial classes, pools, and utility patterns. It includes demos for authentication, prediction, collider rollback, and scene management. While the framework is tightly coupled to Unity, many utility components (e.g., object pooling, ring buffers, quaternion compression) are reusable in isolation and demonstrate strong engineering craftsmanship. The project is actively maintained with a large community and regular commits.
The LLM identified 2 files worth highlighting for reuse:
Implements a 32-bit quaternion compression algorithm that discards the smallest axis component and packs the remaining three components into a 32-bit integer. This is a non-obvious optimization for network bandwidth, achieving a 75% reduction over a full 128-bit quaternion while maintaining acceptable precision. The compression is completely self-contained (pure math, no framework dependencies), making it directly extractable for any real-time networked application.
A generic, GC-free ring buffer (circular buffer) implementation with a custom enumerator that avoids allocation. It supports insertion, removal, indexing, and clear operations with O(1) amortized performance. The class is generic and decoupled from any FishNet-specific types, making it suitable for any project that needs a fixed-capacity, low-allocation buffer. The custom enumerator pattern is a non-obvious trick to avoid boxing and heap allocations, common in high-performance game code.