# 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 on other sites
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 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 on other sites
So what should the delay between packets be?
33ms to simulate the player running at the speed set initially by 30 fps?

##### 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.

## Create an account

Register a new account

• ### Forum Statistics

• Total Topics
628300
• Total Posts
2981894

• 9
• 9
• 11
• 10
• 10