Sign in to follow this  
harshman_chris

Delta Interpolation Issues

Recommended Posts

harshman_chris    184

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?

Share this post


Link to post
Share on other sites
Hawkblood    1018
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?

Share this post


Link to post
Share on other sites
harshman_chris    184

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

Share this post


Link to post
Share on other sites
alvaro    21266
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?

Share this post


Link to post
Share on other sites
Hawkblood    1018

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.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this