Page 1 of 1

SFS2X Room Architecture

Posted: 14 Feb 2013, 21:50
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.

Re: SFS2X Room Architecture

Posted: 19 Feb 2013, 20:55
by atarax
can i please get an answer on this topic from one of the admins.

thank you.

Re: SFS2X Room Architecture

Posted: 20 Feb 2013, 09:24
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.

Re: SFS2X Room Architecture

Posted: 20 Feb 2013, 09:25
by Lapo