Questions: When we draw with interpolation, where should the collision detection code be? Is it worth implementing interpolation in the following situation?
This is for Scrolling Asteroids. I have my game working at the moment without interpolation. It does physics updates using fixed step time deltas. The frame display rate is decoupled from this. So, it might be doing 40 Physics updates per second and 75 frame draws per second. Up until now, it is in the physics update routine that I do the collision detection and response. Your ship can collide with a rock. Your photons (bullets) can collide with a rock.
Now I am considering improving it to use interpolation as per all the good articles recommend:
So when this is implemented, I might be making the following calls:
update(dt) draw(0.24) draw(0.64) update(dt) draw(0.24) draw(0.76)
The floating point numbers shown are examples of actual calculated interpolation value i.e. the proportion of the physics update that is complete at the time the frame is being drawn. I am going to have to change the draw code to draw the objects at a fraction of the distance between their previous and current value positions and rotations. That is yet to be done.
Question: Will I also have to do move my collision detection code out of the update routine and into the draw routine, seeing as I will be drawing these interpolated frames ?
Bear in mind, my highest priority goal is to make this networked: multiple player ships on as large a Universe as possible. So a physics update solution that is compatible with the networked game that is required. Is the interpolation worth the effort? Right now. I rarely if ever see a problem with smoothness. If I reduce my physics updates to 25 per second which I have only done as an experiment then it is a bit jerky. But the game easily runs at higher rates than that so there may never be a problem.
So the two questions:
- Collision detection where?
- Is introducing interpolation worth the effort or should I proceed to networked version straight away?
Thanks in adance: