Shared authority over a component #1109
-
|
Hi again! Is it possible to "share" authority over a component on an entity that's otherwise server-authoritative? An exampleI'd like for players to be able to change where they're looking on the client, without the server intervening much. Otherwise, there are two problems:
"Shared" authority..?For those two reasons, I can't have the Now... I did say, "without the server intervening much." What I meant by that is the vertical clamp: the server should be maintaining the clamp of 90..=270 degrees for a player looking up/down. Otherwise, modders could potentially flip the player head backwards and freak people out. (the world would be a better place if cheaters did stuff like this instead of their typical actions, but I digress) In essence, I need a way to kinda "share" authority over a component, with the client sending a raw value, and the server verifying that value for itself, that local client, and all remote clients. So, I know that you can do this with Messages (probably using a custom channel, a special I can totally imagine some kind of component_registration_pretend_this_exists_please::<PlayerView>()
.verified(|comp: &mut PlayerView| {
*comp.rotation.x = *comp
.rotation
.x
.clamp(90_f32.to_radians(), 270_f32.to_radians());
});Is there any way to do this without resorting to Thanks for the great crate! :D |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 5 replies
-
|
Messages work great here! But... it's suspiciously great. It's the least finicky part of movement in my project, actually. Huh? Suspiciously great?It seems that most other kinds of movement are sometimes lost. This might be an issue with my tickrate, which is All of the non-message inputs (actions) are sometimes lost, causing numerous forms of desync. In my view, this is due to the default On the other hand, the "custom messages" route lets you define channels with So, as an answer to my question, no: Some message tipsHere's some various things I learned when using messages for a couple kinds of input when solving this in my project... Channel modeFor inputs, make sure your Receiver/Sender placementYour
|
Beta Was this translation helpful? Give feedback.
Wait, you're not supposed to use custom messages to send inputs; you should use the
InputsPlugin(that uses theInputChannelunder the hood but with tons of extra guarantees around tick-syncing, input-delay, etc.). I'm actually surprised that things more-or-less worked for you using raw messages.It is guaranteed that your input emitted on the client on tick T will always be received on the server by tick T (it is buffered under the hood by an input buffer). The flow is supposed to be: