what ensures that a RealtimeDictionary is reliable

When creating a custom dictionary property using
[RealtimeProperty(7, true, false)] private RealtimeDictionary<RealtimePlayerStatsModel> _playerStats;
[RealtimeProperty(7, true, false)] private RealtimeDictionary<RealtimePlayerStatsModel> _playerStats;
changing the reliable parameter to true or false, does not seem to have any impact on the compiled model. What ensures that the dictionary is always reliable? Is this handled internally by normcore? Do you need to handle this case manually? Or is setting the values within
RealtimePlayerStatsModel
RealtimePlayerStatsModel
to reliable enough?
3 Replies
kapa.ai
kapa.aiβ€’4mo ago
Hi @π” π”¬π”Ÿπ”žπ”¦π”«.. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave: ---------------------- In Normcore, the reliability of a property is determined by the reliable attribute in the **RealtimeProperty] attribute. This attribute marks whether the property should be synced reliably or unreliably. 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. On the other hand, 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 updates, such as whether your game has started or not. When you change the value, Normcore ensures this value is received by all clients and applied to the datastore in order [source (https://normcore.io/documentation/room/realtimemodel#realtimemodel--realtimeproperty-attributes). As for RealtimeDictionary, it is a special model that behaves more like a collection. It uses a meta-model to signal to the server that it is a special model. The server is designed to parse and use the meta-model to apply custom properties to the model. In the case of ownership and lifetime flags, these properties exist on the meta-model and the server loads them into memory and uses them to accept or reject changes to the datastore source** (https://normcore.io/documentation/room/ownership-and-lifetime-flags#what-is-a-meta-model). Therefore, if you want to ensure that the RealtimeDictionary is always reliable, you should set the reliable attribute to true in the [RealtimeProperty] attribute of the properties within the RealtimePlayerStatsModel. This will ensure that the updates to these properties are always resent if they are dropped in transit. ---------------------- Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: ----------------------
kapa.ai
kapa.aiβ€’4mo ago
<@162174698010968064> kapa.ai is still learning and improving, please let us know how it did by reacting below
maxweisel
maxweiselβ€’4mo ago
This is correct for the most part. collections can send both reliable and unreliable updates for their child models, so the reliable setting is ignored The collections themselves have the necessary logic to look at their child model settings to send out updates correctly Operations like add/remove are always sent reliably