• Stars
    star
    151
  • Rank 244,980 (Top 5 %)
  • Language
    C#
  • License
    MIT License
  • Created about 7 years ago
  • Updated almost 7 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

A pure managed C# socket-agnostic reliability layer inspired by reliable.io and yojimbo

ReliableNetcode.NET

A pure managed C# socket agnostic reliability layer inspired by reliable.io and yojimbo.

ReliableNetcode.NET provides a simple and easy-to-use reliability layer designed for use in games built on unreliable UDP connections. It is a great fit for use with Netcode.IO.NET, my C# port of Glenn Fiedler's secure UDP communication protocol, but it can also be used with any other system you want.

Features

  • Multiple quality-of-service options (reliable, unreliable, and unreliable-ordered) for different use cases in a single API
  • Lightweight packet acking and packet resending
  • Supports messages up to about 16kB large using automatic message fragmentation and reassembly.
  • Simple congestion control changes the packet send rate according to round-trip-time.
  • GC-friendly for maximum performance.

Usage

All of the API is provided under the ReliableNetcode namespace.

Usage is really simple. First, to create a new instance of ReliableEndpoint:

var reliableEndpoint = new ReliableEndpoint();
reliableEndpoint.ReceiveCallback = ( buffer, size ) =>
{
	// this will be called when the endpoint extracts messages from received packets
	// buffer is byte[] and size is number of bytes in the buffer.
	// do not keep a reference to buffer as it will be pooled after this function returns
};
reliableEndpoint.TransmitCallback = ( buffer, size ) =>
{
	// this will be called when a datagram is ready to be sent across the network.
	// buffer is byte[] and size is number of bytes in the buffer
	// do not keep a reference to the buffer as it will be pooled after this function returns
};

To send a message, call ReliableEndpoint.SendMessage:

// Send a message through the qos channel
// messageBytes is a byte array, messageSize is number of bytes in the array, and qos type is either:
// QoSType.Reliable - message is guaranteed to arrive and in order.
// QoSType.Unreliable - message is not guaranteed delivery.
// QoSType.UnreliableOrdered - message is not guaranteed delivery, but received messages will be in order.
reliableEndpoint.SendMessage( messageBytes, messageSize, qosType );

When you receive a datagram from your socket implementation, use ReliableEndpoint.ReceivePacket:

// when you receive a datagram, pass the byte array and the number of bytes to ReceivePacket
// this will extract messages from the datagram and call your custom ReceiveCallback with any received messages.
reliableEndpoint.ReceivePacket( packetBytes, packetSize );

And, finally, make sure you call ReliableEndpoint.Update at regular and frequent intervals to update the internal buffers (you could run it on a separate network thread, from your game loop, or whatever you choose):

// update internal buffers
reliableEndpoint.Update();

More Repositories

1

Netcode.IO.NET

A pure managed C# implementation of the Netcode.IO spec
C#
256
star
2

RetroTVFX

A small collection of shaders for a range of authentic old TV effects (Composite, S-Video, RF, etc)
C#
172
star
3

Unity-Netcode.IO

A lightweight plugin to allow Unity games to use Netcode.IO for secure UDP socket communication.
C#
122
star
4

Pretty-Fast-Video

Designed as successor to Pretty-Good-Video for improved codec structure, API design & performance
Rust
52
star
5

BNA

A minimal game framework inspired by XNA for the Beef programming language
HyPhy
22
star
6

Open-World-Builder

Open source level editor toolkit built on FNA+ImGui.NET
C#
17
star
7

ContentPipe

A simple framework for automating content pipelines for indie games
C#
13
star
8

Effect-Build

A simple commandline frontend for D3DCompile to build FX 2.0 HLSL effect files, designed for FNA-based games
C++
13
star
9

Godot-RetroTV

Authentic TV shaders for Godot with accurate composite video artifacts
GDScript
8
star
10

ResourceCache

A simple resource loading framework for .NET games
C#
8
star
11

Beef-Toml

A simple TOML serializer/deserializer for Beef
HyPhy
7
star
12

Praxis.NET

A C# ECS game engine built on FNA
HTML
7
star
13

com.glairedaggers.sonke

Implementation of Sonic Adventure inspired physics for Unity 2020.3 and above
C#
6
star
14

dreambox-doom

A port of DOOM to the Dreambox fantasy console
C
5
star
15

Pretty-Good-Video

A toy MPEG-like video codec
Rust
4
star
16

CritChanceStudio.Tools

Source code of various CritChanceStudios internal tools (built on FNA & ImGUI)
C#
3
star
17

godot-datatable

Implementation of DataTable-style resources for Godot
GDScript
3
star
18

libpfvdec

A fast & portable C library for decoding PFV video streams
C
3
star
19

ImGuizmo.FNA

A demo project showcasing ImGuizmo integration with FNA
C#
1
star
20

GD-Localization-For-RMMV

Localization plugin for RPG Maker MV
JavaScript
1
star
21

cozi-lang

A work-in-progress hobby language project
C#
1
star
22

PSX-VAG-.NET

Simple minimal lib for encoding & decoding PSX vag/vagi audio
C#
1
star
23

DBSDK-Rust

SDK for writing DreamBox games in Rust
Rust
1
star