Mikameel
Mikameel3d ago

Handeling userID

For the library I need a Uint to refernce players, but what is good practise for assinging them? Can I use ClientID?
6 Replies
kapa.ai
kapa.ai3d ago
Hi @Mikameel. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave: ---------------------- Based on the knowledge sources provided, it appears that Normcore (the multiplayer framework by NormalVR) uses clientID as an integer to identify players. While this isn't exactly a uint, it's close to what you're looking for and is likely the best practice within the Normcore ecosystem. Here's what we can gather from the documentation: 1. The Realtime class has a clientID property of type int that represents the local client's ID Reference > Classes > Realtime. 2. The RealtimeModel class, which represents data stored in a room, uses int for ownerIDSelf and ownerIDInHierarchy Reference > Classes > RealtimeModel. 3. The RealtimeAvatarManager keeps track of avatars using a dictionary with clientID as the key Realtime > Xr > Avatars. Given this information, it seems that using clientID (as an int) is the standard practice in Normcore for identifying players. If your library specifically requires a uint, you could potentially cast the clientID to a uint, but be aware that this might cause issues if Normcore ever uses negative values for special cases (like -1 for unowned objects, as seen in some parts of the documentation). If you need to assign IDs yourself, you could consider using the clientID provided by Normcore as a base, and then map it to your own uint system within your library. However, be cautious about potential conflicts or synchronization issues when doing this. Remember to thoroughly test your implementation, especially in multiplayer scenarios, to ensure it works correctly with Normcore's built-in systems. ---------------------- Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: ----------------------
kapa.ai
kapa.ai3d ago
<@365574199844274177> Kapa.ai is still learning and improving, please let me know how I did by reacting below.
Mechabit
Mechabit3d ago
If you're going to use clientID as a player identifier know that if someone disconnects and rejoins they might not necessarily get the same client ID or a new player might get an old clientID with a score attached. The alternative would be something like steam id or oculus id
Mikameel
MikameelOP3d ago
aaah okay ! thanks, @Mechabit for my usecases right now that's okay. I decided to use their login system.time.tick since the room will only be online for a few hours I am still struggeling tho. Is there a servermanager component that logs all the VR players and add them to a list or something? I want to calculate an average server score based on their individual scores @Mechabit I am trying libraries but, do I need to attach the "public class ServerHypeManager : RealtimeComponent<HypeManagerModel>" to each individual player?
Mechabit
Mechabit3d ago
the avatar manager shows all connected players if you're not using the avatar manager you can copy how it works if you're calculating the average score from all players you don't even need a realtime set for that, just do it locally on each device
Mikameel
MikameelOP3d ago
oooooooh wow okay thanks a lot probably I was overthinking it

Did you find this page helpful?