Sign in to follow this  

How to handle user input?

This topic is 3860 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

Hi, Bumped into a small problem with user input. Ok, if my main game frame rate is updating once every 20ms or so on the clients and the clients actions are sent to the server every 200ms, thats up to 10 possible client game loops per server game loop. To solve this would it be a case of: a) Sending client input actions to the server every client game frame (every 20ms, or 40ms, if I only poll input every two game frames) b) Passing all of the actions that occured on the client over the last 200ms along with the game frame or time that the actions occured then sorting all of these actions by time on the server and applying them in order of time to the server object? c) Sending positional information instead. I have been advised not to do this, but with sufficient anti-cheating checks in place, is this viable? d) Some other way? Thanks for any advice Mat

Share this post


Link to post
Share on other sites
The answer depends mostly on what kind of game it is. For an RTS, the answer is b).

Other options include rendering faster than your game physics runs (i e, only pay attention to user input every 50 ms, but render every 20 ms), or increasing your network rate to match your physics rate.

Share this post


Link to post
Share on other sites
Quote:
Original post by hplus0603
The answer depends mostly on what kind of game it is. For an RTS, the answer is b).

Other options include rendering faster than your game physics runs (i e, only pay attention to user input every 50 ms, but render every 20 ms), or increasing your network rate to match your physics rate.


Its RPG style game play with lots of players (500+ eventually). Do you reckon a) would be best (sending at 50ms), this would ensure that I dont have to put players through the main game engine more than once each server tick.

Share this post


Link to post
Share on other sites


If you can, decouple your actions/results from exact timing (see how other online games handle this). The effects are usually more important to the player than the precision of the representation. (depends on your game -- new ones with physics and more complex interactions are going to face major problems syncing up
positions and poses). The different clients and the server(s) are all on different timelines with lag variations and inconsistancies.

The time problem pretty much makes resolving split second interactions unworkable.

You may only be able to have the server process interactions for non-interacting actions as fast as they come in (to minimize the feedback delay) and on something like a .250 second resolution for more complicated interplayer interactions (where moves and countermoves have significance). Positioning will have to have some looseness where validation tests will likely have to be made against a recent history of move step vectors.

Share this post


Link to post
Share on other sites

This topic is 3860 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