Sign in to follow this  
Fixxer

Frame Rate in online games

Recommended Posts

I have my game set to run at max frame rate, and regulation player movement like this.
	iUpVechVelocity = 7*(30.0/dbScreenFPS());
	iDownVechVelocity = -5*(30.0/dbScreenFPS());
	iStrafeVechVelocity = 5*(30.0/dbScreenFPS());
	iRunDownVelocity = -6*(30.0/dbScreenFPS());
	iRunUpVelocity = 10*(30.0/dbScreenFPS());
	iRunStrafeVelocity = 7*(30.0/dbScreenFPS());

Will it be ok if I send packets of players position no matter what fps each user is at within reason? I know that if the frame rate is like 15 there will be lag over the network with somone running 60 fps. Assuming i lock a min frame rate to play at 30 fps, how do I prepare my game for some one with 30fps to play with some one at 75 fps?

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
If your FPS is locked to your network or vice-versa, STOP NOW, because there is something horribly wrong with what you're doing. Sending a position update per frame is just short of nuts.

Share this post


Link to post
Share on other sites
I don't really see a problem with someone running at a higher fps with the code you provided.

Just make sure you are sending packets at a fixed rate and make sure the client is sending packets at the rate expected by the server.

Share this post


Link to post
Share on other sites
The "most correct" solution is to de-couple the simulation from the rendering. Settle on a simulation frame rate (say, 30 fps), and then stick to that. Meanwhile, run rendering as fast as it can, using either interpolation between the last two simulation frames, or extrapolation from the last simulation frame to derive the intermediate frame states.

The Canonical Game Loop explains this in more detail.

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