Question about group ids

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

Moderators: Lapo, Bax

auras
Posts: 1
Joined: 01 Feb 2012, 12:21

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.
User avatar
rjgtav
Posts: 2813
Joined: 19 Apr 2009, 11:31
Location: Lisbon, Portugal

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, SFS2X, AS2.0/AS3.0, Java, HTML5/CSS3/JS, C#
Portfolio: https://rjgtav.wordpress.com/
SFS Tutorials: http://sfs-tutor.blogspot.com/ - Discontinued. Some examples may be bugged.
set_a
Posts: 16
Joined: 23 Feb 2012, 13:24

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?
User avatar
rjgtav
Posts: 2813
Joined: 19 Apr 2009, 11:31
Location: Lisbon, Portugal

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, SFS2X, AS2.0/AS3.0, Java, HTML5/CSS3/JS, C#
Portfolio: https://rjgtav.wordpress.com/
SFS Tutorials: http://sfs-tutor.blogspot.com/ - Discontinued. Some examples may be bugged.
set_a
Posts: 16
Joined: 23 Feb 2012, 13:24

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?
User avatar
rjgtav
Posts: 2813
Joined: 19 Apr 2009, 11:31
Location: Lisbon, Portugal

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, SFS2X, AS2.0/AS3.0, Java, HTML5/CSS3/JS, C#
Portfolio: https://rjgtav.wordpress.com/
SFS Tutorials: http://sfs-tutor.blogspot.com/ - Discontinued. Some examples may be bugged.
ganggangde
Posts: 2
Joined: 27 Feb 2012, 02:21

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?
User avatar
Lapo
Site Admin
Posts: 22999
Joined: 21 Mar 2005, 09:50
Location: Italy

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
Carl Lydon
Posts: 298
Joined: 12 Nov 2007, 16:15
Location: NYC
Contact:

Re: Question about group ids

Postby Carl Lydon » 05 Feb 2016, 18:51

It would be nice if you could remove them though, just for the sake of organization. They show up in the admin tool and if there are a lot of "dead" ones cluttering up the dropdown isn't so nice, and also if you you have code that searches rooms by roomGroup, it would be nicer to not loop through a bunch of roomGroups that don't exist. That said, I suppose restarting the server can fix it of snow.
User avatar
Lapo
Site Admin
Posts: 22999
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: Question about group ids

Postby Lapo » 08 Feb 2016, 09:14

Carl Lydon wrote:It would be nice if you could remove them though, just for the sake of organization. They show up in the admin tool and if there are a lot of "dead" ones cluttering up the dropdown isn't so nice, and also if you you have code that searches rooms by roomGroup, it would be nicer to not loop through a bunch of roomGroups that don't exist. That said, I suppose restarting the server can fix it of snow.

Groups are defined at Zone Level, so you can always remove those that are no longer needed.
In terms of performance the unused groups don't cause any issue.

cheers
Lapo

--

gotoAndPlay()

...addicted to flash games
User avatar
Carl Lydon
Posts: 298
Joined: 12 Nov 2007, 16:15
Location: NYC
Contact:

Re: Question about group ids

Postby Carl Lydon » 21 Jul 2016, 19:13

How? I see a display in the admin tool under zone-->runtime zone settings, but no ability to select a room group

The only way I've seen so far is to restart the server, which I try to avoid doing...
User avatar
Lapo
Site Admin
Posts: 22999
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: Question about group ids

Postby Lapo » 22 Jul 2016, 08:02

Good point. At the moment you will need a restart, but if you're doing it because you want to remove groups I wouldn't recommend it for the reasons I explained in my previous post.

We have a new feature coming with the next 2.12 release which will allow you to manage groups dynamically from your Extension code. So no restart required.

cheers
Lapo

--

gotoAndPlay()

...addicted to flash games
User avatar
Carl Lydon
Posts: 298
Joined: 12 Nov 2007, 16:15
Location: NYC
Contact:

Re: Question about group ids

Postby Carl Lydon » 26 Jul 2016, 02:43

Awesome!
DrPsyche
Posts: 8
Joined: 09 Jan 2019, 11:47

Re: Question about group ids

Postby DrPsyche » 20 Jun 2019, 08:41

Lapo wrote:

Room groups are never removed, because they are just "keys". They basically don't take real space.]term paper for sale
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.


Quite an interesting approach to explain that :) I planned all the groups for my application beforehand, just like you said. But my last application project was actually a mess (and I had to work on other variants) because I didn't managed to complete migration from 2.10 to 2.12 successfully. Anyway, that was my mistake.

Edit: Sorry for the bump, just noticed the topic is quite old.

Return to “SFS2X Java / Android API”

Who is online

Users browsing this forum: No registered users and 11 guests