Architecture for Headless Hosts with Moderator Priveleges

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

Moderators: Lapo, Bax

kaynSD
Posts: 2
Joined: 21 Jun 2021, 11:21
Contact:

Architecture for Headless Hosts with Moderator Priveleges

Postby kaynSD » 07 Jul 2021, 09:58

I'm planning on using SFS2X as an authoritative service for managing dedicated hosts for a multiplayer game; Smartfox managing user accounts, buddy lists and leaderboard / game progression databases as well as spinning up headless Unity instances of the game to act as Hosts that clients are redirected to connect to directly with a TCP or UDP framework (as covered by the two-part "Best of both worlds" blog series on this site). In this way I can have the game logic entirely run in a single C# project which has a number of additional benefits for the work I am doing.

In it's effective role as arbitrator and referee, the Headless Host will need to send and receive messages with Smartfox; a hypothetical example is the Host updating the win/loss record of the players involved, or checking the player has the current equipment that their version of the client currently claims that it has.

It is my understanding then that the Headless Host will need to itself be a Player with specific moderator level account Permissions to access extension methods that regular players should not have access to; and given that an arbitrary number of these hosts could be activated at once they would need to be "Guest" accounts

From the privilege manager page I can see that I can write an extension method to change a permission profile at runtime, and with some clever command line arguments I can set up a handshake to ensure that no user accidentally gets a hold of these permissions themselves that would otherwise be exposed to Guests; so the Headless Host instance on startup can request moderator privileges from SFS2X, be granted them, confirm that it is set up, and wait for the players to connect, tinkering with the registered account variables on registered user's accounts as necessary given the game's logic.

I want to check I'm on the right track and not overcomplicating things, primarily because it sounds like an additional layer of complexity for user management, but also because I assume that these Guest users will take up a slot in the CCU allowance. While I can understand that, it certainly feels odd allocating anywhere between 1/9 to 1/3 of my CCU allowance to non-users.

Is there some other alternative I can take to get access to user variables without requiring a user to be signed into the system (such as, hypothetically, with an API call that I can access with a HTTPS call from the Headless Host or something)
User avatar
Lapo
Site Admin
Posts: 22999
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: Architecture for Headless Hosts with Moderator Priveleges

Postby Lapo » 07 Jul 2021, 13:32

Hi,
yes HTTP calls should be a perfectly valid system of communication as well, avoiding to join each headless Unity server as a logged-in User in SFS2X. Especially if SFS2X and the headless servers are running in the same private network so latency is kept to a minimum.

We have an article in our blog on how to integrate Servlets with SFS2X:
https://smartfoxserver.com/blog/http-re ... tegration/

The example here shows how to bridge Servlets and Extensions but, depending on what you need to do, you might be able to just run your code in the Servlet.

If there's any other questions let us know.
Cheers
Lapo
--
gotoAndPlay()
...addicted to flash games
kaynSD
Posts: 2
Joined: 21 Jun 2021, 11:21
Contact:

Re: Architecture for Headless Hosts with Moderator Priveleges

Postby kaynSD » 07 Jul 2021, 13:49

Perfect, exactly what I need.
Thanks Lapo!

Return to “SFS2X Questions”

Who is online

Users browsing this forum: No registered users and 37 guests