Closed pmikolajek closed 7 months ago
This should be fixed by c8485040e32de483a6c7f398a22cdedf72088c0d
Now we have the system emit_server_events_system
just to emit the events. The transport layer now updates before this new system and disconnect/connect events shouldn't have a one frame delay.
If you have a custom transport you should update it before the new system.
This is an issue when using
bevy_renet
.Assuming a standard plugin setup:
renet
will already broadcast messages to a newly connected client for a single tick before sendingServerEvent::ClientConnected
bevy event. This means the game doesn't have the opportunity to react to the client joining first.The flow is as follows:
The issue comes from the fact that in
NetcodeServerPlugin
, the update method is set to run after the one fromRenetServerPlugin
:So during the first tick, RenetServerPlugin does not have any events to send.
Expected behaviour
After a new client connects,
ServerEvent::ClientConnected
should be sent beforesend_packets()
is called. This would allow the game to react to the new arrival before sending them any messages.