#### Archived

This topic is now archived and is closed to further replies.

# Discrete time interval problem

This topic is 5645 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

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?

##### Share on other sites
Look for stuff about different methods of integration. Search the physics forum.

For running a simulation between computers, you can just have them both agree on a time step before updating with it.

##### Share on other sites
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.

##### Share on other sites
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.

##### Share on other sites
quote:
Original post by higherspeed
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.

That''s not entirely true. Physics can be done in real time, with non linear forces, and even simple fluid dynamics. "For running a simulation between computers, you can just have them both agree on a time step before updating with it."
Yes, a faster computer may idle a little bit while waiting for slower ones, but this is what almost all RTS games do at the moment.

All modern FPUs should produce the same results as long as they use the same precision.

##### Share on other sites
Hi all,

Surely you guys know how to "cheat"?

Example: Collision with discrete timestep...half the collisions are missed so back up time, solve the diff. equs.....and so on...

OR

Simply check if the particle has passed through to object (simple dotprod. check with the plane and edge normals ) then push it onto the surface. Resolve the collision at that pos an move onto the next particle.

Of course this isn''t accurate physically but visually you can''t tell the difference running a 60fps (well 24-25 that we notice)

And its true that nowdays fluid simulated physics is starting to appear in many games...real simulations and not the fakes I just mentioned :-)

Particles for rain and sparks has been used in games since before T&L. Now with T&L we''re starting to see some *real* physics in action...

Catch ya!

1. 1
Rutin
26
2. 2
3. 3
4. 4
5. 5

• 9
• 11
• 10
• 13
• 20
• ### Forum Statistics

• Total Topics
632948
• Total Posts
3009389
• ### Who's Online (See full list)

There are no registered users currently online

×