Niv
NNormal
•Created by Mischa on 9/13/2024 in #🤝ask-a-question
Check for definitive Ownership
Apparently I was thinking about it all wrong - so thanks for clarifying.
I had a feeling I'm not understanding something ...
55 replies
NNormal
•Created by Mischa on 9/13/2024 in #🤝ask-a-question
Check for definitive Ownership
ok that actually makes better sense then - I need to rethink 😄
Thanks!
55 replies
NNormal
•Created by Mischa on 9/13/2024 in #🤝ask-a-question
Check for definitive Ownership
One suggestion for improvement of the StringKeyDictionary to make it much more powerful.
I think the Insert() API should only succeed if the key is empty.
The way it currently works is while the model is unowned, anyone can "insert" - if 2 clients do it semi-simultaneously then one will get a fail. But after long enough time (which is fuzzy = bad) he will suddenly succeed in his "insert" (which is actually an UpdateValue call).
This makes me think the flow you described is still not guaranteed to be 100% error free.
Of course server verified ownership will be the best solution to my problem - but I believe explicit API's for Insert/InsertOrUpdate, where insert fails if the key exists will make it more powerful as atomic operations. You never really know how lagged clients are.
just FYI, the buggy scenario I can see is this:
1. model with dictionary is unowned.
2. 2 clients (A & B) try to write to the dictionary.
3. server accepts A's insert op and sends approval.
4. A receives approval and takes ownership and prevents takeover
5. A's ownership takeover is delayed because of network
6. B receives A's insert very delayed, so he issues his own insert
7. Server receives B's insert because enough time passes since A inserted (I saw this can happen)
you can get where it goes from here ...
55 replies
NNormal
•Created by Mischa on 9/13/2024 in #🤝ask-a-question
Check for definitive Ownership
(like what do you do first - ask for ownership or try to write to the dictionary? when can you safely assume everyone is in agreement and that client can execute "irreversible" code, like spawning)
55 replies
NNormal
•Created by Mischa on 9/13/2024 in #🤝ask-a-question
Check for definitive Ownership
There's something about this method that still seems off to me. Like if the model is unowned, everyone can write to the dictionary but if they try to write "at the same time" (what does that even mean?) only one succeeds.
How can 2 clients ask for something "at the same time" - how close do they have to be to be considered the same time?
And if it's not unowned, then only one client can write to it in the first place. I'm just not getting how to use this atomic/transactional behavior to achieve our goals which are:
- Make sure one (and only one) client executes some code after everyone mutually agreed that client is "the one".
If I'm missing something and that feature does solve that - maybe it would be beneficial for everyone if an example / docs were written that demonstrate how to achieve that.
55 replies
NNormal
•Created by Mischa on 9/13/2024 in #🤝ask-a-question
Check for definitive Ownership
That single thing would remove a lot of our headaches
55 replies
NNormal
•Created by Mischa on 9/13/2024 in #🤝ask-a-question
Check for definitive Ownership
Just seems like a lot of gymnastics where the API should be clearer/cleaner
55 replies
NNormal
•Created by Mischa on 9/13/2024 in #🤝ask-a-question
Check for definitive Ownership
I understand the transactional nature of the StringKeyDictionary<> - but when the model is unowned (prev owner left) everyone can make changes. And then both/all clients need to clear it to be able to insert a key. I can definitely still envision a scenario where it breaks - like 1st client succesfully clears and inserts a key -> then requests ownership -> then 2nd client (before 1st client ownership request is approved) does the same clear + insert key.
55 replies
NNormal
•Created by Mischa on 9/13/2024 in #🤝ask-a-question
Check for definitive Ownership
seems like a very fundemental thing that should be systematically supported on the API level though
55 replies
NNormal
•Created by Mischa on 9/13/2024 in #🤝ask-a-question
Check for definitive Ownership
we're not using that, but I will look into what it is and why its helpful in this situation
55 replies
NNormal
•Created by Mischa on 9/13/2024 in #🤝ask-a-question
Check for definitive Ownership
how do you know which client IDs are actually connected?
55 replies
NNormal
•Created by Mischa on 9/13/2024 in #🤝ask-a-question
Check for definitive Ownership
@maxweisel - circling back to this as we're running into similar questions.
This thread being a bit old - perhaps things have changed since or best practices have been developed.
Let's say we have a manager type of object that is responsible for spawning things for everyone. When the previous owner leaves - some other player should take ownership so spawning can resume. Since spawning will always get accepted by server we need to make sure only 1 client does this after he has 100% verified he is the owner and the server won't roll that back.
It seems like ownership is not sufficient in its current form because there's no way to tell locally when the server approves/denies an ownership request. Is there another best practice to achieve this?
Even with string key dictionary - if the model is unowned everyone is allowed to write to the model, so even if my process is write to dictionay, wait for approval. I might get this approval and then another client will overwrite my approved value with his value (and also get approval). It seems like however I change things around there's a potential race condition. Am I not getting something?
55 replies
NNormal
•Created by Niv on 4/7/2025 in #🤝ask-a-question
Is there a way to setup the server/client with a bigger timeout so it will not disconnect easily
I agree, but how would you get multiple players scenarios tested this way?
32 replies
NNormal
•Created by Niv on 4/7/2025 in #🤝ask-a-question
Is there a way to setup the server/client with a bigger timeout so it will not disconnect easily
@kapa.ai - but when a breakpoint in code is hit, there's no way to periodically call BumpAutoDisconnectTime()
32 replies
NNormal
•Created by Niv on 2/25/2025 in #🤝ask-a-question
preventOwnershipTakeover is not synchronized between clients
initial tests look great, much appreciated! 😄
13 replies
NNormal
•Created by Niv on 2/25/2025 in #🤝ask-a-question
preventOwnershipTakeover is not synchronized between clients
nice - will do!
13 replies
NNormal
•Created by Niv on 3/5/2025 in #🤝ask-a-question
What happens when state changes very close to (or same frame) when the object is destroyed?
Thanks Max that clears it up.
While you mentioned reliable vs. unreliable - are unreliable generally quicker to arrive (assuming no packet loss)? or do they use a similar pipe?
14 replies
NNormal
•Created by Niv on 3/3/2025 in #🤝ask-a-question
What is the overhead of RealtimeView components?
Thanks mark - that's in line with what I assumed, but good to know.
7 replies
NNormal
•Created by Niv on 2/26/2025 in #🤝ask-a-question
Not getting ownership changed event when remote authority prevents it
yeah that bug is what's keeping me on 2.11.1 - the other bugs have fairly simple workaround but that other bug (not getting correct state of 'preventOwnershipTakeover' in remote clients) is impossible to work around.
But it's all good, we're working and happy so take your time figuring this one out.
21 replies