Why QUIC May Be the Future for Real-Time Applications and Competitive Gaming

The adoption of QUIC, a new transport layer network protocol developed by Google, is a subject that has spurred considerable debate, particularly regarding its efficacy in low-latency applications such as video games. But is this protocol, largely favored for its performance and security features, suitable to replace UDP in competitive gaming scenarios? This question becomes especially pertinent given its foundational reliance on UDP datagrams and its adaptable features.

The gaming industry has long relied on UDP due to its minimal overhead and swift delivery characteristics. Competitive games prioritize real-time updates over reliability, often choosing to lose a few packets rather than suffer from the delays caused by resending them. UDP allows games to bypass the reliability mechanisms ingrained in TCP, which can introduce unwanted latency.

struct PositionUpdate {
  float x, y, z;
  float timestamp;
};
sendto(sockfd, &update, sizeof(update), 0, (struct sockaddr *) &server_addr, sizeof(server_addr));

Commenters in the discussions provided in-depth insights into the nuances of choosing between UDP and QUIC for online gaming. One particular concern raised is whether competitive shooters and other fast-paced games should transition to QUIC. The consensus seems mixed, but several points are noteworthy. As pointed out by swiftcoder, if the application supports datagrams, QUIC can theoretically be implemented. Another feature that QUIC offers over UDP is the segmentation of data streams with prioritization, which could be beneficial.

However, critics like Tuna-Fish argue that QUIC offers no substantial benefit over UDP, especially in scenarios where the primary requirement is the rapid and timely delivery of game state data. The complexity and overhead introduced by QUIC’s streaming nature and mechanisms like retransmission and congestion control could, in some cases, degrade performance rather than enhance it.

quic_send_flag = QUIC_SEND_FLAG_CANCEL_ON_LOSS;
moving_average_ping = (moving_average_ping * 7 + current_ping) / 8;
if (moving_average_ping > max_tolerable_ping) {
  optimizer.adjust_bandwidth_parameters();
}

An interesting argument made by chrisfarms highlights that while UDP is sufficient for sending whole game states in each packet, it becomes less feasible if the game relies on sending incremental states or diffs. In such cases, the ‘timeliness’ property of UDP might not cover all requirements efficiently, and the distinction becomes essential when considering the deployment of QUIC or other protocols designed to handle such nuances more gracefully. Given that QUIC operates over UDP but offers a more sophisticated control over data transmission, it presents a tailored solution that potentially mitigates such scenarios.

Another noteworthy comment from Retr0id clarifies that QUIC is a user-space protocol, which avoids needing extensive platform support. By operating above the standard networking stack, it remains versatile across different operating systems. This attribute alone makes it an intriguing choice for game developers looking to maintain cross-platform compatibility without delving into kernel-level adjustments.

quic_stream_params.priority = HIGH_PRIORITY;
quic_send(&stream, &data, data_length);
if (packet_loss_detected) {
  stream.flags |= quic_send_flag;
}

image

For gaming, where real-time responsiveness is paramount, QUIC’s introduction of customizable flags (like QUIC_SEND_FLAG_CANCEL_ON_LOSS) can lead to significant advantages. This feature permits critical data to be flagged for cancellation if it experiences loss, ensuring that outdated information doesn’t congest the network. This method can help maintain the fluidity of game state updates, which is crucial in competitive settings. However, developers would need to reassess how these features interact with the rest of the game’s networking logic, which adds a level of complexity.

Technology enthusiasts and professionals from fields like low-latency sensor data streaming and real-time media also chimed in, underscoring that real-world implementations of QUIC have already shown promising reductions in issues like out-of-order delivery. The anecdotal evidence from R&D professionals suggests that QUIC solutions outperform traditional UDP setups in environments requiring stringent latency control, albeit at the cost of added complexity.

if (use_quic) {
  quic_send_data(packet);
} else {
  udp_send_data(packet);
}

In practice, most gaming network setups already build some level of reliability and sequencing over UDP to handle things like chat messages, control signals, or other game-critical events. As swiftcoder pointed out, many of these constructs eventually start to resemble simplified versions of QUIC. So, could fully adopting QUIC streamline these bespoke solutions into a more integrated, manageable stack? Potentially. But it remains to be seen if the gaming industry is willing to transition from tried-and-tested methods that have been resilient over decades.

What cannot be disregarded is the necessity for robust testing in various network conditions. As smcameron suggested, incorporating ‘bad network emulation’ into testing mechanisms can ensure that applications remain responsive under packet loss, reordering, or delay. This kind of rigorous testing validation will be essential if game developers opt to make the shift towards QUIC.

run_network_emulation_tool();
simulate_packet_loss(10%);
simulate_packet_reorder();
assert_true(system_performance() >= thresholds.min_required);
cleanup_network_tool();

In conclusion, while the debate over whether to adopt QUIC or stick with UDP in competitive gaming is far from settled, the discourse highlights some significant advantages and constraints. The key takeaway is that QUIC offers several features that could theoretically improve the stability and performance of real-time applications, but these come with added complexity and setup costs. Whether QUIC can replace UDP in such a critical domain will depend largely on the unique requirements of each game and how well developers can integrate the protocol without compromising on performance.

For now, it’s a matter of choice based on specific use cases. Many game developers will likely continue to rely on custom UDP solutions finely tuned to their needs, while others may begin to explore the potential that QUIC holds, aiming for more versatile and resilient networking capabilities. Watching this space evolve will be intriguing as both technologies advance and as the requirements of real-time applications continue to push the boundaries of what’s possible in networked environments.

if (use_quic_for_games()) {
  implement_quic_features();
} else {
  refine_udp_strategies();
}


Comments

Leave a Reply

Your email address will not be published. Required fields are marked *