Jump to content
  • Advertisement
Sign in to follow this  
ronkfist

Deterministic model

This topic is 4400 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi, I had implemented a frame synchronization system with variable stepping size, but this had a few annoying problems like not being deterministic and jittery network synchronization. So I decided to implement a system with a fixed stepping size using interpolation. It's running pretty smooth, but I'm not sure if im doing it completly right because when objects move really fast and collide they appear to be "inside" eachother. This is only a visual problem tho, the collision response is still like before. So because its a visual problem I might be doing the interpolation wrong, this is how I do it now: - objects have 2 positions. 1 physical and 1 visual position. - linear interpolation. (should I change to splines or something else?) After the physics are executed I calculate a new interpolation path (with lineair interpolation this just involves backing up the old visual position) and while drawing I interpolate between this backed up visual position and the new physical position. Is this how it should be done? Or should I try to interpolate between the backed up visual position and the "real" physical position(like when youd use a variable time step)?

Share this post


Link to post
Share on other sites
Advertisement
Quote:
Original post by ronkfist
Hi,

I had implemented a frame synchronization system with variable stepping size, but this had a few annoying problems like not being deterministic and jittery network synchronization. So I decided to implement a system with a fixed stepping size using interpolation.

It's running pretty smooth, but I'm not sure if im doing it completly right because when objects move really fast and collide they appear to be "inside" eachother. This is only a visual problem tho, the collision response is still like before.

So because its a visual problem I might be doing the interpolation wrong, this is how I do it now:

- objects have 2 positions. 1 physical and 1 visual position.
- linear interpolation. (should I change to splines or something else?)

After the physics are executed I calculate a new interpolation path (with lineair interpolation this just involves backing up the old visual position) and while drawing I interpolate between this backed up visual position and the new physical position.
Is this how it should be done?
Or should I try to interpolate between the backed up visual position and the "real" physical position(like when youd use a variable time step)?


You have your current position P and your Target position T and then your render position R

R = P + T*(time interpolation)

Like you said you could change it to this..
R = Previous Position + P*(time interpolation)
But this would mean the unit is lagging behind in time?

The smart way to do it is to find your new position using your physics, then using your current velocity find the position the unit will be next frame and do the physics for that position as well.

Basically you have to do the collision detection for the Target position aswell.


Share this post


Link to post
Share on other sites
After executing the physics, each object has a new "physical" position(T), then to render I should interpolate between the current "visual" position(P) and T right?

The strange thing is when "vertical sync" is enabled it seems to jump a little, but when I turn it off it runs smooth, any idea why?

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!