Skip to main content
GameDev.net gamedev.net
🔒 Locked

Discrete time interval problem

Started by drslush May 2, 2003 at 7:32 PM 4 replies 500+ views
Original Post
drslush
drslush
I''ve been using discrete time intervals for all my physics since I started programing. It works fairly well most of the time, but for some things, I end up loosing quite a bit of information due to sampling over discrete time intervals. It also presents a problem of different computers running at different speeds calculating differnt results. I know there are better ways of doing this. Can anyone point me to some articles or websites, or tell me what to search for?
oliii
oliii
when you''ll introduce collision, you''ll get all sorts of problems added to it, and I don''t think you can get away with doing physics simulation with proper collisions and without discreet time intervals. The fact that it gives different results on different machines is probably down to the different fpus and timing on your processors. You''d have to go to an analytical approach, and increase the math precision as much as you can (using doubles?).

try a higher order integration. try fixed time steps instead of accurate timers (the simulation will run at different speed on different machines, but the calculation results will be more in sync), Run tests (log them and plot comparative graphs) with different time intervals (60 fps, 100 fps, 200 fps), see how far they diverge from each other. The smaller the time step, the better, obviously. But see how different integration algorithm diverge.

try an analytical approach instead of discreet intervals, to find the exact position of a particle at a given time. That would work for a very simple, and non colliding, particle system.
Everything is better with Metal.
higherspeed
higherspeed
I''ve managed to get as far as particles, but just travelling linearly, with collisions and a resistive force proportional to the velocity, without using a timestep. I think without the drag and with a constant acceleration, producing a parabola wouldn''t be out of bounds.

But really there''s no point in games. Even though it would have system independant results and the only error coming from the variables themselves.

Anything more complicated would require solving complicated differential equations, by iterative methods, which certainly would be a waste of time for games.


If you just want system independant results and you want them that badly, set a constant timestep. Faster computers would just miss out a frame if it''s too quick, slower computers would have to iterate physics multiple times per frame.

Topic Locked

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

Sign in to reply to this topic.