lucaspoffo / renet

Server/Client network library for multiplayer games with authentication and connection management made with Rust
Apache License 2.0
622 stars 66 forks source link

Limit syncing? #70

Closed tigerplush closed 1 year ago

tigerplush commented 1 year ago

Hey,

I'm currently just trying out your library and it is amazing, thank you - but I've run into an issue:

I'm sending a transform to the server over the Default UnreliableChannel who then sends it back to every player. Within seconds, even with one player, messages get dropped - could you point me in the direction as to why that is?

lucaspoffo commented 1 year ago

Hey,

Is the server using the MinimalPlugin instead of the DefaultPlugins? When you use this option, the server runs at an unlimited frame rate, you need to add the scheduler settings with:

 .insert_resource(ScheduleRunnerSettings::run_loop(Duration::from_secs_f64(
            1.0 / 60.0,
 )))
.add_plugins(MinimalPlugins)

Make sure the resource is inserted before the plugin

tigerplush commented 1 year ago

Sadly that didn't help :/

warning is WARN rechannel::channel::unreliable: Received message was dropped in unreliable channel 1, reached maximum number of messages 256

my main looks like this:

    App::new()
        .insert_resource(Players::new())
        .insert_resource(ScheduleRunnerSettings::run_loop(Duration::from_secs_f64(
            1.0 / 60.0,
        )))
        .add_plugins(MinimalPlugins)
        .add_plugin(LogPlugin::default())
        .add_plugin(AssetPlugin::default())
        .add_plugin(ServerPlugin)
        .run();
tigerplush commented 1 year ago

I'm silly, I didn't iterate over receive_message(), when I do that it works

tigerplush commented 1 year ago

as soon as I add

        while let Some(raw_message) = server.receive_message(client_id, DefaultChannel::Unreliable) {
        }

The server can keep up