NonobaGameUser.UserId question

vitchvitch

很久以前 | 帖子#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

很久以前 | 帖子#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

很久以前 | 帖子#3
you could always use the mod operator.

var color = NonobaGameUser.UserId % 8

vitchvitch

很久以前 | 帖子#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

很久以前 | 帖子#5
how do you delete messages???
帖子#6被删除了

回复主题

现在就注册以回复主题

5dyouxi

5dyouxi.com是一个独立的游戏网站,在这里你将可以免费玩到各种好玩的单人和多人游戏。

开发者工具

如果你是一位flash游戏开发者,我们有一些非常强大的工具来帮助你开发更加优秀的游戏。

经典游戏

为什么不试试我们这里的一些最为优秀的在线flash游戏呢?这可是完全免费的!

Copyright ©2007-2012 5dyouxi™ - All rights reserved.34.0019ms on SERVER34097
注册 或者