Why a resend is no good for a game
The usual answer to a lost packet is for the receiver to say "I did not get that" and the sender to send it again. That costs a whole round trip, at least one more ping. In a game, by the time the packet comes again the scene has moved on and the data is stale.
FEC takes the other road: it sends a little extra information at the start, so the receiver can fill the gap on its own.
A small example
Say we have two packets, A = 1100 and B = 1010. The sender also sends a third packet that is the XOR of the two: P = A xor B = 0110.
Now if B is lost on the way, the receiver has A and P and rebuilds B: A xor P = 1100 xor 0110 = 1010. That is B. Nothing was resent and nobody waited.
Real codes
In practice codes are used that rebuild several lost packets at once, instead of plain XOR. The principle is the same: some repair packets for every group of game packets. The more repair packets, the more loss is tolerated, and the more extra traffic.
One more subtlety: packets are often lost one after another, not scattered. A code that ignores this is weak against a run of losses, so a good implementation has to account for it.
What it costs
- Extra traffic, in proportion to the number of repair packets. If your line loses nothing, that traffic is wasted.
- If more packets are lost in a group than there are repair packets, nothing is rebuilt. It does not make up for a long outage.
- It does not lower ping. It only stops the data from going stale.
In OhMyPing
FEC is a switch in the app and is off by default. If your line starts losing packets, the app suggests turning it on. You can see a simplified model on the home page by dragging the packet-loss bar.