Page 1 of 1

Getting knowledge about runtime created game rooms

Posted: 26 Nov 2014, 18:44
by braza
Hi! I got back to my project after a delay.
This time I want to get to the bottom of an issue that bothered me for a long time.

Lets say I have two users.
1. I can see rooms created by users only if they were both logged in by that moment. How can I request list of rooms that were there before I log in?
2. If clien that gets notified about the rooms tries to see how many users are there it wont count the creator in my case. I see 0/2 instead on that client. Oreator sees this room as 1/2.

Thanks!

Re: Getting knowledge about runtime created game rooms

Posted: 27 Nov 2014, 09:59
by Lapo
Hello,
braza wrote:Lets say I have two users.
1. I can see rooms created by users only if they were both logged in by that moment. How can I request list of rooms that were there before I log in?

You can't :)
First you need to login, with or without credentials is up to the developer.
Then you can talk with the server API. No login, no joy :)

The list of rooms is actually sent back in the login response.

2. If clien that gets notified about the rooms tries to see how many users are there it wont count the creator in my case. I see 0/2 instead on that client. Oreator sees this room as 1/2.

This I don't understand. The number of players / spectators is any Rooms reflects exactly the number of people inside that Room. There are no exceptions.

Can you better explain what is the problem you see?

cheers

Re: Getting knowledge about runtime created game rooms

Posted: 29 Nov 2014, 22:56
by braza
Lapo wrote:Hello,
braza wrote:Lets say I have two users.
1. I can see rooms created by users only if they were both logged in by that moment. How can I request list of rooms that were there before I log in?

You can't :)
First you need to login, with or without credentials is up to the developer.
Then you can talk with the server API. No login, no joy :)

The list of rooms is actually sent back in the login response.

2. If clien that gets notified about the rooms tries to see how many users are there it wont count the creator in my case. I see 0/2 instead on that client. Oreator sees this room as 1/2.

This I don't understand. The number of players / spectators is any Rooms reflects exactly the number of people inside that Room. There are no exceptions.

Can you better explain what is the problem you see?

cheers


1. That's the info I needed! Rooms created before login arrive in the LoginResponse! Thanks! I'll try that.
2. http://screenpresso.com/=TKVXf
You see 1/2 and 0/2?

Code beghind is the same on both clients of course:

Code: Select all

   public void OnScrollPanelItemVirtualize( object backingListItem )
   {
      room = (Room) backingListItem;
      
      GameName.Text = room.Name;
      UserCount.Text = room.UserCount + "/" + room.MaxUsers;
      Debug.Log("[GUI]Room with " + room.UserCount + " users in it added to panel");
   }

Re: Getting knowledge about runtime created game rooms

Posted: 01 Dec 2014, 13:47
by Lapo
As regards point #2, are both users inside the Room? One inside and one outside?
Outside of a specific Room you will need to listen to the USER_COUNT_CHANGE event. When you have joined the Room you should also listen for USER_ENTER_ROOM and USER_EXIT_ROOM to get updated about changes in the Room.

thanks

Re: Getting knowledge about runtime created game rooms

Posted: 07 Dec 2014, 02:31
by braza
Lapo wrote:As regards point #2, are both users inside the Room? One inside and one outside?
Outside of a specific Room you will need to listen to the USER_COUNT_CHANGE event. When you have joined the Room you should also listen for USER_ENTER_ROOM and USER_EXIT_ROOM to get updated about changes in the Room.

thanks

One is in and one is out, right. Thanks for pointing out events to listen. Great support!

Re: Getting knowledge about runtime created game rooms

Posted: 17 Jan 2015, 17:16
by braza
Hi again!
No I actually decided to fix that and wondering how am I supposed to find that room info there in the response... I do ot see it mentioned here http://docs2x.smartfoxserver.com/api-do ... 35530d.htm

Re: Getting knowledge about runtime created game rooms

Posted: 19 Jan 2015, 09:57
by Lapo
Sorry, I am not following.
Can you explain what you have fixed exactly?

Also, in particular,
how am I supposed to find that room info there in the response

What response?

thanks

Re: Getting knowledge about runtime created game rooms

Posted: 20 Jan 2015, 00:15
by braza
Lapo wrote:The list of rooms is actually sent back in the login response.


I want to extract the data you mentioned. The rooms that were dynamically created before I logged in.
So I look into login response docs http://docs2x.smartfoxserver.com/api-do ... 35530d.htm and do not see how am I supposed to get it...

Re: Getting knowledge about runtime created game rooms

Posted: 20 Jan 2015, 09:37
by Lapo
The list of Rooms is not passed directly in the event, but you can obtain it at any time from the SmartFox.roomList property, after having logged in.

If you're working in Java there's an equivalent method called getRoomList().

Cheers

Re: Getting knowledge about runtime created game rooms

Posted: 20 Jan 2015, 12:19
by braza
Lapo wrote:The list of Rooms is not passed directly in the event, but you can obtain it at any time from the SmartFox.roomList property, after having logged in.

If you're working in Java there's an equivalent method called getRoomList().

Cheers


aaaaah, I see! Thanks!