mstfmrt07
mstfmrt072mo ago

Handling Ownership Requests that are older than the newest requests

Hello! In our multiplayer soccer game, we are facing an issue about ball ownership which causes the ball to constantly change the owner and make the game unplayable at some times. (we are presuming that it is caused by players those have high latency) For that matter, we came up with this idea: Keeping the ball ownership history in a realtime array with a server timestamp; if the newest one is older than the last element in the array; we just simply ignore that and keep the last owner. This may also fix the problem with "real quick" ownership changes which often happen when there are too many players around the ball. So, the question is whether Normcore already applies this technique without any hassle from the client (like ignoring the ownership requests that are older than the newest request) or it performs the request no matter which time did it happen. Is that so, it will invalidate the idea we came up with, it won't make too much sense. What do you guys think about it? Maybe you have a better idea that resolves the issue way easily; we'd much appreciate it. Thanks in advance!
5 Replies
kapa.ai
kapa.ai2mo ago
Hi @mstfmrt07. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave: ---------------------- Normcore doesn't inherently handle the situation you're describing. It doesn't keep a history of ownership requests or compare timestamps to ignore older requests. Instead, it operates on a first-come, first-served basis. When a client calls RequestOwnership(), the server will approve this request unless a parent RealtimeView is already owned by another client. However, this can be controlled with the preventOwnershipTakeover flag. When this flag is true on any model, the server will deny any client’s attempt to change the ownership of an object in that model unless it has no owner [source (https://normcore.io/documentation/room/ownership-and-lifetime-flags#prevent-ownership-takeover-of-a-realtimeview)]. However, Normcore does provide tools that you can use to implement your own solution. For example, you could use the RealtimeView's RequestOwnership() and ClearOwnership() methods to manage ownership manually. You could also use the RealtimeView's isOwnedLocallyInHierarchy property to check if the current client owns a particular object [source (https://normcore.io/documentation/realtime/realtimeview#ownership)]. One possible solution to your problem could be to implement a cooldown period after an ownership change, during which no other client can request ownership. This could help prevent rapid ownership changes when many players are near the ball. You could implement this using Unity's Time.time to keep track of when the last ownership change occurred and ignore any requests that occur during the cooldown period. Remember that any solution you implement will need to take into account the fact that Normcore synchronizes changes at 20hz and sends the latest state. If you change something and then change it back immediately, nothing will be sent to the server [source (https://normcore.io/documentation/realtime/common-questions#im-calling-requestownership-setting-the-position-of-a-transform-and-then-immediately-calling-clearownershipbut-nothing-happens-how-can-i-fix-this)]. I hope this helps! Let me know if you have any other questions. ---------------------- Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: ----------------------
kapa.ai
kapa.ai2mo ago
<@208292457979314176> kapa.ai is still learning and improving, please let us know how it did by reacting below
mstfmrt07
mstfmrt072mo ago
@Max what do you think about that?
maxweisel
maxweisel2mo ago
you’ll want to write a system for deterministically simulating the ball the collection of ownership swap events isn’t going to know about “newer” events because they haven’t arrived yet from the server it would only be able to know if the local client took it over more recently and the ownership system already handles that case
JuanLouTech
JuanLouTech2mo ago
Hi! I'm interested in this thread since my game also involves interactions with rigid bodies. @Max , you're suggesting handling the physics manually instead of a rigid body, right? I mean, code the ball as a kinematic body and handle it's velocity in a predictable way, isn't it? I did not consider that option but if you don't need very realistic physics might be a good one.
More Posts
Unity Crashing ~10 seconds after loading realtime with a certain name.Hey guys, Having a rather strange issue. Recently all of our developers started reporting crashes aRealtimeAvatarVoice component for Voice chat is goneAccording to documentation, I'vs used RealtimeAvatarVoice component to use Voice chat. But after updWhat is the best way to seamlessly move between two rooms?Is this possible with a single, real-time instance? I'm working in VR and I want to avoid the AvatarMetaAvatar breaks recenteringI have Allow Recenter deactivated (OVRCameraRig) and when i have MetaAvatars disabled, everything wo[TESTING] How to set up Meta Avatars with NormcoreHey, can you walk me through using Meta Avatars with Normcore?How to best synchronize a byte array?I have a texture2D and I want to be in sync with everyone in the room so I converted the data into aIs it better to have more variables per RealtimeComponent?Say that I have 5 variables that I want to sync using a RealtimeComponent. Is it better to use 1 ReaDoes consolidating RealtimeComponents to have only one RealtimeView reduce bandwidth?For example, if I have a prefab with a root game object and a child game object. For some reason, asDoes an inactive RealtimeComponent utilize bandwidth?In our game, we have an object with multiple states. To simplify things, we have each of those stateIs Normcore able to support up to 100 people concurrently in a single room?I have purchase Normcore pro app key, but my app still could sync up to 10 users, then if more peopl