gubebra
gubebra2w ago

Should I update a value in RealtimeDictionary<TValue> every frame?

I need to update a value every frame and I already have the implementation of a RealtimeDictionary. Should/Can I update the vavlues every frame?
4 Replies
kapa.ai
kapa.ai2w ago
Hi @gubebra. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave: ---------------------- While it is technically possible to update a value in RealtimeDictionary<TValue> every frame, it may not be the most efficient approach, especially if the value changes very frequently. According to the Normcore documentation (https://normcore.io/documentation/realtime/synchronizing-custom-data#reliable--unreliable), if you plan to change a property very often (such as animating a color or moving a transform), you should use 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. Reliable properties are good for things that you update once and that should be resent if the packet is dropped in transit. This is great for state such as whether your game has started or not. When you change it, Normcore will ensure that this value is synchronized between all clients and that it is in sync before any newer reliable updates to are applied to the datastore. So, if the value you're updating every frame is critical and must be reliably synced across all clients, you might want to reconsider your approach. If it's not critical and can tolerate occasional dropped updates, then updating every frame could be acceptable. Remember, the goal is to minimize network traffic and ensure smooth and responsive gameplay. ---------------------- Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: ----------------------
kapa.ai
kapa.ai2w ago
<@599054560270483456> kapa.ai is still learning and improving, please let us know how it did by reacting below
gubebra
gubebra2w ago
So upon using an unreliable property, can I use a RealtimeDictionary or not?
maxweisel
maxweisel2w ago
What do you mean you already have an implementation of RealtimeDictionary? your question needs more information