GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - GlaireDaggers/ReliableNetcode.NET: A pure managed C# socket-agnostic reliability layer inspired by reliable.io and yojimbo

BranchesTags
Open more actions menu

Latest commit

 

History

19 Commits
19 Commits

Folders and files

NameName
Last commit message
Last commit date
ReliableNetcode
ReliableNetcode
 
 
UnitTestProject1
UnitTestProject1
 
 
.gitignore
.gitignore
 
 
LICENSE
LICENSE
 
 
README.md
README.md
 
 
ReliableNetcode.NET.sln
ReliableNetcode.NET.sln
 
 

Repository files navigation

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();

About

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

Topics

csharpdotnetgame-developmentgamedevnetcode-ionetworking

Resources

Readme
MIT license
Activity

Stars

152 stars

Watchers

15 watching

Forks

25 forks
Report repository

Releases

Packages

Used by

Contributors

Languages

You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.