Advertisement

Frame Rate in online games

Started by May 20, 2006 12:23 AM
3 comments, last by hplus0603 18 years, 9 months ago
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?
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.
Advertisement
So what should the delay between packets be?
33ms to simulate the player running at the speed set initially by 30 fps?
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.
enum Bool { True, False, FileNotFound };

This topic is closed to new replies.

Advertisement