Sign in to follow this  
Browser12

Handling client input

Recommended Posts

[top-down real-time RPG] Hey, so I am looking to use UDP for my game wherever applicable. For example, I'll probably do the chat in TCP, but I'd send position updates to the clients via UDP. I'm aware of how/why fire-and-forget is fine for these position updates sent to the clients, but... My question is, do I need to use TCP for something such as players' movement requests to the servers? It's one thing, as a client, to miss a UDP packet that's specifying an absolute position, because you'll get one further down the line and you're probably simulating things yourself in the meantime anyways. But won't it cause ugliness if, say, the server misses the client's requested change in motion and ends up telling the client that its player object is in a position that they didn't ever intend to put it?

Share this post


Link to post
Share on other sites
TCP is one way, custom built protocol over UDP is another way.

If you go with latter, then you need to cover all potential problems yourself, either at network level, or at application level.

Quote:
But won't it cause ugliness if

It could, if designed improperly. There are many ways to tackle this problem, anything from time stamps, duplicated data, retransmit schemes, ... The details depend on which is most suitable.

Unless designing for LAN, I don't think fire-and-forget is viable, there needs to be some validation scheme in there somewhere.

Share this post


Link to post
Share on other sites
Just FYI, I got a cheap server running my multiplayer game and I'm using TCP, ping is about 25-35 milliseconds.
OK, farther away or on a big server load it would get worse but you always has to deal with high ping anyway.

I'd be you I'd go with the easiest protocol (except if you're a big company where others are supposed to do the work).

I don't thing UDP is really necessary for 'non-FPS' (and other twitch) games, but that's just my 2 cents.

HTH

Share this post


Link to post
Share on other sites

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