Skip to content

Comments

Use renet master#10

Closed
Olle-Lukowski wants to merge 5 commits intosimgine:masterfrom
Olle-Lukowski:use-renet-master
Closed

Use renet master#10
Olle-Lukowski wants to merge 5 commits intosimgine:masterfrom
Olle-Lukowski:use-renet-master

Conversation

@Olle-Lukowski
Copy link

I talked to Shatur on discord about this issue, I personally don't quite understand it but I tried updating replicon to use renet main branch. I fixed all but one compile error, which you can see below.

Compiling bevy_replicon v0.3.0 (D:\BevyProjects\bevy_replicon-use-renet-master)
error[E0425]: cannot find value `client_connecting` in crate `bevy_renet`
  --> src\client.rs:31:45
   |
31 |                         .run_if(bevy_renet::client_connecting)
   |                                             ^^^^^^^^^^^^^^^^^ not found in `bevy_renet`

For more information about this error, try `rustc --explain E0425`.
error: could not compile `bevy_replicon` due to previous error

@Shatur
Copy link
Contributor

Shatur commented May 16, 2023

Thank you!
I looked briefly, looks like client_connecting check was removed from renet. Let's just provide our own:

pub fn client_connecting(client: Option<Res<RenetClient>>) -> bool {
    match client {
        Some(client) => client.is_connecting(),
        None => false,
    }
}

@Olle-Lukowski
Copy link
Author

It seems that client.is_connecting was also removed:

Compiling bevy_replicon v0.3.0 (D:\BevyProjects\bevy_replicon-use-renet-master)
error[E0599]: no method named `is_connecting` found for struct `bevy::prelude::Res<'_, RenetClient>` in the current scope
  --> src\client.rs:21:32
   |
21 |         Some(client) => client.is_connecting(),
   |                                ^^^^^^^^^^^^^ help: there is a method with a similar name: `is_connected`

For more information about this error, try `rustc --explain E0599`.
error: could not compile `bevy_replicon` due to previous error

@Shatur
Copy link
Contributor

Shatur commented May 16, 2023

Interesting... I think that there should be a way to check if client is connected or not.

@Shatur
Copy link
Contributor

Shatur commented May 16, 2023

Probably you could use is_connected and assume if the client is exist and not connected - it's connecting.

will test this in my own project
@lucaspoffo
Copy link

lucaspoffo commented May 16, 2023

Hey,
If you are using the master version, you need the transport plugins NetcodeServerPlugin and NetcodeClientPlugin, and add the resources NetcodeServerTransport and NetcodeClientTransport.

Also, I just added the helper for client_connecting, this check is made with the transport layer now.

@lucaspoffo
Copy link

lucaspoffo commented May 16, 2023

Also, in the channels config using resend_time with Duration::ZERO, is not ideal. I think 300ms should be better. With 0ms there is no wait time to resend messages - they are resent every tick - this can increase in a lot the channel bandwidth usage.

@Olle-Lukowski
Copy link
Author

Olle-Lukowski commented May 16, 2023

Alright, I implemented those things locally and they work! It resolved my original issue with not handling many entities too! I dont know how to implement them into replicon, but at least I managed it in my own project.

@Shatur
Copy link
Contributor

Shatur commented May 16, 2023

I dont know how to implement them into replicon, but at least I managed it in my own project.

Just submit your changes and apply clippy warnings, CI will pass if everything is okay.

@Olle-Lukowski
Copy link
Author

The changes are local to my bevy game, I meant I dont know how to integrate it into replicon

@Shatur
Copy link
Contributor

Shatur commented May 16, 2023

The changes are local to my bevy game, I meant I dont know how to integrate it into replicon

You mean that you need to configure resend_time? I probably should expose it to users.

@Shatur
Copy link
Contributor

Shatur commented May 20, 2023

Migrated in 826d0c2

@Shatur Shatur closed this May 20, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants