Connection between Game Master and Server

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
Ardito
Posts: 145
Joined: 12 Sep 2016, 11:26
Location: Italy

Connection between Game Master and Server

Post by Ardito »

Hi, I'm creating a real-time game in Unity. I created a Game Client and a Game Master. The Game Client communicates with the server easily, using this command:

Code: Select all

sfsConnection.Send(new ExtensionRequest("match", objOut, sfsConnection.LastJoinedRoom));


The Game Master doesn't have a user and doesn't have a Room set up. How can I get it to communicate with the server?
User avatar
Lapo
Site Admin
Posts: 23438
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: Connection between Game Master and Server

Post by Lapo »

Hi,
I am not sure what is a Game Master... can you clarify?

Thanks
Lapo
--
gotoAndPlay()
...addicted to flash games
Ardito
Posts: 145
Joined: 12 Sep 2016, 11:26
Location: Italy

Re: Connection between Game Master and Server

Post by Ardito »

When a RealTime game starts, my sfs2x server currently launches a Unity instance where the actual game will take place. The Game Client is the version users will have to play. (Some call it the Game Server.)
User avatar
Lapo
Site Admin
Posts: 23438
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: Connection between Game Master and Server

Post by Lapo »

Ardito wrote:Hi, I'm creating a real-time game in Unity. I created a Game Client and a Game Master. The Game Client communicates with the server easily, using this command:

Code: Select all

sfsConnection.Send(new ExtensionRequest("match", objOut, sfsConnection.LastJoinedRoom));



Communication between a client and the server is bi-directional.
From client side you can call an Extension on the server side. Similarly a server side Extension can send messages via the send() method.

The Game Master doesn't have a user and doesn't have a Room set up. How can I get it to communicate with the server?

Why not. If the Game Client is connected to the server, then at least a User representing it exists.
The Room may not exist if the Game Client is not joined in any, but that doesn't prevent you from sending messages to the client. All you need is the User.

Cheers
Lapo
--
gotoAndPlay()
...addicted to flash games
Ardito
Posts: 145
Joined: 12 Sep 2016, 11:26
Location: Italy

Re: Connection between Game Master and Server

Post by Ardito »

Okay, now I understand. I'm creating a logic to integrate users into the Game Master, but I have no idea how many users I need to create. Wouldn't it be better to have Game Master users log in as Guest?

Thank you so much for your support.
User avatar
Lapo
Site Admin
Posts: 23438
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: Connection between Game Master and Server

Post by Lapo »

Wouldn't it be better to have Game Master users log in as Guest?

Yes but what about other Users who may try to reach your SmartFoxServer and login as guest as well?
Your Game Masters could all login with a name that starts with a specific prefix, such as "GM" and then an arbitrary number. For example: "GM10". This way you can recognize these "special users". Also they would need to provide a password to make sure they're legit.

If a User "GM52" tries to log in and it provides the right Game Master password (which would be the same for all GMs) then you know it is legit.

That's just an idea.
Cheers
Lapo
--
gotoAndPlay()
...addicted to flash games
Ardito
Posts: 145
Joined: 12 Sep 2016, 11:26
Location: Italy

Re: Connection between Game Master and Server

Post by Ardito »

I'd already figured out the logic of names starting with GM followed by a random number. I also checked the IP address, which must be 127.0.0.1, but the password is actually a great idea!

Thanks, Lapo
Post Reply