Hi,
The question is:
The client is send a "CreateSFSGameRequest" request ,
API http://docs2x.smartfoxserver.com/api-docs/csharp-doc/Index.html
said it will fire ROOM_ADD ,or ROOM_CREATION_ERROR if it has problem
BUT,
ROOM_ADD was not fired and JOIN_ROOM was fired
this is room settings :
GameSettings setting =new SFSGameSettings("roomname");
setting.MaxUsers=2;
setting.GroupId="Games";
setting.LeaveLastJoinedRoom=false;
setting.IsPublic=true;
setting.MinPlayersToStartGame=2;
setting.NotifyGameStarted=true;
setting.Variables.Add(new SFSRoomVariable("costrange",123));
I checked client has subscripted the groupId ,and the forums not find about this issue.
please someone can help me, thanks
API version 1.3.0
Create a GameRoom question
Re: Create a GameRoom question
Sounds strange. Can we see the entire code snippet that creates the Room and how the event handlers are added?
Thanks
Thanks
Re: Create a GameRoom question
thanks your reply,Lapo
I get the answer myself.
I lost to send Subscrpit Request.....
I get the answer myself.
I lost to send Subscrpit Request.....
Re: Create a GameRoom question
Oh, the other problem occur,
the same setting:
I was set 3+1 variables in room ,
and ROOM_ADD event work fine,
but ,when I was access the params room,
It was 1 variable, user in room was 0!
strangely,it sometimes work fine ->4 variables and 1 user.
please help me , I must be finish this game project before December...
the same setting:
Code: Select all
SFSGameSettings setting =new SFSGameSettings((string)ht["roomname"]);
setting.MaxUsers=2;
setting.GroupId="Games";
setting.LeaveLastJoinedRoom=false;
setting.IsPublic=true;
setting.MinPlayersToStartGame=2;
setting.NotifyGameStarted=true;
setting.Events=new RoomEvents();
setting.Events.AllowUserEnter=true;
setting.Events.AllowUserExit=true;
setting.Events.AllowUserCountChange=true;
setting.Events.AllowUserVariablesUpdate=true;
//variables
setting.Variables.Add (new SFSRoomVariable("creatorID",_instance.sfc.MySelf.Id));
setting.Variables.Add(new SFSRoomVariable("costrange",123));
setting.Variables.Add(new SFSRoomVariable("cost",735));
_instance.sfc.Send(new CreateSFSGameRequest(setting));
ROOM_ADD callback :
void OnRoomCreated(BaseEvent e){
SFSRoom newRoom=(SFSRoom)e.Params["room"];
print ("ROOM_ADD:"+newRoom.Name+" created success");
print (newRoom.GetVariables().Count+",p:"+newRoom.PlayerList.Count);
}
I was set 3+1 variables in room ,
and ROOM_ADD event work fine,
but ,when I was access the params room,
It was 1 variable, user in room was 0!
strangely,it sometimes work fine ->4 variables and 1 user.
please help me , I must be finish this game project before December...
Re: Create a GameRoom question
When you receive the ROOM_ADD event you haven't joined the Room yet. So it's ok to see that it contains zero users.
You will receive the ROOM_JOIN even after that.
To check the status of Room Variables use the ZoneMonitor in the Admin Tool, select the right Room and see which variables are available
You will receive the ROOM_JOIN even after that.
To check the status of Room Variables use the ZoneMonitor in the Admin Tool, select the right Room and see which variables are available
Re: Create a GameRoom question
I know that you said,
the problem alawys occur at after ROOM_ADD and before JOIN_ROOM.
I checked ZoneMonitor ,roomvariables was fine.
The variables needs to set "IsPersistent=true" or other setting?
And the other problem,
userA create a SFSGame ignore the variables problem,
userB use smartfox.GetRoomListFromGroup("Games") to find it ,but check "room.playerList" or "room.userList" ,their Count attribute is 0
and check "room.UserCount" is 1.
Should I use CreateRoomRequest to replace CreateSFSGameRequest?
Or coding server side extension additional to process room problems ?
thanks.
the problem alawys occur at after ROOM_ADD and before JOIN_ROOM.
I checked ZoneMonitor ,roomvariables was fine.
The variables needs to set "IsPersistent=true" or other setting?
And the other problem,
userA create a SFSGame ignore the variables problem,
userB use smartfox.GetRoomListFromGroup("Games") to find it ,but check "room.playerList" or "room.userList" ,their Count attribute is 0
and check "room.UserCount" is 1.
Should I use CreateRoomRequest to replace CreateSFSGameRequest?
Or coding server side extension additional to process room problems ?
thanks.
Re: Create a GameRoom question
I think you are missing a few concepts here that are fundamental.
When you subscribe to a Group of Rooms you get the list of all Rooms inside that group.
Because you haven't joined any of those Rooms your client didn't receive the user list of those Rooms. In other words you receive a Room's user-list only when you join it, otherwise the user-list will always be empty. The Room user count serves the purpose to keep you updated about the number of players and spectators in Rooms that you haven't joined.
Similarly this applies to RoomVariables. Those values are available only to the people that have joined the Room, not those outside of it.
There is however an exception to this. Global RoomVariables are propagated to everyone outside the Room as well.
Make sure to learn the details in the docs:
http://docs2x.smartfoxserver.com/Develo ... chitecture
http://docs2x.smartfoxserver.com/Develo ... -variables
When you subscribe to a Group of Rooms you get the list of all Rooms inside that group.
Because you haven't joined any of those Rooms your client didn't receive the user list of those Rooms. In other words you receive a Room's user-list only when you join it, otherwise the user-list will always be empty. The Room user count serves the purpose to keep you updated about the number of players and spectators in Rooms that you haven't joined.
Similarly this applies to RoomVariables. Those values are available only to the people that have joined the Room, not those outside of it.
There is however an exception to this. Global RoomVariables are propagated to everyone outside the Room as well.
Make sure to learn the details in the docs:
http://docs2x.smartfoxserver.com/Develo ... chitecture
http://docs2x.smartfoxserver.com/Develo ... -variables
Re: Create a GameRoom question
thank you Lapo ,
thanks your direction.
thanks your direction.
Who is online
Users browsing this forum: No registered users and 48 guests