• Create Account

## Delta Interpolation Issues

Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

5 replies to this topic

### #1harshman_chris  Members

Posted 04 April 2013 - 11:57 AM

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

My Input Force

My Input Delta

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

### #2Hawkblood  Members

Posted 04 April 2013 - 12:24 PM

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?

### #3harshman_chris  Members

Posted 04 April 2013 - 12:52 PM

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.

Edited by harshman_chris, 04 April 2013 - 12:56 PM.

### #4Álvaro  Members

Posted 04 April 2013 - 12:57 PM

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?

### #5Hawkblood  Members

Posted 04 April 2013 - 01:15 PM

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.

### #6harshman_chris  Members

Posted 04 April 2013 - 01:30 PM

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.

Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.