cBournhonesque / lightyear

A networking library to make multiplayer games for the Bevy game engine
https://cbournhonesque.github.io/lightyear/book
Apache License 2.0
414 stars 42 forks source link

Lightyear breaks down if the fps becomes too low? #593

Open cBournhonesque opened 1 month ago

cBournhonesque commented 1 month ago

Example raised by simbleau.

Symptoms:

TODO:

Nul-led commented 3 weeks ago

Is this related to a specific platform / transport?

cBournhonesque commented 3 weeks ago

It was on web, with webtransport. basically when they open the inspector, the FPS of their game drops and then the latency keeps climbing and the game becomes overall unplayable

Nul-led commented 3 weeks ago

Would be nice to test if this happens on other platforms/transports too otherwise it might be an issue with xwt / lightyears integration of it

simbleau commented 3 weeks ago

I'd guess it's not specific to xwt because everything is solid under normal circumstances. It's only when the FPS is too slow, and updates begin to pile up quicker than they're being processed. It's like a weird death spiral.

My game runs at 10fps when the console is up and printing logs, or 30-40fps in debug mode without the console. Opening the console was just a convenient way to reproduce a low fps.

The rollbacks don't make much sense to me, or I'm misunderstanding how they work. I believed the default redundancy of packets is 10, meaning as long as you don't drop 10+ packets in a row, you should never see a rollback. I am buffering inputs every update, e.g. the framerate. My input send rate is 10Hz. With a packet redundancy of 10, I wouldn't expect a rollback to happen unless the latency is at least 1 full second (0.10s * 10 packets). My input is fully deterministic as well. Instead, it's constant rollbacks when the FPS is low, (<20fps).