Re:Game Timers: Issues and Solutions (2012)
by mLuby on Tuesday August 17, 2021 @08:46AM
(#28209248)
Regarding "missing" a collision due to the delta-time being too large, I thought the game industry standard is to "backtrack" (in math, not in ticks) to determine the correct collision point and go from there. Granted, that is a bit more complicated than just keeping the delta-t/tick consistently small, but it is more correct.
[ Parent
| on HN ]
Re:Game Timers: Issues and Solutions (2012)
by kevingadd on Tuesday August 17, 2021 @08:47AM
(#28209255)
Before you can back track, you need to first recognize that you missed a collision
Re:Game Timers: Issues and Solutions (2012)
by mLuby on Tuesday August 17, 2021 @10:02AM
(#28209958)
Could be—it's been a while since I read about the technique.
I thought a game engine doing this figured out the collisions when the trajectories changed so then it's just a matter of rendering those known effects (rather than the more naive approach of checking each tick or frame whether anything's collided). Note that doing this at impulse can cause the game to slow down when many objects are moved at the same time, like an explosion. I think it works pretty well because most game objects are stationary, or even immovable; also moving objects are rarely subject to new accelerations—they stay ballistic.
But IANAGameDev, so do correct me if you know something about this technique.
t=0
cube1 p=5,0 v=0,0 m/s
cube2 p=1,0 v=2,0 m/s
// Game knows cube1 and 2 will collide at t=2
t=1
cube1 p=0,0 v=0,0 m/s
cube2 p=3,0 v=2,0 m/s
cube3 p=0,0 v=5,0 m/s
// Game knows cube1 and 2 AND 3 will collide at t=2
t=2
all cubes hit at 5,0
Re:Game Timers: Issues and Solutions (2012)
by plopz on Tuesday August 17, 2021 @11:36AM
(#28211042)
Its pretty difficult to do quickly and with numerical robustness, specifically when you have rotation. Here's a talk by the creator of Box2D while he was working for Blizzard on continuous collision detection.
Re:Game Timers: Issues and Solutions (2012)
by mLuby on Tuesday August 17, 2021 @02:04PM
(#28212936)
Thanks, that was an interesting talk. Apparently what I was describing is "time of impact" as that talk describes here: https://youtu.be/7_nKOET6zwI?t=495
Re:Game Timers: Issues and Solutions (2012)
by formerly_proven on Tuesday August 17, 2021 @10:22AM
(#28210154)
A lot of game physics engines are still pretty bad at this, which is why being able to clip through walls is such a common issue. Even in games where the physics are more or less solid, there are usually many bugs where fixed animations allow clipping through stuff (e.g. cover or hurdle-jumping animations), because those simply don't interact with the physics engine at all - you only need to get to a start point that places the animation's end point out of bounds and be able to trigger the animation.