Hacker News new | ask | show | jobs
by rubyist5eva 1770 days ago
Does it work similar to rollback netcode in fighting games? Where the game tries to predict what the other player is going to do by looking at what they’ve done in previous frames, and if there’s lag or dropped packets and a destiny happens it rolls back the game state and replays it correctly?
2 comments

Not exactly, FEC basically means you add in redundant data to your transmission so that if some of the data is lost, you can “rebuild” the missing data from the packets that did arrive. The cost of this is extra bandwidth spent on the redundancy, as well as a little latency.

Rollback is as you say, if the game loses connection with your opponent, rollback 1) uses your opponent’s past actions to predict what they will do next and then presents that to you as if they did it then 2) when the connection is restored, reconcile (if necessary) the difference between what your opponent actually did with what it predicted, rolling back if needed.

thanks for the explanation
FEC in basic form works like raid 5. M parity packets for every N data packets, allowing loss recovery of up to M of the M+N packets without round trip back to host.

You can dynamically tune M and N based on measured loss rates and RTT.