Renet
Renet is a network library for Server/Client games written in rust. Built on top of UDP, it is focused on fast-paced games such as FPS, and competitive games that need authentication. Provides the following features:
- Client/Server connection management
- Authentication and encryption, checkout renetcode
- Multiple types of channels:
- Reliable: garantee delivery of all messages
- Unreliable: messages that don't require any garantee of delivery or ordering
- Chunk Reliable: slice big messages to be sent in multiple frames (e.g. level initialization)
- Packet fragmention and reassembly
Sections:
Usage
Renet aims to have a simple API that is easy to integrate with any code base. Pool for new messages at the start of a frame with update
, messages sent during a frame - or that need to be resent - are aggregated and sent together with sent_packets
.
Server
let delta_time = from_millis;
let mut server = new;
let channel_id = 0;
// Your gameplay loop
loop
Client
let delta_time = from_millis;
let mut client = new;
let channel_id = 0;
// Your gameplay loop
loop
Demos
You can checkout the echo example for a simple usage of the library. Or you can look into the two demos that have more complex uses of renet:
Plugins
Checkout bevy_renet if you want to use renet as a plugin with the Bevy engine.
Visualizer
Checkout renet_visualizer for a egui plugin to plot metrics data from renet clients and servers: