UDP vs TCP: Why to Run Gaming Servers Separate from Chat (2024)

When it comes to building multiplayer games, developers are often faced with a dilemma.

  • Do I utilize my existing game servers already powering my multiplayer functionality to run chat?

  • Do I separate my game servers and run my chat independently?

Because after all, they’re just chat messages right? Small messages being sent to a single user or a small group, might as well just utilize what’s already built? What could hurt? Though it may seem like a good option initially to utilize what you already have built, there are a number of problems that can arise from choosing this design pattern.

We’ll show you why you should run your game servers and social features (most importantly chat) independently, benefiting both you as a game developer and your end users. In doing so, you’ll increase performance and scalability of the game itself and allow social features to be easily extended with new functionality in the future.

What is TCP and UDP?

Essentially, TCP and UDP are network protocols that are used for data transfer over the internet. TCP is a connection-oriented internet protocol, while on the other hand UDP is a connectionless protocol.

The big debate over multiplayer gaming protocols is when should you use UDP (User Datagram Protocol) vs TCP (Transmission Control Protocol) and when is it best to use either one?

But before we get to that, let’s discuss online game architecture.

UDP vs TCP Gaming Servers: How to Make Your Online Game More Manageable

A microservices-oriented architecture breaks a large application, in this case your game, into small, independently versioned modular services, and talk to each other through simple, universally accessible APIs. It makes it much easier to build new functionality and maintain the bandwidth and functionality once built.

Separating your game servers from your chat functionality makes your entire infrastructure more manageable, and gets you closer to a completely microservices-oriented architecture. In this case, let’s look specifically at in-game chat, and its relationship with the game servers powering the multiplayer game.

With a monolithic architecture, your development team is now locked into a single technology stack – using the same programming languages, databases, and software environments that the game was already built on. In bringing on new developers, or wanting to prototype new technologies and systems, it’s much easier to move fast in a microservices architecture.

Dependencies are also much more apparent with monolithic architectures. If your single application function fails, the entire game goes down. Splitting your game into microservices, if a single module fails, it’s easier to isolate the fault and fix it.

Your game servers are built for delivering player movement and state in real time, and they do that well. Repurposing the same technology and design for chat messages is simply not using the best options for the particular functionality. Decentralized components are easier to maintain and scale better.

UDP vs TCP: Why to Run Gaming Servers Separate from Chat (1)

A game infrastructure example where chat is separated from the game servers. We can also run other services outside the game servers, including authorization, presence, and statistics and leaderboards.

UDP vs TCP Gaming Servers: Ensuring Seamless Gaming Experience and Chat Performance

Overall game performance is a major consideration for a multiplayer game. With monolithic architecture, the game may perform in the lab, but for online games with a high amount of users, communicating at a rapid pace, you’ll begin to see lag and increased latencies on both delivery of the chat messages and the experience of the game.

Separating the two ensures that CPU and network resources are used more efficiently. The primary purpose of your game servers are to deliver a seamless experience for every user in your game. As a result, the processing power should be used to maximize that performance.

Say you have an online battle arena game like League of Legends or EVE Online. You may have hundreds of players in a single world, at a single time. That’s thousands of messages being sent through your game servers delivering every input each player creates. Then add in chat messages to the mix. It’s entirely possible that players can spam the chat channel and deliberately slow down the game server since all messages would have the same priority.

The gaming server is already handling intensive gameplay experiences – physics, graphics, sound. To add in chat messages – one-to-one, group, team – parsing and routing the messages to the correct users – all these messages slowly build up for large-scale games, and hurt the overall performance of the game. It’s a no-brainer to run chat channels separate from the multiplayer channels. It is stealing important processing power that could be better suited for more complex problems than routing chat messages.

TCP vs UDP – When You Need Both, and When You Don’t

Fast-paced multiplayer games (first person shooters, arena games, etc), use UDP protocol to sync player movement and update game state. UDP headers are ideal for sending these game updates at a ridiculously fast speed, but messages are not guaranteed (because the next message is coming so fast behind).

Why is UDP preferred over TCP? And vice-versa?

TCP connection guarantees message delivery, which makes it a great option for chat. You’ll see great performance running your game on UDP and your social features on TCP.

UDP vs TCP: Why to Run Gaming Servers Separate from Chat (2)

However, for less intense multiplayer games, like turn-based games, TCP is a suitable option for both gameplay and chat. Because TCP guarantees message delivery, and in games where every move matters (like a Scrabble turn or tic-tac-toe), it’s a great option to power the multiplayer gameplay. Of course, you’ll still want to separate your chat from the game server connections, especially once your game takes off and you have thousands of users connected at a single time.

Consider latency when choosing to use TCP and UDP for different functionality

Latency is another thing to consider, as there are different standards of latency for multiplayer functionality vs. social features. For a multiplayer game, ensuring game state and delivering player inputs, the industry-standard is no more than 20ms. Whereas for a chat application, the maximum latency for delivery of a chat message is 250ms. So you’ve got two different types of real-time messaging for online games, with two different standards. Having them operate alone lets you manage each one based on what’s required.

Add New Social Features with Ease Whether Using TCP or UDP Protocol

Running chat as a standalone service, and picking an industry-standard network protocol (XMPP, WebSockets, ngrok) or a hosted-service (PubNub) opens up the opportunity to easily add new powerful social features.

Start with core chat, allowing users to individual and group chat. With that, you’ve got the underlying infrastructure, as well as basic publish/subscribe, and there’s a lot of other social features you can easily build on it. In minimal code, you can add table stake chat features like typing indicators, presence to show what players are online and offline, and unread message counters – features that are expected by users.

TCP and UDP: Looking Forward

Gaming apps big and small are moving towards this architectural design, including Pocket Gems, and more recently EVE Online. From better scalability, flow control, and more efficient performance, to the freedom to innovate without being locked into a single stack, the benefits are clear – separating chat from your game servers is the way to go.

With PubNub Chat, you can easily implement in-game chat as the basis for robust social features, letting you focus more on your core game development and less on scaling and maintaining social infrastructure.

References

UDP vs TCP: Why to Run Gaming Servers Separate from Chat (2024)

FAQs

UDP vs TCP: Why to Run Gaming Servers Separate from Chat? ›

TCP connection guarantees message delivery, which makes it a great option for chat. You'll see great performance running your game on UDP and your social features on TCP. However, for less intense multiplayer games, like turn-based games, TCP is a suitable option for both gameplay and chat.

Why doesn t online games and voice chat use TCP? ›

The primary reason being that TCP guarantees ordered delivery and resends any lost packets. Meaning anytime you drop a packet, the client will have to send info to server that a packet is missing, then the server will receive that info and re-send missing packet.

Why is UDP better for gaming? ›

UDP is better if you're gaming online, because its speedy data transfer allows for mostly lag-free gaming. TCP is better if you're transferring files, like family photos, because it ensures the data arrives exactly as it was sent.

Why would you want to use UDP instead of TCP? ›

Typically, applications that transfer data files will use TCP since the protocol's latency and performance issues are not that critical. UDP benefits applications that need to receive data quickly even if accuracy suffers. This is why real-time applications like audio and video streaming will often use UDP.

Do fighting games use UDP? ›

UDP is used for game operations that require low latency and can tolerate some packet loss. This is often used for fighting games, shooting and tracers, network audio, and voice chat.

Is TCP or UDP better for games? ›

You'll see great performance running your game on UDP and your social features on TCP. However, for less intense multiplayer games, like turn-based games, TCP is a suitable option for both gameplay and chat.

Does chat use TCP or UDP? ›

Well, all chat protocols are built on either a UDP or a TCP connection. So, it's important to understand the benefits and drawbacks of each protocol. UDP's biggest benefit is speed. But that speed is achieved by sending packets (units of data) directly to a device without first establishing a connection.

Why UDP is more suitable for live streaming and online gaming what would be the impact if TCP is used in place of UDP in live videos? ›

Also, for transmission over an unreliable network, TCP works better than UDP due to its high reliability factor. As discussed above, the TCP streaming protocol ensures accuracy but it's slow. As the error recovery process doesn't take place in case of UDP streaming, it is faster than the other.

Does fortnite use TCP or UDP? ›

Fortnite doesn't use UDP at all (80, 443 and 5222 all TCP), UE4 uses TCP for its network stack by default. Nope, it might use TCP for negotiation of things that aren't time sensitive but it uses UDP for replication[1] as has pretty much every Unreal or Quake based engine since they were first developed.

What is the major advantage of UDP over TCP? ›

UDP is faster, simpler, and more efficient than TCP. Retransmission of lost packets is possible in TCP, but not in UDP. There is no retransmission of lost packets in the User Datagram Protocol (UDP).

Does zoom use TCP or UDP? ›

With a successful connection to the optimum Zoom Multimedia Router for the session, the Zoom Client prioritizes creating a connection for each type of media that will be exchanged such as video, audio, and content. Each of these media connections attempt to use Zoom's own protocol and connect via UDP on port 8801.

Why is UDP preferred over TCP for streaming? ›

Comparison between TCP and UDP protocols.

All things considered, UDP is the better option because it enables data to be streamed with near immediacy. In this sense, UDP is the better option despite some data packets potentially being sent out of order.

What does UDP mean in gaming? ›

User Datagram Protocol (UDP) is a communications protocol for time-sensitive applications like gaming, playing videos, or Domain Name System (DNS) lookups. UDP results in speedier communication because it does not spend time forming a firm connection with the destination before transferring the data.

Does Minecraft server use UDP? ›

In the case of Minecraft servers, just a reminder that the default ports vary depending on the version of the game: Minecraft Java Edition uses TCP/25565 while Minecraft Bedrock Edition uses UDP/19132.

Is TCP suitable for voice calls? ›

Call Quality

A voice call is a conversation that has streams of packets. All of these packets need to created, transmitted, and received in real-time. In TCP, retransmissions and acknowledgments will create lags in the voice call. Lags in a voice call drop the quality of calls.

Why is TCP not used for streaming? ›

The TCP takes additional time in sending and receiving Acknowledgment packets which slows the speed and is not required in real-time video streaming.

Can TCP transmit voice calls? ›

During a call, these packets are created, transmitted, and received, in real-time. As mentioned before, retransmissions and acknowledgments in TCP voice call cause lag in voice calls. Although missing packets in TCP calls are less frequent than UDP, delays and pauses are more noticeable than missing packets.

Top Articles
Clear Search & Watch History - Support - Nintendo
Manulife Financial Stock Price | MFC Stock Quote, News, and History | Markets Insider
Katie Pavlich Bikini Photos
Gamevault Agent
Hocus Pocus Showtimes Near Harkins Theatres Yuma Palms 14
Free Atm For Emerald Card Near Me
Craigslist Mexico Cancun
Hendersonville (Tennessee) – Travel guide at Wikivoyage
Doby's Funeral Home Obituaries
Vardis Olive Garden (Georgioupolis, Kreta) ✈️ inkl. Flug buchen
Select Truck Greensboro
How To Cut Eelgrass Grounded
Craigslist In Flagstaff
Shasta County Most Wanted 2022
Energy Healing Conference Utah
Testberichte zu E-Bikes & Fahrrädern von PROPHETE.
Aaa Saugus Ma Appointment
Geometry Review Quiz 5 Answer Key
Walgreens Alma School And Dynamite
Bible Gateway passage: Revelation 3 - New Living Translation
Yisd Home Access Center
Home
Shadbase Get Out Of Jail
Gina Wilson Angle Addition Postulate
Celina Powell Lil Meech Video: A Controversial Encounter Shakes Social Media - Video Reddit Trend
Walmart Pharmacy Near Me Open
Dmv In Anoka
A Christmas Horse - Alison Senxation
Ou Football Brainiacs
Access a Shared Resource | Computing for Arts + Sciences
Pixel Combat Unblocked
Umn Biology
Cvs Sport Physicals
Mercedes W204 Belt Diagram
Rogold Extension
'Conan Exiles' 3.0 Guide: How To Unlock Spells And Sorcery
Colin Donnell Lpsg
Teenbeautyfitness
Weekly Math Review Q4 3
Facebook Marketplace Marrero La
Nobodyhome.tv Reddit
Topos De Bolos Engraçados
Gregory (Five Nights at Freddy's)
Grand Valley State University Library Hours
Holzer Athena Portal
Hampton In And Suites Near Me
Stoughton Commuter Rail Schedule
Bedbathandbeyond Flemington Nj
Free Carnival-themed Google Slides & PowerPoint templates
Otter Bustr
San Pedro Sula To Miami Google Flights
Selly Medaline
Latest Posts
Article information

Author: Neely Ledner

Last Updated:

Views: 6276

Rating: 4.1 / 5 (42 voted)

Reviews: 81% of readers found this page helpful

Author information

Name: Neely Ledner

Birthday: 1998-06-09

Address: 443 Barrows Terrace, New Jodyberg, CO 57462-5329

Phone: +2433516856029

Job: Central Legal Facilitator

Hobby: Backpacking, Jogging, Magic, Driving, Macrame, Embroidery, Foraging

Introduction: My name is Neely Ledner, I am a bright, determined, beautiful, adventurous, adventurous, spotless, calm person who loves writing and wants to share my knowledge and understanding with you.