Created New Extension

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

Moderators: Lapo, Bax

Post Reply
iceshaft07
Posts: 33
Joined: 28 Jan 2011, 20:10

Created New Extension

Post 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?
tchen
Posts: 191
Joined: 11 Dec 2010, 14:14

Post 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.
iceshaft07
Posts: 33
Joined: 28 Jan 2011, 20:10

Post 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.
tchen
Posts: 191
Joined: 11 Dec 2010, 14:14

Post 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.
iceshaft07
Posts: 33
Joined: 28 Jan 2011, 20:10

Post 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));
Post Reply