honehone12 / bevy_netphys_dev

0 stars 0 forks source link

client simulation is too fragile #4

Closed honehone12 closed 2 months ago

honehone12 commented 2 months ago

(this is just note for me) i learned physics's determinism can be easily broken through network. the reason is that simulation is always advancing and same timing of simulation will never come. it can be used only if...... , small amount of rigid body, not so fast velocity, without hard collisions, short time simulation. otherwise we have to correct a lot of prediction error and cause lower level problems like network spikes. (i have not implemented yet but am playing the game full of simulation stopping and teleporting) from my view, we should avoid client simulation, and for immediate interactive objects we should use another deterministic movements like tween.

honehone12 commented 2 months ago

of course this is about client-server model https://github.com/honehone12/bevy_replicon_bootstrap/issues/7

honehone12 commented 2 months ago

i added velocity sync kinematic rigid body option. this still has strange behavior (comes from omit of collision), but this looks much better than client simulation in terms of client prediction.

honehone12 commented 2 months ago

i changed client predicted RB into velocity synced dynamic RB. it looks very nice prediction even without position correction and on 10 network HZ. also i removed enhanced determinism option from rapier.