Hi,
We are having an issue with the Player id when converting from Player to Spectator and Spectator to Player.
The issue is happening in the following scenario for a 2 player game.
Player1 joins the room and gets PlayerId = 1
Player2 joins the room and gets PlayerId = 2
Player2 leaves the room
Player1 is converted to a spectator from the server side using "gameRoom.switchPlayerToSpectator(Player1 );"
Then Player1 clicks get a message to Stay in the room or Leave. Once we click on "Stay in the room" we send a request from Flash to Server using "sfs.send(new SpectatorToPlayerRequest());" to make this user a player again.
Now Player1 has the PlayerId = 2 (note, Player1 never left the game room)
Player2 decides to join the game again and in this case PlayerId =0;
Why is playerId coming as 0 for Player2? I thought that PlayerIdGenerator would start from 1 for a game room.
Are we using the proper way of dealing with such a scenario?
Thanks.
PlayerId generator issue in Spectator to Player
Re: PlayerId generator issue in Spectator to Player
Any thoughts on this ?
Re: PlayerId generator issue in Spectator to Player
I don't understand why you need to change player 1 to spectator and then back to player. Why don't you just pause the game and ask the player if he wants to leave the Room or stay?
Paolo Bax
The SmartFoxServer Team
The SmartFoxServer Team
Re: PlayerId generator issue in Spectator to Player
Nevermind, we actually figured out the issue. Thanks for your help.