Few questions.

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

Moderators: Lapo, Bax

KVADRO
Posts: 7
Joined: 05 Jan 2018, 22:13

Few questions.

Postby KVADRO » 06 Jan 2018, 10:46

Hello World!
I'm new to SFS2X, so, i have few questions.

1) Is it a good idea to have one lobby( room ) for all players( event, for example, if my CCU is 10'000 ) in server, or i should balance them ( players ) to different lobbies( rooms ) by max count ( for example one lobby can contain maximum 200 players ) ?

2) In matchmaking process i have opponent search timer, and if this timer drops to 0, i generate NPC opponent and start game. Currently logic is:

- Player send START_MATCHMAKING_REQUEST, lobby extension handle it and try to find avaliable room. If not, new room with extension will be created and player will be placed there.
- After room was created, room's extension start delayed task for 30 seconds, and if opponent will not be found, task will init game with NPC.

Is this a good approach for such logic, or i should perform another steps?


Thanks in advance.
User avatar
Lapo
Site Admin
Posts: 23009
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: Few questions.

Postby Lapo » 06 Jan 2018, 13:57

Hello,
KVADRO wrote:1) Is it a good idea to have one lobby( room ) for all players( event, for example, if my CCU is 10'000 ) in server, or i should balance them ( players ) to different lobbies( rooms ) by max count ( for example one lobby can contain maximum 200 players ) ?

It depends: if your players need to interact with each other (e.g. chat) then thousands of players chatting in the same Room will generate massive network traffic, as every message needs to be relayed to everyone. Also events such as USER_ENTER_ROOM and USER_EXIT_ROOM will similarly create too much traffic.

Maybe it would be best to have multiple lobbies maybe splitting users by language, skill, region, game faction or similar parameters that exist in your game.

If you don't need public chats for everyone then you can just people log into the server and use the Buddy List system to interact with each other.

For a deeper understanding of these aspects I'd highly recommend these three articles:
http://docs2x.smartfoxserver.com/Overview/white-papers (choose the "SmartFoxServer 2X Architecture" document)
http://docs2x.smartfoxserver.com/Develo ... chitecture
http://docs2x.smartfoxserver.com/Advanc ... y-list-api

2) In matchmaking process i have opponent search timer, and if this timer drops to 0, i generate NPC opponent and start game. Currently logic is:

- Player send START_MATCHMAKING_REQUEST, lobby extension handle it and try to find avaliable room. If not, new room with extension will be created and player will be placed there.
- After room was created, room's extension start delayed task for 30 seconds, and if opponent will not be found, task will init game with NPC.
Is this a good approach for such logic, or i should perform another steps?

Yes, this sounds very efficient. I would not change it.

Hope it helps
Lapo
--
gotoAndPlay()
...addicted to flash games
KVADRO
Posts: 7
Joined: 05 Jan 2018, 22:13

Re: Few questions.

Postby KVADRO » 06 Jan 2018, 16:39

Thanks for your answer, Lapo!
KVADRO
Posts: 7
Joined: 05 Jan 2018, 22:13

Re: Few questions.

Postby KVADRO » 06 Jan 2018, 18:09

Few more question.

- Does room has 'isOpen' property? Similar to Photon isOpen property of room?
Or i should manually manage this through room variable?

- [ Resolved: SmartFoxServer.getInstance().getAPIManager().getGameApi().quickJoinGame ] Do we have in server side some api similar to client QuickJoinGameRequest ( OBJ-C ) request?
Or i should manually get all rooms for some group, and use getApi().findRooms() ?

Code: Select all

List< Room > rooms = getParentExtension().getParentZone().getRoomListFromGroup( "game" );
       
if( rooms.isEmpty() )
{
    // TODO : Create room.
    return;
}
     
MatchExpression expr = new MatchExpression( "open", NumberMatch.EQUALS, true );
rooms = getApi().findRooms( rooms, expr, 1 );


( In documentation related to Game API mentioned "Another feature offered by the Game API (both client and server side) is the QuickJoinGame request.", and in API reference we have class 'QuickJoinGame'. But how can i use it in server side? )

- getApi().findRooms will return me room even if it full?
Last edited by KVADRO on 06 Jan 2018, 19:34, edited 1 time in total.
User avatar
Lapo
Site Admin
Posts: 23009
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: Few questions.

Postby Lapo » 08 Jan 2018, 09:06

KVADRO wrote:Few more question.

- Does room has 'isOpen' property? Similar to Photon isOpen property of room?
Or i should manually manage this through room variable?

There is an isActive() getter/setter that allows you to deactivate the Room. When in that state users won't be able to join.
- [ Resolved: SmartFoxServer.getInstance().getAPIManager().getGameApi().quickJoinGame ]

FYI there's a much shorter way to do that:

Code: Select all

getApi().quickJoinGame(...)

in other words in your Extension (and Extension event handlers) you have a quick access to the API object via getApi()

( In documentation related to Game API mentioned "Another feature offered by the Game API (both client and server side) is the QuickJoinGame request.", and in API reference we have class 'QuickJoinGame'. But how can i use it in server side? )

They work very similarly,
You pass a MatchExpression and a Zone and the system will find a matching Room and join the user, if such Room exists.
See the javadoc for more:
http://docs2x.smartfoxserver.com/api-do ... meApi.html

- getApi().findRooms will return me room even if it full?

No, it won't.

Cheers
Lapo

--

gotoAndPlay()

...addicted to flash games

Return to “SFS2X Questions”

Who is online

Users browsing this forum: No registered users and 51 guests