Add README.md for each library module documenting API, platform backends, and usage. Add .gitignore for build artifacts. Remove pre-built binaries from version control. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
43 lines
1.3 KiB
Markdown
43 lines
1.3 KiB
Markdown
# ZNet
|
|
|
|
Event-driven UDP networking library for multiplayer games, built on top of
|
|
libsst-net and enet.
|
|
|
|
## Architecture
|
|
|
|
- `ZNetServer` -- listens for connections, manages multiple peers
|
|
- `ZNetClient` -- connects to a single server
|
|
- `ZNetHost` -- shared base class for both
|
|
- `ZNetPeer` -- represents a remote connection
|
|
|
|
## Packet delivery
|
|
|
|
Packets are created with `ZNetHost::CreatePacket()` and sent with either
|
|
reliable or transient (fire-and-forget) delivery:
|
|
|
|
- `ZNET_RELIABLE` -- guaranteed delivery with sequencing and ACK
|
|
- `ZNET_TRANSIENT` -- unreliable, lowest latency
|
|
|
|
Packets larger than MTU are automatically fragmented and reassembled.
|
|
|
|
## Events
|
|
|
|
Poll with `HasEvent()` / `GetNextEvent()`:
|
|
|
|
| Event | Meaning |
|
|
|---|---|
|
|
| `ZNETEVENT_CONNECT` | Peer connected |
|
|
| `ZNETEVENT_DISCONNECT` | Peer disconnected gracefully |
|
|
| `ZNETEVENT_TIMEOUT` | Peer timed out |
|
|
| `ZNETEVENT_DATA` | Data packet received |
|
|
|
|
## Features
|
|
|
|
- Bandwidth throttling (token bucket) via `ZNetBandwidthMeter`
|
|
- Configurable MTU (512 -- 1500 bytes, with IPv4/IPv6 safe defaults)
|
|
- Packet loss simulation for testing (`SetDropChance`)
|
|
- Connection validation callback on server (`ZNetConnectCallback`)
|
|
- Up to 4 listen sockets per server
|
|
- Reference-counted packets
|
|
- `ZNetUtil::ReaderForPacket()` / `WriterForPacket()` for easy serialization
|