🎉 Celebrating 25 Years of GameDev.net! 🎉

Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!

For casual multiplayer mobile game which protocol to chose UDP , WEBSOCKETS , TCP? please from experience. No problem in implementing

Started by
4 comments, last by swiftcoder 7 years, 10 months ago

i want to implement simple casual MMO game like the io games .
only from mobile , using native engines .
now i have all framework setup using websockets . BUT
as we all know websockets are TCP and not much Efficient comparing to UDP datagram but i have no knowledge how about UDP and networks and firewalls .
is it more restricted then websockets do i expected to have problems with WIFI?
there are trade off should i stay with websockets ?

Advertisement

TCP is perfectly fine for a casual MMO game. You don't need UDP. Stay with websockets until you have proof that you have a problem.

tcp will be okay, becuse nowdays a lot of providers and routers simply filter the udp out.

Thanks for answering , i know that udp is the fastest , but i worried about casual users Those that play games while in the toilet at work or in hotel vacation and using hotel wifi , you know super casual . the question is can i stay with websockets ? or use TCP

nowdays a lot of providers and routers simply filter the udp out.


That is not true.

However, TCP can be fine for an MMO. IIRC, both EverQuest and WoW use TCP.

It's more important that you make efficient use of bandwidth, and group messages into packets that you schedule a few times per second.
enum Bool { True, False, FileNotFound };

TCP and not much Efficient comparing to UDP

On a reliable network, the difference in efficiency between UDP and TCP is generally negligible.

If you expect severe packet loss, TCP can end up in a situation where it isn't making much forward progress. Which is where UDP can be preferable. But, whatever reliable UDP layer you build is going to run into similar problems delivering your control messages (even though many game packets can be sent in unreliable mode, some will still require acknowledgement) - UDP protocol design is a pretty advanced topic.

To obtain the best performance from TCP, make sure you disable Nagle's algorithm (the TCP_NODELAY socket option). This one setting is usually to blame for most of the apparent performance difference between TCP and UDP.

Tristam MacDonald. Ex-BigTech Software Engineer. Future farmer. [https://trist.am]

This topic is closed to new replies.

Advertisement