Page 1 of 1

Spectator to Player

Posted: 31 Dec 2010, 22:02
by Kai
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):

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);
Switch player code (Repeat to see IDs being switched):

Code: Select all

var request:SpectatorToPlayerRequest = new SpectatorToPlayerRequest();
sfs.send(request);

Posted: 31 Dec 2010, 22:10
by Kai
Just to add;

I am catching the SpectatorToPlayer and PlayerToSpectator events on the server side to load player related data.

Posted: 13 Dec 2011, 10:07
by Lapo
Correct me if I am wrong but you are saying that you send a SpectatorToPlayer request when you are already a player, right?
Can you also please confirm that you are using SFS2X RC3 and specify which client API and version?

thanks