Closed cBournhonesque closed 1 year ago
Thanks for the bug and branch to repro :+1:
I noticed that in your example, you are consuming movement events and sending them to the Server in a parallelized system, that may be running as quickly as events come in. When the Client is on a Tick boundary, this system could trigger several times, but then finish quicker than a system that started before it? That's what I was seeing anyway: a Message from an earlier Tick would get sent via Client.send_message()
, which is unexpected behavior for a TickBufferChannel.
In https://github.com/naia-lib/naia/pull/130 I turned that panic message into a more helpful warning instead, and now simply don't proceed with the sending the Message if it's from a past Tick.
The TickBufferChannel can only transmit 1 Message every Tick, so the ideal is to send the Message in the Tick stage set up for that (like in https://github.com/naia-lib/naia/blob/5766d0bac655ca019ea9b46aff3941599a65434b/demos/bevy/client/src/systems/tick.rs#L32)
I tried changing my InputChannel to use a TickBuffered channel instead of OrderedReliable and my app crashed with the error:
My input system (on client) is:
Do i need to make other changes? For example use a Queue + CommandHistory like in the bevy example? Also, using the OrderedReliable felt definitely more responsive than the InputBuffered channel (under good network conditions)
@connorcarpenter you can reproduce it in my repo, branch
cb/naia-input-bug
. The command to run the client or the server isRUST_BACKTRACE=full RUN_MODE="powerline" cargo run --features "dynamic" --target-dir ../target-dynamic
(might take a while to compile though!)