what happens when timestep goes big ?

Started by
4 comments, last by maun 21 years, 5 months ago
I wonder what you guys do with your physical stuffs when the timestep goes big (when the framerate suddently falls) ??? It''s a very open question as I haven''t found yet a valuable solution (setting the timestep to a max value isn''t a valuable solution in my opinion...) any ideas ?
Advertisement
I handled it by chopping the elapsed time into 100ms chunks and calling the behavior routine over and over until the time was consumed. That way anything travelling in a curve wasn't thrown too far off.

Diablo 2 handles it by locking the frame rate at around 30 (meaning everything operates on an elapsed time of 33ms or so), I think, so that if a slowdown occurs, you suddenly see everything catching up quickly to work its way back up to where it would have been without the slowdown.

If you can calculate everything accurately based ONLY on time, OR lock everything to behave with a constant elapsed time (like Diablo 2 did), it shouldn't throw anything off. Otherwise, chop up the elapsed time and call the behavior routine multiple times to consume it until everything is caught up.

That's my two cents.

EDIT: For collision detection, I prefer to calculate for a point of collision given two shapes and their travel paths (such that if so much time elapses that two objects actually pass through and beyond each other - I'm not checking for their geometries to intersect at the current point in time, I'm checking for a point of collision along their paths. That way, I'll detect a point of collision no matter how much time elapses.)


[edited by - Waverider on October 22, 2002 11:49:03 AM]
It's not what you're taught, it's what you learn.
quote:Original post by Waverider
EDIT: For collision detection, I prefer to calculate for a point of collision given two shapes and their travel paths (such that if so much time elapses that two objects actually pass through and beyond each other - I''m not checking for their geometries to intersect at the current point in time, I''m checking for a point of collision along their paths. That way, I''ll detect a point of collision no matter how much time elapses.)


Is this in 3d or 2d? Do you have rotation in your objects? Are you calculating intersections of bounding spheres, boxes, or actual geometry?

I''d love to hear how you did it, since I ran into a similar issue and ended up using the binary search method(See Orielly''s Physics for Game Developers).
I haven't done it yet with objects that are also rotating. Most collision detection I've done is between two spheres only, on a linear path from one frame to the next. I once tried to formulate collision detection between a vertical cylinder and a static BSP level, but never quite got there.

I have not yet endeavored to solve the problem with complex, rotating geometry. Frankly I'm not sure how to calculate the point of impact that results from two objects rotating into each other!

The collisions I was working with were in 3D.

Basically, for two spheres of radius r1 and r2, I just solved for the point at which the two centers, travelling along their linear paths that frame, were of distance (r1 + r2) from each other. I solved for the earliest non-negative time t, and as long as t was less than the elapsed time during the frame, there was a collision. The parameters for the collision function where their initial positions at the beginning of the frame, their velocity vectors and their radii.

Since I'm solving for t, not only do I know exactly when they collided, I know where. That allows me to accurately redirect their velocities during the collision based on their position in relation to each other and move them to the correct place before the frame is rendered, which would also work well for a billiard game, for instance.


[edited by - Waverider on October 24, 2002 4:19:49 PM]

[edited by - Waverider on October 24, 2002 4:21:18 PM]
It's not what you're taught, it's what you learn.
Personally if the game isn''t responding to input then nothing should happen.
Keys to success: Ability, ambition and opportunity.
I agree with LilBudy.

I have my timestep locked at 10 ms, and if my framerate drops to low I just skip some updates. Otherwise, it will be running while the player can''t see it, with the possibility of doing things without giving the player a chance to react.

(I''m using 10ms because it''s small enough that I don''t need to interpolate positions between frames. Call me lazy.)

This topic is closed to new replies.

Advertisement