Sign in to follow this  

Couple basic game network programming questions

This topic is 4596 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Is it ok to mix UDP and TCP in a game? For instance i'd like important things like messages, new players entering the area, admin commands, etc. to come in on TCP, and less important things like player updates coming in on UDP. The TCP traffic will be a lot less frequent than the UDP traffic. Seems like i've heard it's a bad idea to mix the two, but i'm wondering if that's still true if the TCP traffic would be pretty rare? My game is a space game, along the lines of Subspace, a live action arcade sort of game where it's fairly important you have a good idea of what other players are doing, what would be the best method to use to have smooth ships and bullets flying around? Dead reckoning? The Targetting method I found in the tutorials section here? Or something else? This will be on a "many clients one server" model. Should my network code on the client be in it's own thread, or will it be ok running in the main programs thread?

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
The main problem with TCP / UDP mixing is if you have logic that depends on both. If you're using them for completely seperate things you're largely OK.

The secondary problem is as referred to above: that badly configured routers will not correctly prioritize traffic.

IM recent E, most home routers are very well confiured out of the box, except some of the wireless ones. I've seen cheap ones from e.g. netgear with excellent telnet-rather-than-ftp style traffic shaping.

But, as you described your problem, there is nothing wrong with mixing them, since the uses are independent of each other. Then again, I'd follow the other opinion given above: if you're going to use UDP at all, use RakNet, eNet, or similar, and then you don't need UDP nor TCP at all, just let the library handle it, by running its proprietary code over UDP.

Note in particular that with UDP you MUST ASSUME that ALMOST EVERY SINGLE MESSAGE NEVER ARRIVES. If your game still works with that asusmption, fine. If not, then your game will not work. So, for instance, position updates will be OK so long as you can guarantee missed ones make no difference to your gameplay (if you only sent steering, rather than absolute position, this would not be true, but you'd get much much better speed and responsiveness)

redmilamber

Share this post


Link to post
Share on other sites

This topic is 4596 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this