Spectator to Player
Posted: 31 Dec 2010, 22:02
Hi,
I have a nagging problem with the SpectatorToPlayerRequest.
Correct me if I am wrong, every time a user joins a room as a player, they are given a PlayerID for that room, starting from one for the first user to join, and onwards to maxUsers as more users join. However it seems, that if a user has a PlayerID and sends a SpectatorToPlayer request, he is assigned the next available ID (Even though he is a user already with a valid ID). This repeats until maxUsers is hit, and then any subsquent requests yeald PlayerID zero - and server giving the error message "No player slot found in xxx".
My inital question is; should a player be assigned another available slot?
Secondly, if the user is assigned the next slot, then why does it loop around to zero with the error message?
Confused atm. Please assist.
My code is as follows:
Create Room (Client):
Switch player code (Repeat to see IDs being switched):
I have a nagging problem with the SpectatorToPlayerRequest.
Correct me if I am wrong, every time a user joins a room as a player, they are given a PlayerID for that room, starting from one for the first user to join, and onwards to maxUsers as more users join. However it seems, that if a user has a PlayerID and sends a SpectatorToPlayer request, he is assigned the next available ID (Even though he is a user already with a valid ID). This repeats until maxUsers is hit, and then any subsquent requests yeald PlayerID zero - and server giving the error message "No player slot found in xxx".
My inital question is; should a player be assigned another available slot?
Secondly, if the user is assigned the next slot, then why does it loop around to zero with the error message?
Confused atm. Please assist.
My code is as follows:
Create Room (Client):
Code: Select all
var settings:SFSGameSettings = new SFSGameSettings(roomName);
settings.groupId = SFS_GAME_GROUPID;
settings.isGame = true;
settings.isPublic = true;
settings.leaveLastJoinedRoom = true;
settings.minPlayersToStartGame = 2;
settings.maxSpectators = 5;
settings.maxUsers = 2;
settings.notifyGameStarted = true;
settings.extension = new RoomExtension(SFS_JAR, SFS_CLASS);
var request:CreateSFSGameRequest = new CreateSFSGameRequest(settings);
sfs.send(request);
Code: Select all
var request:SpectatorToPlayerRequest = new SpectatorToPlayerRequest();
sfs.send(request);