Delta Interpolation Issues

Started by
4 comments, last by harshman_chris 11 years ago

So I am working on fixing an issue with my game loop and my particle systems which run fine on my average power laptop, but run really fast on my home desktop which is on the upper end of powerful for home PC's

I have the issue narrowed down on the fast computers to being delta when multiplied with my force then added to my velocity (which before this was 0). I get this happening (see attached)

My Final Velocity Value

[attachment=14654:velocityvalues.png]

My Input Force

[attachment=14653:Forcevalues.png]

My Input Delta

[attachment=14652:Deltavalue.png]

So the question is how do I solve this so that this doesn't happen?

Advertisement
Do you have a fixed vsync? If your desktop is higher end, then make sure you're not running at 120fps. You probably already checked this, but if your delta is higher on your desktop than on your laptop, then there is some inconsistancy other than the speed difference of the processors. Clocks are clocks and (whithin reason) they all click at 1ms intervals. Look at CLOCKS_PER_SEC to be sure. On second thought, what ARE you using to get your Delta?

Do you have a fixed vsync? If your desktop is higher end, then make sure you're not running at 120fps. You probably already checked this, but if your delta is higher on your desktop than on your laptop, then there is some inconsistancy other than the speed difference of the processors. Clocks are clocks and (whithin reason) they all click at 1ms intervals. Look at CLOCKS_PER_SEC to be sure. On second thought, what ARE you using to get your Delta?

I use QueryPerformanceCounter and QueryPerformanceFrequency and delta is calulated like this:


delta = (float)((currentTime.QuadPart-lastTime.QuadPart) / PCFreq);

I am also using OpenGL, and not DirectX

I am pretty sure it has to do something with the float values being 'messed up' when they are so small.

I reread your first post three times, and I can't find anything wrong with what you posted. Why do you think the problem is in the line of code you showed us? Are you multiplying the velocity by delta before you add it to the position?

I am pretty sure it has to do something with the float values being 'messed up' when they are so small.

Float values do have inherent error involved when they are VERY big or VERY small. The values you showed were neither. Sorry I don't know OpenGL. Where are you getting PCFreq? Is it part of the performance counter? If so, then it should take into account the PC/OS specific values for the clock. Do a check with both PCs. Have your program display the "time between frames". The TBF should be the same on both machines if the PCFreq is the same (or close). If you are running at 60fps on both machines then the TBF should always show ~16.6666666667 (on average). You will most likely see this number fluctuate between 16-17 depending on processor load.

So, to sum up:

Test both computers for 60fps and TBF.

I was going to post more info, but then I solved it. There was an issue with my game that was messing up my delta.

This topic is closed to new replies.

Advertisement