UDP is particularly tricky and nuanced to learn, partially because it's non-deterministic, but mostly because it's actually totally deterministic right up until the point where it isn't. In testing, on your LAN, on lo0
, when there's not a lot going on in the game, delivery is totally reliable, so the code path for recovering from missed datagrams is never covered, the usability where users are dealing with lost traffic is never stressed.
Which means that you never see any flaws in your broken, slow retransmission logic, until it's in front of real users actually playing it on the public internet.