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

This article was originally published on PubNub.com

Our platform helps developers build, deliver, and manage real-time interactivity for web apps, mobile apps, and IoT devices.

The foundation of our platform is the industry’s largest and most scalable real-time edge messaging network. With over 15 points-of-presence worldwide supporting 800 million monthly active users, and 99.999% reliability, you’ll never have to worry about outages, concurrency limits, or any latency issues caused by traffic spikes.

Experience PubNub

Check out Live Tour to understand the essential concepts behind every PubNub-powered app in less than 5 minutes

Get Setup

Sign up for a PubNub account for immediate access to PubNub keys for free

Get Started

The PubNub docs will get you up and running, regardless of your use case or SDK

UDP vs TCP: Why to Run Gaming Servers Separate from Chat (2024)
Top Articles
Powered Hand Tools - Routers
What is NFT Minting: Meaning and Process Explained | LiteFinance
Fernald Gun And Knife Show
Cranes For Sale in United States| IronPlanet
Tyler Sis 360 Louisiana Mo
Trevor Goodwin Obituary St Cloud
Windcrest Little League Baseball
DEA closing 2 offices in China even as the agency struggles to stem flow of fentanyl chemicals
The Ivy Los Angeles Dress Code
Sarah F. Tebbens | people.wright.edu
Botanist Workbench Rs3
Hk Jockey Club Result
Best Transmission Service Margate
Hay day: Top 6 tips, tricks, and cheats to save cash and grow your farm fast!
Braums Pay Per Hour
My.doculivery.com/Crowncork
2024 Non-Homestead Millage - Clarkston Community Schools
Dr Manish Patel Mooresville Nc
How To Cut Eelgrass Grounded
Vanessa West Tripod Jeffrey Dahmer
Yakimacraigslist
623-250-6295
H12 Weidian
zom 100 mangadex - WebNovel
Nz Herald Obituary Notices
Walmart Near South Lake Tahoe Ca
6 Most Trusted Pheromone perfumes of 2024 for Winning Over Women
Restaurants In Shelby Montana
Wku Lpn To Rn
Infinite Campus Asd20
Uno Fall 2023 Calendar
Craigslist Scottsdale Arizona Cars
Jt Closeout World Rushville Indiana
Home Auctions - Real Estate Auctions
Tmj4 Weather Milwaukee
P3P Orthrus With Dodge Slash
Watchdocumentaries Gun Mayhem 2
Caderno 2 Aulas Medicina - Matemática
Los Garroberros Menu
Eastern New Mexico News Obituaries
Oxford House Peoria Il
Mathews Vertix Mod Chart
Foxxequeen
Wilson Tire And Auto Service Gambrills Photos
60 Days From May 31
Az Unblocked Games: Complete with ease | airSlate SignNow
Caesars Rewards Loyalty Program Review [Previously Total Rewards]
303-615-0055
Game Like Tales Of Androgyny
Mawal Gameroom Download
What Responsibilities Are Listed In Duties 2 3 And 4
Latest Posts
Article information

Author: Gregorio Kreiger

Last Updated:

Views: 6321

Rating: 4.7 / 5 (77 voted)

Reviews: 92% of readers found this page helpful

Author information

Name: Gregorio Kreiger

Birthday: 1994-12-18

Address: 89212 Tracey Ramp, Sunside, MT 08453-0951

Phone: +9014805370218

Job: Customer Designer

Hobby: Mountain biking, Orienteering, Hiking, Sewing, Backpacking, Mushroom hunting, Backpacking

Introduction: My name is Gregorio Kreiger, I am a tender, brainy, enthusiastic, combative, agreeable, gentle, gentle person who loves writing and wants to share my knowledge and understanding with you.