calling the set function every frame
if i call the set function from a realtime component every frame with the same argument, will it try to send the data every time or just the first time
5 Replies
Hi @MasterOX 水. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave:
----------------------
The RealtimeComponent in NormalVR is designed to synchronize data between different instances of a game. If you call the set function every frame with the same argument, it will not necessarily send the data every time.
The Normcore system serializes all updates once per network frame (~20hz) and groups them into the same packet. When model updates are applied, they’re applied one at a time, and a change event fires for that value. However, it’s possible the other values from that packet hadn’t yet been applied.
If the value you are setting does not change, it's likely that Normcore will recognize this and not send unnecessary updates. However, if you're updating a value very frequently (like every frame), you might want to consider using an "unreliable" property. Unreliable updates are not resent if they’re dropped in transit because it’s expected that another update is following shortly after.
Here's the relevant information from the documentation:
Normcore Documentation: Common Questions (https://normcore.io/documentation/room/common-questions#sometimes-when-i-log-the-values-on-my-model-from-inside-of-valuedidchange-not-all-the-values-that-i-set-on-another-client-update-when-are-updates-sent-out-and-how-are-they-applied)
Normcore Documentation: Synchronizing Custom Data (https://normcore.io/documentation/realtime/synchronizing-custom-data#reliable--unreliable)
----------------------
Note: you can ask me a follow up question by @ mentioning me again :speech_balloon:
----------------------
<@758040514678489279> kapa.ai is still learning and improving, please let us know how it did by reacting below
Hey, if you specify
includeEqualityCheck = false
in the [RealtimeProperty(...)]
block it will send the property every time it's written. Even if it didn't change.
If you don't, then Normcore is smart enough to avoid sending it. By default it only sends if the value actually changed.✅ Success!
This question has been marked as answered! If you have any other questions, feel free to create another post
Jump to answer
thank you!