SFS2X Room Architecture

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
atarax
Posts: 6
Joined: 25 Feb 2011, 13:45

SFS2X Room Architecture

Post by atarax »

I am coming from using electroserver background.
How I would set that up is to extend a class to do a custom room then place the java file in the extension.xml

I am just starting to work with rooms in smartfox2x and its different.
There is a zone plugin, and you can also have room plugins?

What I am trying to do is have users join a room for a battle, then when the battle is going on all users in the room will get messages for that battle.
The room obviously needs custom battle logic.

The way i see it i have 2 options
1. create a custom room plugin to handle the custom logic.
2. keep all the custom logic in the zone plugin's code and route requests through the room like
- user sends request to zone plugin, zone plugin goes to a battle handler class, battle handler class grabs the room using sfs2x api and sends request to all users in room

Whats the best way to do this?? Didn't see much in the documentation about exactly how it should work for 2FS2x just general documentation.
atarax
Posts: 6
Joined: 25 Feb 2011, 13:45

Re: SFS2X Room Architecture

Post by atarax »

can i please get an answer on this topic from one of the admins.

thank you.
User avatar
Lapo
Site Admin
Posts: 23438
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: SFS2X Room Architecture

Post by Lapo »

Hi sorry for the delay.
I am just starting to work with rooms in smartfox2x and its different.
There is a zone plugin, and you can also have room plugins?
Yes we call them Extensions, which is basically custom java code that can be plugged at Zone or Room Level to control the logic of you game/application.
The way i see it i have 2 options
1. create a custom room plugin to handle the custom logic.
2. keep all the custom logic in the zone plugin's code and route requests through the room like
- user sends request to zone plugin, zone plugin goes to a battle handler class, battle handler class grabs the room using sfs2x api and sends request to all users in room
Both approaches are equally valid: the latter requires a bit more coding which will pay back in terms of performance. The reason is that solution #1 will instantiate a new copy of the Extension for each Room.

If you plan to have thousands and thousands of concurrent game Rooms, the extra work of option #2 should help keeping the memory overhead to a minimum.
Lapo
--
gotoAndPlay()
...addicted to flash games
User avatar
Lapo
Site Admin
Posts: 23438
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: SFS2X Room Architecture

Post by Lapo »

Lapo
--
gotoAndPlay()
...addicted to flash games
Post Reply