Page 1 of 1

Connection between Game Master and Server

Posted: 09 Sep 2025, 11:53
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?

Re: Connection between Game Master and Server

Posted: 09 Sep 2025, 15:42
by Lapo
Hi,
I am not sure what is a Game Master... can you clarify?

Thanks

Re: Connection between Game Master and Server

Posted: 09 Sep 2025, 16:32
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.)

Re: Connection between Game Master and Server

Posted: 10 Sep 2025, 06:42
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

Re: Connection between Game Master and Server

Posted: 10 Sep 2025, 07:51
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.

Re: Connection between Game Master and Server

Posted: 10 Sep 2025, 13:42
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

Re: Connection between Game Master and Server

Posted: 11 Sep 2025, 12:17
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