Skip to main content
gamedev.net
🔒 Locked

Updates per second?

Started by nickwinters Jan 9, 2004 at 2:16 AM 1 replies 400+ views
Original Post
nickwinters
nickwinters
How often would you say everything in a game should be updated? I''m estimating about 60 fps for the game. Originally I was thinking of running the game logic 10 times per second, with every command being acted upon 2 updates later, to account for network lag. I know this would work fine for an RPG, but how about for an action game? Is this too slow? And since the positions are only changed every tenth of a second, wouldn''t the movements look a bit choppy? Are there ways around this? Thanks. -Nick
Max_Payne
Max_Payne
You don''t need a fixed number of updates per second.

Quake 2 worked with 10 updates per second for all the game logic, and Carmack himself said it was a bad design decision... Quake 3 didn''t have a fixed update rate, but that led to some maht problems... The reason those problems were encountered is because Id Software did alot of integer math on positions and vectors.

If you use floating point for all vectors and positions, you shouldn''t have a problem working with a non fixed update rate. I find it quite lame to expect a fixed update rate, its just not possible to sustain at all times and its a hack.

There is a very easy way around. All you need is a timer system that can calculate a delta time between frames (in seconds). You simply need need to update the timer once per frame and calculate the difference between the time of this frame and the time the timer was updated the last frame.

You can then do things like this for moving objects:

Position += Velocity * Timer.GetDeltaTime();

Position and velocity being 3D vectors with floating point components and Timer.GetDeltaTime(), an inlined function returning a precalculated floating point delta time value in seconds.



Looking for a serious game project?
www.xgameproject.com

Looking for a serious game project?
www.xgameproject.com

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.