gschup / ggrs

GGRS is a reimagination of GGPO, enabling P2P rollback networking in Rust. Rollback to the future!
Other
501 stars 25 forks source link

Use with no predictions #60

Open progre opened 10 months ago

progre commented 10 months ago

Is your feature request related to a problem? Please describe. I want to set prediction to 0. Currently it crashs with max_prediction 0 or 1.

Describe the solution you'd like I wish ggrs supports no predictions.

Describe alternatives you've considered Currently I implement on udp without ggrs, but it needs to newly implement delays, synchronize, resend, and others.

Additional context This would be useful when it is difficult to provide savestate, ex; unofficial netbattle project.

gschup commented 10 months ago

Hi, thanks for the feature request!

I was unable to replicate a crash with max_prediction set to 1, the p2p example works for me.

I was able to replicate the crash when max_prediction is set to 0. With the way inputs are currently handled, there is no trivial way to include "lockstep" functionality without any predictions. I will see If I can find an elegant way to make it work. But no promises :)

progre commented 10 months ago

Thanks for your reply. I set max_prediction to 1, it crashed when one peer disconnected.

gschup commented 10 months ago

So far, I was not able to reproduce a crash with the p2p example with two players and max_prediction set to 1 when disconnecting one peer. Please let me know if you have any further info!

progre commented 10 months ago

OK. What I did was add .with_max_prediction_window(1); to the sample, https://github.com/gschup/ggrs/blob/main/examples/ex_game/ex_game_p2p.rs#L49

started the program as documented, https://github.com/gschup/ggrs/blob/main/examples/README.md?plain=1#L40

and, after the number of frames in both windows had been counted up, I used Ctrl+C to terminate the program.

Tested on windows & mac, rustc v1.72.0

gschup commented 1 month ago

PR #79 will enable lockstep behaviour without any predictions.