cscorley / bevy_ggrs_rapier_example

MIT License
45 stars 4 forks source link

suggestion: is it possible to use TimestepMode::Interpolated instead of limiting fps to 60? #31

Open soupslurpr opened 9 months ago

soupslurpr commented 9 months ago

From what I see from experimenting with it in a simple test game (not this example) the physics collider seems to update to the dt that is set but visually it is interpolated to the current fps? Also thanks for this really cool example :)

cscorley commented 8 months ago

Hmm, maybe. I used to think this was the cause of some of my very early desync issues, but perhaps it was all derivative of other fixes I've implemented since. Just a brief check using the below value instead seems to work. However, I am cautious of doing anything outside of the Fixed timestep mode, just because I know there is special handling for Interpolated in the engine. I think it may cause desync issues on two different machines (I only tested locally with simulated lag), but I'm not entirely familiar with the feature. It may be working by accident of how GGRS handles time with Time -- and the time that Rapier is calculating (I am woefully unclear on how various Time mechanisms work in Bevy).

timestep_mode: TimestepMode::Interpolated {
    dt: 1. / FPS as f32,
    substeps: 1,
    time_scale: 1.0,
},