NonobaGameUser.UserId question

vitchvitch zei

een tijd geleden | Bericht #1
Hi,

Does the NonobaGameUser.UserId uniquely identify a given user globally or only within one game session?

My game has up to 8 players at a time. I need to assign one of 8 colours to each of the users playing. Can I just use the user id and presume it is between 0 and 7 (as it seems to be on the development server). Or do I need to write some additional logic to assign some kind of instance id. Especially since people could leave and new people could join during the course of a game...

The documentation says: "An unique id for this connected player for the entire lifetime of the game. Useful for identifying one player from another in messages sent between the clients and the server."

From this it isn't clear to me if e.g. user 4 leaves and a new user joins then will they be assigned the old user id of 4 or will they be assigned a new user id (which would possibly be > 7)?

Thanks,

Kelvin :)

ChrisChris zei

een tijd geleden | Bericht #2
Its basically just a counter as it is implemented now. So the player id will be 1-n where n is the total amount of users to ever join that game instance.

/Chris

zproxyzproxy zei

een tijd geleden | Bericht #3
you could always use the mod operator.

var color = NonobaGameUser.UserId % 8

vitchvitch zei

een tijd geleden | Bericht #4
Thanks for the reply Chris... And thanks for the suggestion zproxy - that wouldn't quite work for me though because I could end up with more than one user with the same colour... It's easy enough to work around, I was just wondering if I needed to bother with the deadline fast appoaching...

Thanks again,

Kelvin :)

greenseedgreenseed zei

een tijd geleden | Bericht #5
how do you delete messages???
Bericht #6 verwijdert

Antwoord op onderwerp

Schrijf je nu in om te kunnen antwoorden op onderwerpen

Nonoba

nonoba.nl is een onafhankelijke spelletjes site waar je zowel individueel als gezamenlijk spelletjes gratis kunt spelen.

Developer gereedschap

Als je een flash spelontwerper bent hebben we gave gereedschappen die je kunnen helpen om nog betere spellen te ontwikkelen.

Geweldige Spellen

Waarom probeer je niet een van de beste online flah spellen die wij hebben voor nop?

Copyright ©2007-2012 Nonoba™ - All rights reserved.46.8001ms on SERVER34096