Announcement

Collapse
No announcement yet.

Basic game development question: What happens with moving objects when a huge framedrop occures?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Basic game development question: What happens with moving objects when a huge framedrop occures?

    Hello,

    say you move a sphere on a straight line with 200 m/s in x-direction and another one with 200 m/s in y-direction. If the frame rate is high, they would hit each other (given the correct starting locations). But what if right before the collision a framedrop occures and the next frame needs 1 second to calculate? Would'nt both spheres miss each other? Otherwise, after the second you could start with the calculations one second before and "catch up" the missing calculations. But this, if the calculations are complex, could lead to a new framedrop...

    This may also have to do with multiplayer prediction (?). Is this issue even fully solvable or do we have to live with the fact that frame drops will "mess up" the world so that it with much moving objects and a low frame rate and/or frame drops a world wouldn't look after 5 seconds like the same world with a high frame rate and without frame drops?

    Thanks,

    Thilo

    #2
    For physics it calculates on a different rate than the framerate, exactly for that reason, but it can still get some errors in certain situations. There's also substeps so that it can calculate collisions at a higher rate than that. That's why there's problems with level size, because of the limit of a 32 bit float value the physical units can only get so big so at a certain distance from the origin it loses precision.

    Comment


      #3
      Basically with substep default settings,at a moving speed of above 300kph the physics already perform poorly..
      You get many hit/miss when it comes to detecting overlaps.
      However they are independent of frame rate.

      meaning a frame drop won't really affect their positioning or colliding/not colliding if you let the physics handle things.

      if you are somehow using ontick to manually detect the hit. Then yes, your reading may be inaccurate. Surely not as accurate as the physics driven response because of substep.

      Also, let's not forget a simple fact.
      you already know before hand if a hit has occurred. You just don't know when exactly but you can easily solve it From the very start without actually relying on PhysX

      If you line trace from sphere A forward on a forward vector of say 10000, and you get a hit, you know that if the travel is kept constant the spheres will hit.
      The math for where and when they hit is simply speed over time on both A and B given they face each other in your example. (Speed/time B - speed/time A, i suppose).

      when both results match up you have the hit point and the time it will occur.

      How is that relevant?
      well, you can write network code that already knows if objects will hit and only redetermines the situation if external factors come into play.
      Direftional changes, player or object intersections, etc.
      Last edited by MostHost LA; 07-21-2020, 06:01 PM.

      Comment

      Working...
      X