Test build with an attempt to fix the lag

It looks like the lag was caused by my careless use of a feature in the Lidgren network library which allows sending messages through UDP reliably (= so that they’re resent if the recipient doesn’t acknowledge receiving them). In some cases that lead to severe congestion problems, causing enormous lag not just in the chat but all the reliable messages that the game sends. Rewiring devices, picking up or dropping items and attaching/detaching items were all synced using reliable messages, and there were definitely problems with all of those even though the chat lag was the most obvious effect.

I think I’ve managed to fix the problem though: the reliable messages are now sent using a homebrew packet loss detection system which allows me to slow down or cancel the resending process entirely if it seems like the line is choking (once again thanks to Glenn Fiedler his excellent articles which have helped me quite a few times during the development of Barotrauma).

However, I haven’t yet been able to test and verify that the fix is 100% working, because I still haven’t managed to reproduce the issue when playing the game on my computer. I did host a few “real” online rounds with 4-5 players and everything was working great, but it’s still possible that the problem re-emerges when there are more players. So, I decided to upload the current build so that I can use you guys as free testers in case you want to try a version that probably works much better than v0.2.2 while I try to get rid of any bugs in the new netcode and verify that it’s actually working.
tl;dr: Chat lag and a bunch of other networking issues probably fixed, try at your own risk by downloading the latest build here:

barotrauma_testbuild_3.rar

EDIT: The fix is now implemented in the latest version, v0.2.3.1

There’s also a bunch of other small additions and fixes in the build (such as being able to ban players and hit people in the face with a wrench).

 

 

Comments

  • October 23, 2015
    reply
    Zach

    Just tested this build out with a couple of friends. Noticeably better network performance!

  • October 23, 2015
    reply
    Nezok Tivek

    I can hit people in face with wrench? This is just what I wanted for christmas.

  • October 23, 2015
    reply

    I was curious about the networking performance, so I wrote a small program that relays all network messages that the game sends and receives when it’s connected to a server so I can generate some info about the connection. Counting the amount of packets being sent per second while a round is ongoing results in a number between 30-50 packets per second, both sent by the client and by the server. That adds up to around 80 packets per second. This seems a bit excessive, especially for a trusted-client networking model. Caching up a few actions and sending at a lower rate (10 packets per second would probably be good enough) could help prevent network congestion.

      • October 23, 2015
        reply

        Fewer large packets (not more than 1500 bytes) are probably better than many small ones because routers like buffering packets to make sure they go somewhere, so they could be wasting resources by having too many packets.

  • October 28, 2015
    reply
    Leudoberct

    Getting an error when trying to download an update in the launcher, it won’t let me copy and paste the message but this is the general gist:

    Error while downloading: System.Net.WebException: The remote server returned an error (404 not found)

Post a Comment