Skip to content

RakNet+ is a cross platform, open source, C++ networking engine for game programmers.

License

Notifications You must be signed in to change notification settings

Appsomniacs/RakNetPlus

 
 

Repository files navigation

RakNet+ (kcp+libsodium+ion)

RakNet+ is a heavily improved RakNet fork. The biggest change is replacing RakNet ARQ protocol with KCP [1] as RakNet's Sliding Window has bugs and UDT is mediocre for real time multiplayer games. KCP provides better latency than Sliding Window or UDT by sacrificing some bandwidth [2]. KCP is a really good bet, if you are implementing fast paced multiplayer games. [3]

[1] https://github.com/skywind3000/kcp [2] https://www.improbable.io/blog/kcp-a-new-low-latency-secure-network-stack [3] https://paytonturnage.com/writing/latency-of-reliable-streams/

Key features

  • New ARQ protocol: KCP
  • Encryption using Libsodium
  • Unit tested and fuzzed
  • Various RakNet fixes

Benchmarks

Benchmark code is under benchmark directory. As a RakNet reference, Jul 1, 2021 snapshot of SLikeNet was used, because original RakNet build does not compile out of the box.

Benchmarks have been run using Intel i5-9600k CPU with 32 GB memory and Windows 10/VS2022 17.2.6. For packet loss test cases debug build has been used since in RakNet reference network simulator is available only in debug build. This has insignificant impact on results.

  1. Testing real conditions. Measured client to server messaging with 20ms RTT latency. Reported results are high mean values including standard deviation.
Test case RakNet+ RakNet reference
400B reliable ordered packet - no packet loss 28ms 28ms
400B reliable ordered packet - 1% packet loss 40ms 85ms
400B reliable ordered packet - 5% packet loss 55ms 125ms
  • Better ARQ implementation significantly improves performance on packet loss situations.
  1. Testing ideal conditions. Measured client to server messaging with no latencies to detect protocol overhead. Reported results are low mean values. Command line parameter "--benchmark-samples 2000" was used to run tests.
Test case RakNet+ RakNet reference
400B unrealiable packet 0.2ms 0.3ms
400B reliable ordered packet 0.3ms 0.3ms
1300B reliable packet by 4 clients same PC 0.3ms 0.4ms
1300B unreliable 20 packets burst 0.5ms 1.0ms
1300B reliable 20 packets burst 0.5ms 1.0ms
32KB reliable ordered packet 0.6ms 1.3ms
  • In general, RakNet+ implementation has less than or equal CPU overhead compared to the reference.
  • RakNet reference may be limited by its congestion control.
  • Regarding unreliable performance, please note "Issues and deviations from RakNet" below.
  • Note that most of the measured time these tests spend on waiting for update thread to wake up, the actual processing time is ~10% of measured time. It would be possible to busy loop receiver and sender to relay packets in less than 0.1 milliseconds, but that use case is not in the scope of game networking library - current send delays should be more than adequate for any game.

Issues and deviations from RakNet

  • High level plugins have not been ported.
    • It's probably not worth to port them all, so please let us know if you have a use case for a plugin.
  • Supports only "unreliable" and "reliable ordered" messaging.
    • For reliable unordered data use "reliable ordered" messaging, but send messages in different channels, when they do not have to be in order.
    • "Unreliable with ack" type of messaging should be done by sending acks from application level.
  • Unreliable data is not encrypted and sequenced.
  • DLL support has not been ported
  • NAT punch has not been ported

How to setup

Run cmake from your work directory, e.g. "cmake [RakNet root directory]"

About

RakNet+ is a cross platform, open source, C++ networking engine for game programmers.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C 57.7%
  • C++ 32.7%
  • Makefile 6.7%
  • CMake 1.2%
  • Assembly 0.8%
  • M4 0.4%
  • Other 0.5%