Changing a room's group ID to a previously unused ID

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

Moderators: Lapo, Bax

OlegPumpkin
Posts: 4
Joined: 28 Aug 2017, 06:47

Changing a room's group ID to a previously unused ID

Postby OlegPumpkin » 18 Apr 2018, 02:48

When writing my server extension I noticed that if I call Room.setGroupId passing an ID that's not in the zone's list of groups (retrieved with Zone.getGroups) it will not be added to the list and the room will remain in whichever group it's in (retrieved with Zone.getRoomListFromGroup). The room will still get the new ID though (retrieved by Room.getGroupId).

I read an old thread mentioning that group IDs are added when rooms are created. Is this still the only way of adding groups programmatically?

I'm using groups to find suitable rooms to put new clients into. I encode a language ID and a game activity ID into the group ID to accomplish this. My assumption has been that groups are meant to serve scenarios like this. Is this the case or would you recommend a custom solution?

Edit: I did some more testing and found that setting a room's group ID to an ID that exists will not update the group lists either. I suppose Room.setGroupId is an internal method not meant to be called by the user, and that a rooms can't change group after creation. Is this correct?
User avatar
Lapo
Site Admin
Posts: 22999
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: Changing a room's group ID to a previously unused ID

Postby Lapo » 18 Apr 2018, 08:31

Hi,
the group is assigned at creation time, but you can't change it after the Room has been created.

I read an old thread mentioning that group IDs are added when rooms are created. Is this still the only way of adding groups programmatically?

Correct. You create a Room and assign it to a group.

Cheers
Lapo
--
gotoAndPlay()
...addicted to flash games

Return to “SFS2X Questions”

Who is online

Users browsing this forum: No registered users and 55 guests