Why UDP Beats TCP for Interactive Play
Daniel Suhett

Daniel Suhett @danielsuhett

About: Software Engineer from Brazil working with web stuff

Joined:
Jun 10, 2025

Why UDP Beats TCP for Interactive Play

Publish Date: Jun 21
0 0

Like many developers, I spend a lot of time at my desk, but I wanted more flexibility in where I could play my games. I began using Moonlight and Sunshine to stream my desktop gameplay to my TVs. When I first started, my games ran at 1080 p/60 fps, but I quickly learned how bitrate scales with resolution: a smooth 4K/120 fps stream can exceed 35 Mb/s, which may overwhelm a home network if it isn’t managed carefully. I’m trying to find the sweet spot between image quality and performance.

This experience gave me a fresh perspective on how UDP is important and enables real-time, low-latency communication.


What UDP Is

User Datagram Protocol (UDP) is a Layer-4 protocol that addresses individual processes on a host by using port numbers and provides a simple way to send and receive data.

Header

The UDP header is only 8 bytes long, keeping each datagram lightweight.

Communication

UDP maintains no connection state on either host. There is no setup or teardown phase.

Multiplexing and Demultiplexing

A sender can multiplex data from many applications into separate datagrams. The receiver then demultiplexes each datagram to the correct application by its destination port.

Low Latency

Because UDP has no handshake, no ordering, and no retransmission, it offers minimal latency between sender and receiver—though without delivery guarantees.


Why Latency Matters

In gaming, every frame is part of a live feedback loop. Dropped or late frames can ruin the user experience. For smooth 60 FPS gameplay, a new frame must arrive every 16.66 milliseconds. At 120 FPS, this drops to 8.33 milliseconds. Professional gamers react to visual stimuli in as little as 100–150 milliseconds, so every bit of latency counts.
TCP’s congestion control mechanisms can introduce unacceptable delays for real-time gaming. UDP allows applications to prioritize timeliness over reliability, implement custom pacing algorithms, and use forward error correction or partial redundancy instead of full retransmissions.

Making the Most of UDP

To compensate for inevitable packet loss and jitter, client-side techniques like jitter buffers, frame interpolation, input prediction, and error concealment are used. These tricks help hide imperfections and keep the stream feeling responsive, even when the network isn’t perfect.

Technique Purpose
Jitter Buffer Absorbs small arrival-time variations before decoding.
Frame Interpolation Reconstructs missing motion vectors, hiding dropped frames.
Input Prediction Locally simulates next state so lost control packets don’t freeze movement.
Error Concealment Uses the last good macro-blocks or spatial interpolation when part of a frame is corrupted.

Conclusion

UDP Pros

  • Simple and lightweight: Small headers, less bandwidth, and stateless operation.
  • Low latency: Perfect for real-time applications like gaming and streaming.
  • Fast: No handshake means data gets moving right away.

UDP Cons

  • No guarantees: No acknowledgments, delivery guarantees, or flow control.
  • Connection-less: Anyone can send data, which can be a security risk (hello, DNS floods!).
  • No order or congestion control: Packets might arrive out of order or get lost in the shuffle.

UDP isn’t "worse TCP", it’s a specialized tool designed for speed, not reliability. For modern game streaming, that’s exactly what we need to keep our actions and the on-screen world in sync, with sub-100ms glass-to-glass latency.

Comments 0 total

    Add comment