lucaspoffo / renet

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

Support custom scheduling and system ordering for Bevy. #137

Open starwolfy opened 9 months ago

starwolfy commented 9 months ago

Two features would allow for custom scheduling inside a Bevy loop:

  1. Pass Schedules to RenetServerPlugin and RenetClientPlugin and pass it to plugin configurations to replace hardcoded PreUpdate and PostUpdate schedules. bevy_xpbd implemented support for custom schedules the same way.
  2. Create a publicly accessible SystemSet and add them to important renet systems such as send_packets. So user code can use and configure the execution order of these sets within their own app.

A user may also desire to run systems with the currently hardcoded PreUpdate and PostUpdate schedules in the same schedule. In this case the plugin systems ordering must strictly rely on the SystemSet by configuring App with configure_sets to chain the elements of the SystemSet in the desired order.

UkoeHB commented 9 months ago

Create a publicly accessible SystemSet and add them to important renet systems such as send_packets. So user code can use and configure the execution order of these sets within their own app.

There is RenetReceive and RenetSend, with an open PR #134 to improve the situation further.

I agree that injecting the schedules would be useful.

starwolfy commented 9 months ago

I did not know about RenetReceive and RenetSend. This makes my request for more system sets unneeded. Still though, being able to pass any schedule is still something powerful that is missing. This may put systems currently separated by schedules (PreUpdate, PostUpdate) into the same schedule if the user desires. To maintain the intended system order perhaps a SystemSet that simply has two Pre / Post elements for systems would suffice.