The RealTime Servers documentation said
Communication between a Realtime server and connected game clients uses two channels: a TCP connection for reliable delivery and a UDP channel for fast delivery. When creating messages, game clients choose which protocol to use depending on the nature of the message. Message delivery is set to UDP by default. If a UDP channel is not set up or not available, all messages are sent using TCP as a fallback.
It didn’t mention if the UDP is a Reliable UDP implementation or not. If not, is there a plan to introduce a RUDP protocol in the future?
No, RTS doesn’t use Reliable UDP. It uses
dgram provided by NodeJS (UDP/datagram sockets | Node.js v17.0.1 Documentation).
Could you help me understand your use case for this? Do you have any data to show that TCP or UDP are insufficient for what you are trying to do? With these info, I can work with the product team and send in a feature request.
Well, any genre that is latency-sensitive. For example, the real-time strategy genre.
I’m from a Unity background that almost every popular network solutions offer RUDP as the preferred network protocol. I’d like to borrow the concept of Ruffles (a reliable UDP library of Unity):
Reliable : All messages are guaranteed to be delivered, the order is not guaranteed, duplicates are dropped. Uses a fixed sliding window.
ReliableSequenced : All messages are guaranteed to be delivered with the order also being guaranteed, duplicates are dropped. Uses a fixed sliding window.
Unreliable : Delivery is not guaranteed, nor is the order. Duplicates are dropped.
UnreliableSequenced : Delivery is not guaranteed but the order is. Older packets and duplicate packets are dropped.
The most useful one is the first “reliable” type.
The problem is RUDP is just a layer on top of UDP. So there’s no gold standard or dominated cross-platform solution there.
Thanks for the details @favoyang, I’ve created a feature request for this.
Currently we are using DTLS to provide encryption in-flight over UDP. Do you know if RUDP has something similar? Could you recommend some popular RUDP libraries that are tried-and-true? Could you also share examples of your aforementioned network solutions which use RUDP?
Low-level RUDP Libraries
||AES or XOR
Ruffles - GitHub - MidLevel/Ruffles: Lightweight and fully managed reliable UDP library.
LiteNetLib - GitHub - RevenantX/LiteNetLib: Lite reliable UDP library for Mono and .NET
Lidgren.Network (maintain mode) - GitHub - lidgren/lidgren-network-gen3: Lidgren Network Library
Hazel-Networking (fork) - GitHub - willardf/Hazel-Networking: Hazel Networking is a low level networking library for C# providing connection-oriented, message-based communication via RUDP.
ENet - GitHub - lsalzman/enet: ENet reliable UDP networking library
ENet-CSharp - GitHub - nxrighthere/ENet-CSharp: Reliable UDP networking library
High-Level Network Solution that supports RUDP
||via Ignorance (an ENet wrapper)
||adopt from an early version of ENet
Well, asymmetric cryptography is not the focus of these RUDP libraries, very few implemented DTLS.
- ENET is the well-used one but lacks documentation.
- KCP seems promising in the Chinese community.
- Hazel-Networking (fork) is maintained by the author of Among Us (and the game uses it).
Thanks for the detailed list! Those are definitely convincing.
Last question that could help greatly in prioritization, is there any research that shows concrete numbers on how much improvements RUDP brings over UDP and TCP, e.g. in areas like throughput / packet loss rate? (No big deal if you don’t know, we’ll do this research ourselves, but it seems like you are an expert in this so doesn’t hurt to ask )
For cross-platform, since RUDP is just a custom layer on top of UDP, different implementations are not compatible with each other. To get a cross-platform solution you may have to port one implementation to node, vice versa.
- ENET is written in C, so it can be used anywhere with a wrapper layer.
- KCP is also written in C and has both C# port and node wrapper.
- Another idea is to use edge.js to integrate .NET DLL with node, then both server and client can stick with the same managed .NET solution.
Not really an expert, hope this information help.
Actually there is a RUDP lib for Nodejs. Please check out geckos.io:
GitHub - geckosio/geckos.io: 🦎 Real-time client/server communication over UDP using WebRTC and Node.js http://geckos.io
From the Geckosio page:
Version 2 has huge performance improvements. I switched from wrtc to node-datachannel, which is much lighter and faster compared to wrtc.
I think GameLift Realtime Server is looking for a cross-platform solution.