DC
DC6d ago

When property on RealtimeModel is updated quickly only last change is transmitted.

I am finding that when property on RealtimeModel is updated quickly (perhaps in the same frame), only last change is transmitted. Is there a way to force a send? I am using UniTask inside an async method, and tried a UniTask.Yield
4 Replies
kapa.ai
kapa.ai6d ago
Hi @DC. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave: ---------------------- This behavior you're observing is actually by design in Normcore. Let me explain why this happens and what you can do about it. According to the Room > Datastore documentation: "The datastore keeps track of all changes that have been applied by the local client. Periodically, Room will instruct the datastore to serialize all the outstanding changes to send in an update to the server. This ensures that only the smallest amount of data needs to be serialized and transmitted to the server." The rate at which these updates are sent is controlled by the datastoreFrameDuration property on the Room class. By default, this is set to send updates at 20Hz. If you're making multiple changes to a property within the same frame or within the update interval, only the last change will be sent. This is an optimization to reduce bandwidth usage. To address your specific question about forcing a send, there isn't a direct way to force an immediate send of a single property update. However, you have a few options: 1. You could decrease the datastoreFrameDuration to send updates more frequently. However, this will increase bandwidth usage and is generally not recommended unless you're running a local installation. 2. If you need to ensure that intermediate states are captured, you might consider using a collection like RealtimeArray to store each state change as a separate element. 3. If your property doesn't need to be reliably synchronized and you're okay with potentially missing some intermediate states, you could use an UnreliableProperty instead. These are more bandwidth-efficient but don't guarantee delivery. Regarding your use of UniTask and async methods, adding yields between property updates won't necessarily force Normcore to send updates more frequently, as it still adheres to the datastoreFrameDuration for batching and sending updates. If you need more precise control over when updates are sent, you might need to reconsider your synchronization strategy or reach out to the Normcore team for more specific guidance tailored to your use case. ---------------------- Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: ----------------------
kapa.ai
kapa.ai6d ago
<@1259730396577529917> Kapa.ai is still learning and improving, please let me know how I did by reacting below.
DC
DCOP6d ago
What if I put in a UniTask.Delay() for 60ms?
Mechabit
Mechabit6d ago
the solution here is to use a Realtime set so that every message is received we use this for things like bullet hits that can happen very quickly but all need to register

Did you find this page helpful?