Page 1 of 1
Created New Extension
Posted: 10 Feb 2011, 20:38
by iceshaft07
I'm learning how these extensions worked. I've read all the docs and I have things working but I'm a little bit confused.
I have two zones set up on my server, and what I think is two extensions.
My two zones are GameLobby, and SimpleChat.
My two extensions are sfsFps and sfsTris.
My understanding of zones was that I would want to create a zone per each game-- so if I had "My Super MMORPG" and "Goldeneye 15", each would go into a seperate zone.
But I have noticed something interesting. sfsFps does not have any references in any of the zones.
How does this work? Can a zone call any extension it wants to?
Posted: 10 Feb 2011, 21:27
by tchen
SFS FPS piggybacks on the SimpleChat zone and Lobby rooms. You always need a zone.
The SimpleChat and Lobby are very permissive as examples. They'll let you ask the server to create anything: in this case a new room with an attached fps extension specified by the client code.
Posted: 11 Feb 2011, 15:11
by iceshaft07
I thought that is what was happening, but I still don't understand exactly how it is working.
Is there a way of telling a zone what extensions it has access to? I did not see something like that in admin tool.
I am guessing that every zone has access to every zone, and I have no idea what the 'set extension' view has to do with anything.
Posted: 11 Feb 2011, 18:00
by tchen
iceshaft07 wrote:
Is there a way of telling a zone what extensions it has access to? I did not see something like that in admin tool.
I am guessing that every zone has access to every zone, and I have no idea what the 'set extension' view has to do with anything.
Zones can have an optional extension associated with them under the (surprise) Zone Extension tab in the admin tool. Here you specify the file (classpath) and name of the extension (directory name).
When creating rooms, you have the option of telling SFS to associate a Room extension with it. In the admin tool, this will show up on the Room Extension tab.
In either case, as long as that extension directory exists, and there's a valid class at that given classpath, then it'll load it and attach it.
Posted: 14 Feb 2011, 18:10
by iceshaft07
Gotcha-- I see it in the code now:
Code: Select all
RoomSettings settings = new RoomSettings(roomName);
settings.GroupId = "game";
settings.IsGame = true;
settings.MaxUsers = (short)numMaxUsers;
settings.MaxSpectators = 0;
settings.Extension = new RoomExtension(NetworkManager.ExtName, NetworkManager.ExtClass);
smartFox.Send(new CreateRoomRequest(settings, true, smartFox.LastJoinedRoom));