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

Gaming

5 min read Michael Carroll on Feb 20, 2023

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

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.

Talk to an Expert

Let's connect to discuss your real-time project.

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 (2)

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 (3)

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.

Is UDP or TCP better for gaming? ›

It depends on what you're doing online and the type of data being transferred. 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.

What protocol is best for gaming? ›

When it comes to gaming, protocols like OpenVPN and WireGuard are often recommended due to their efficient data encryption methods and low impact on connection speeds. These protocols prioritize speed and security, making them ideal choices for gamers looking to enhance their online gaming experience.

Why prefer UDP over TCP? ›

In most cases, UDP is faster than TCP because it does not assure delivery of the packets as TCP does. The UDP protocol is not suitable for sending electronic mail, viewing a web page, or downloading a file. However, it is preferred mainly for real-time applications like broadcasting or multitasking network traffic.

What communication protocol do multiplayer games use? ›

User Datagram Protocol (UDP)

UDP is preferred for real-time multiplayer games where speed and efficiency matter more than ensuring every packet is delivered. It works at the Transport Layer, sending messages, known as datagrams, with less overhead than TCP.

What is the best protocol for game server? ›

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 is UDP used for online games? ›

User datagram protocol (UDP) is used for time-critical data transmissions such as DNS lookups, online gaming, and video streaming. This communication protocol boosts transfer speeds by removing the need for a formal two-way connection before the data transmission begins.

Do MMORPGs use TCP or UDP? ›

1 Introduction
ProtocolMMORPGs
TCPWorld of Warcraft, Angel's Love, Lineage I/II, Guild Wars, Ragnarok Online
UDPEverQuest, City of Heroes, Asheron's Call, Ultima Online, Final Fantasy XI
TCP/UDPDark Age of Camelot
1 more row
Sep 28, 2019

What is the best network mode for gaming? ›

If you're using a dual-band Wi-Fi 5 or Wi-Fi 6 router, you can connect your client devices to either a 2.4GHz band or a 5GHz band. If you have a tri-band router, you get an extra 5GHz band that you can dedicate to gaming and video streaming. A 5GHz connection will provide better performance at short ranges than 2.4GHz.

What is the best connection type for gaming? ›

For faster speeds and lower latency, you're better off using an ethernet cable to connect to the internet. A wired connection is more solid than a wireless one. If you don't have an ethernet cable handy, put your gaming console or computer as physically close to your router as you can to improve Wi-Fi connection.

What is the main disadvantage of TCP over UDP? ›

Disadvantages of TCP

It is slower than UDP and it takes more bandwidth. Slower upon starting of transfer of a file. Not suitable for LAN and PAN Networks. It does not have a multicast or broadcast category.

Why is my TCP faster than UDP? ›

TCP vs UDP: Speed differences

The reason is that UDP doesn't use such an acute checking of packets as TCP and employs a more continuous data flow. TCP sends its data in sequence, so it uses more flow control.

Why is UDP better than TCP for streaming? ›

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.

Are video game servers TCP or UDP? ›

In UDP the route/path is not fixed and the packets are just sent over which ensures faster delivery of data. Thus, UDP is faster than TCP. As the game is multiplayer so it needs to be interactive thus you need UDP. Infact, all the live and interactive sessions or games are UDP based.

What protocol is used for Internet chat? ›

The Internet works by using a protocol called TCP/IP, or Transmission Control Protocol/Internet Protocol. ... In base terms, TCP/IP allows one computer to talk to another computer via the Internet through compiling packets of data and sending them to right location.

What type of servers do online games use? ›

  • Peer-to-peer hosting. Also known as peer 2 peer or P2P, peer-to-peer hosting is the simplest and least costly of the four types of game server hosting that we'll be discussing in this blog. ...
  • Bare metal server hosting. ...
  • Cloud server / virtual machine hosting. ...
  • Hybrid infrastructure hosting.

Should I use UDP or TCP VPN gaming? ›

TCP is more reliable, but there are many uses where UDP is preferred and this is usually the default protocol on most VPN services. UDP is a great option if you are gaming, streaming or using VoIP services. It may lose a packet or two but it won't have a huge impact on your overall connection.

Does COD use UDP or TCP? ›

Call of Duty: Advanced Warfare
PLATFORMTCPUDP
PC27014-270503478, 4379-4380, 27000-27031, 27036
PlayStation 352235223, 3478-3479, 3658
PlayStation 480, 443, 1935, 3478-34803478-3479
Xbox 36030743074
1 more row
May 2, 2024

When should I use TCP or UDP? ›

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.

How much faster is TCP than UDP? ›

In summary, UDP is generally a little faster than TCP, sometimes a lot faster, and how much faster depends on what aspect of speed you're interested in. Furthermore, any speed advantage that UDP provides comes with important caveats and the need to reimplement the guarantees that TCP provides.

Top Articles
The Pros and Cons of White Linens in a Vacation Rental
Is it always better living on higher floors?
Fernald Gun And Knife Show
7 C's of Communication | The Effective Communication Checklist
Bleak Faith: Forsaken – im Test (PS5)
Pinellas County Jail Mugshots 2023
La connexion à Mon Compte
Aces Fmc Charting
Tap Tap Run Coupon Codes
Zoebaby222
Missing 2023 Showtimes Near Landmark Cinemas Peoria
Ave Bradley, Global SVP of design and creative director at Kimpton Hotels & Restaurants | Hospitality Interiors
Nashville Predators Wiki
Aces Fmc Charting
Superhot Unblocked Games
Mephisto Summoners War
RBT Exam: What to Expect
Steamy Afternoon With Handsome Fernando
Craigslist Sparta Nj
Cocaine Bear Showtimes Near Regal Opry Mills
Wgu Academy Phone Number
Walgreens Alma School And Dynamite
Why do rebates take so long to process?
Who is Jenny Popach? Everything to Know About The Girl Who Allegedly Broke Into the Hype House With Her Mom
Dark Entreaty Ffxiv
How Taraswrld Leaks Exposed the Dark Side of TikTok Fame
Bidevv Evansville In Online Liquid
Crossword Help - Find Missing Letters & Solve Clues
Garden Grove Classlink
Narragansett Bay Cruising - A Complete Guide: Explore Newport, Providence & More
2004 Honda Odyssey Firing Order
Emuaid Max First Aid Ointment 2 Ounce Fake Review Analysis
Gncc Live Timing And Scoring
Uky Linkblue Login
WOODSTOCK CELEBRATES 50 YEARS WITH COMPREHENSIVE 38-CD DELUXE BOXED SET | Rhino
Publix Coral Way And 147
Word Trip Level 359
Navigating change - the workplace of tomorrow - key takeaways
Kelsey Mcewen Photos
Ise-Vm-K9 Eol
How much does Painttool SAI costs?
Taylor University Baseball Roster
Gold Dipping Vat Terraria
Simnet Jwu
Hanco*ck County Ms Busted Newspaper
John Wick: Kapitel 4 (2023)
Www.homedepot .Com
Campaign Blacksmith Bench
Skyward Login Wylie Isd
Lake County Fl Trash Pickup Schedule
Arre St Wv Srj
Latest Posts
Article information

Author: Geoffrey Lueilwitz

Last Updated:

Views: 6401

Rating: 5 / 5 (80 voted)

Reviews: 87% of readers found this page helpful

Author information

Name: Geoffrey Lueilwitz

Birthday: 1997-03-23

Address: 74183 Thomas Course, Port Micheal, OK 55446-1529

Phone: +13408645881558

Job: Global Representative

Hobby: Sailing, Vehicle restoration, Rowing, Ghost hunting, Scrapbooking, Rugby, Board sports

Introduction: My name is Geoffrey Lueilwitz, I am a zealous, encouraging, sparkling, enchanting, graceful, faithful, nice person who loves writing and wants to share my knowledge and understanding with you.