Lossy Network Improvements (Multiplayer)

Post your ideas and suggestions how to improve the game.

Moderator: ickputzdirwech

Post Reply
Vxsote
Inserter
Inserter
Posts: 36
Joined: Sat Oct 01, 2016 12:51 am
Contact:

Lossy Network Improvements (Multiplayer)

Post by Vxsote »

TL;DR
Implement forward error correction (FEC) for lossy network connections to improve multiplayer experience.

What ?
While a small amount of latency is inevitable for games played over the internet, and Factorio generally does a good job in dealing with that, I've played some games with a friend who was having some dropped packet issues with his internet connection, and the result was basically unplayable. At the same time, we were able to maintain a normal voice conversation (another use that is sensitive to loss and latency) via Discord, so the connection was not so horrible as to be unusable.

I've tossed the idea for fixing this around in my mind for a while, but the recent release notes regarding latency improvements made me think it was time to finally offer a suggestion.

If the connection between multiplayer client and server was protected by FEC, this would eliminate disruption from dropped packets that cause correctable errors. The level of redundancy used in the FEC determines how many missed packets can be "corrected". Applying FEC over a longer window of packets can allow correction of larger burst of dropped packets at once.

Obviously this would come at a cost of bandwidth and latency. There is already intelligence built into the multiplayer code to try to stabilize at an appropriate amount of latency, so perhaps that is a good opportunity to dynamically tune the FEC in use. The amount of FEC in use could potentially be zero when there is no loss.

There is a project available on GitHub that is intended to implement FEC on a UDP connection to accomplish exactly what I'm describing here. I have not tried to use this project, but it seems that it could be used as a proof of concept by tunneling a multiplayer connection over it, and perhaps some of the same techniques used there could be applied to the Factorio netcode. That project is at https://github.com/wangyu-/UDPspeeder.

Why ?
The current behavior during multiplayer when a client experiences packet loss can be pretty brutal. A small amount of packet loss can cause the latency estimate to balloon to a large number and even result in the client being dropped.

The suggested changes should significantly improve the multiplayer experience under those conditions, specifically including less latency and less jitter.

Post Reply

Return to “Ideas and Suggestions”