Question about group ids

Post here your questions about the Java client / Android API for SFS2X

Moderators: Bax, Lapo

Question about group ids

Postby auras » 01 Feb 2012, 12:26

How do group IDs work?
Do they have be declared first somewhere before using them? If so, how?

I'm asking because when I'm creating a room if I want to set a group id it won't work

Code: Select all
RoomSettings room = new RoomSettings(nextRoom);
         room.setGroupId("experience" + keycode);
         room.setMaxUsers(MAX_ROOM_USERS);

         if (password != null && !password.equals(""))
            room.setPassword(password);
         
         sfClient.send(new CreateRoomRequest(room));


If I comment the second line it will work.
auras
 
Posts: 1
Joined: 01 Feb 2012, 12:21

Postby rjgtav » 01 Feb 2012, 22:32

Hi.

You can set the group IDs of a Zone in the Zone Configurator, in the Public Room Groups setting under the General Tab.

You can also create new Room Groups on run-time (server-side only), by specifying a new Group ID when creating the room.
Skills: SFS Pro/Basic, SFS2X, AS2.0/AS3.0, Java, HTML5/CSS3/JS
SFS Tutorials: http://sfs-tutor.blogspot.com/ - I no longer update it nor visit it. Some examples may be bugged.
If I take too long to reply, feel free to PM me
User avatar
rjgtav
 
Posts: 2809
Joined: 19 Apr 2009, 11:31
Location: Lisbon, Portugal

Re: Question about group ids

Postby set_a » 23 Feb 2012, 16:56

If I need to add another group to an already created groups. I need to create an array of the names of these groups and call setPublicGroups for current zone
If I do that what happens to the rooms that were already attached to the created groups?
set_a
 
Posts: 16
Joined: 23 Feb 2012, 13:24

Re: Question about group ids

Postby rjgtav » 23 Feb 2012, 20:37

Hi. If you want to create a new room group, you simply need to create a new room and attach it to a new groupId.
Skills: SFS Pro/Basic, SFS2X, AS2.0/AS3.0, Java, HTML5/CSS3/JS
SFS Tutorials: http://sfs-tutor.blogspot.com/ - I no longer update it nor visit it. Some examples may be bugged.
If I take too long to reply, feel free to PM me
User avatar
rjgtav
 
Posts: 2809
Joined: 19 Apr 2009, 11:31
Location: Lisbon, Portugal

Re: Question about group ids

Postby set_a » 24 Feb 2012, 11:08

Example:
List of groups: group_1, group_2, group_3
Add groups to the area through the setPublicGroups method. Add several rooms into each group.
1. I need to add a new group group_4 (ie I can't use setPublicGroups method). So I need to create a room and tie it to the new group for creating this group in the area?
2. If I use setPublicGroups method all of the rooms that were added to the group group_1, group_2, group_3 will disappear?
3. For removing the group I have to delete all the rooms in this group?
set_a
 
Posts: 16
Joined: 23 Feb 2012, 13:24

Re: Question about group ids

Postby rjgtav » 24 Feb 2012, 20:00

First of all, please don't use the setPublicGroups() method. It is for internal use only, by the API.
For creating a new room group, yes, you just create a new room, and as the group id, you set "group_4".
And yes, I think the room group is removed when all of its rooms are also removed.
Skills: SFS Pro/Basic, SFS2X, AS2.0/AS3.0, Java, HTML5/CSS3/JS
SFS Tutorials: http://sfs-tutor.blogspot.com/ - I no longer update it nor visit it. Some examples may be bugged.
If I take too long to reply, feel free to PM me
User avatar
rjgtav
 
Posts: 2809
Joined: 19 Apr 2009, 11:31
Location: Lisbon, Portugal

Re: Question about group ids

Postby ganggangde » 27 Feb 2012, 02:43

If I need to add another group to an already created groups. I need to create an array of the names of these groups and call setPublicGroups for current zone
If I do that what happens to the rooms that were already attached to the created groups?
ganggangde
 
Posts: 2
Joined: 27 Feb 2012, 02:21

Re: Question about group ids

Postby Lapo » 13 Mar 2012, 10:42

Room groups are never removed, because they are just "keys". They basically don't take real space.
It is like the name of a road. If you build a few houses along that road you can then tell people how to get there by providing the address... Lapo Street ... for example :) If you destroy all houses then who cares about the name of that street anymore? :)

One more note. In general groups are not meant to be totally dynamic, if you have planned your application a bit you should know beforehand which groups you will need.
Lapo
--
gotoAndPlay()
...addicted to flash games
User avatar
Lapo
Site Admin
 
Posts: 15672
Joined: 21 Mar 2005, 09:50
Location: Italy


Return to SFS2X Java / Android API

Who is online

Users browsing this forum: No registered users and 1 guest