Spectator to Player

Post here your questions about SFS2X. Here we discuss all server-side matters. For client API questions see the dedicated forums.

Moderators: Lapo, Bax

Post Reply
Kai
Posts: 17
Joined: 22 Oct 2009, 16:41

Spectator to Player

Post 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);
Kai
Posts: 17
Joined: 22 Oct 2009, 16:41

Post by Kai »

Just to add;

I am catching the SpectatorToPlayer and PlayerToSpectator events on the server side to load player related data.
User avatar
Lapo
Site Admin
Posts: 23438
Joined: 21 Mar 2005, 09:50
Location: Italy

Post 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
Lapo
--
gotoAndPlay()
...addicted to flash games
Post Reply