question

Matt avatar image
Matt asked

Multiple legacy server instances created with simultaneous connections

Hey folks,

So I'm just looking to get some information about this - I'm not sure there's anything that can be done specifically to address it.

Typically I would attempt to connect my first player and a server instance would then pop up under Active games. I would then connect another player and they would join that server instance and be matched up with the first player.

On 2 separate occasions, however, I attempted to connect 2 different players at the same exact time and they each appeared to create and join their own server instances. I don't think that'll cause any problems because I do have code that should shut down server instances if no players are connected, but I'm wondering if there's any tips or expectations revolving around this potential (but likely incredibly rare) situation.

Thanks!

-Matt

2 comments
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Sarah Zhang avatar image Sarah Zhang commented ·

Could you please provide the specific details of the process, for example, what are the API methods you use?

0 Likes 0 ·
Matt avatar image Matt Sarah Zhang commented ·

1. (client)

PlayFabClientAPI.Matchmake( new MatchmakeRequest()
{
	BuildVersion = AccountManager.ServerBuildVersion,
	Region = Region.USEast,
	GameMode = AccountManager.ServerGameMode
},
( result ) =>
{
	ConnectClient( result.ServerIPV4Address, result.ServerPort ?? 7777, result.Ticket );
},
( error ) =>
{
	...
} );

2. (client)

m_NetworkClient.Connect( m_Host, m_Port );

3. (client)

m_NetworkClient.Send( ServerMsgType.Authenticate, new AuthenticateMessage()
{
	PlayFabId = AccountManager.PlayFabID,
	...
} );

4. (server)

if( player.IsLocal )
{
	PlayFabServerAPI.AuthenticateSessionTicket( new AuthenticateSessionTicketRequest() { SessionTicket = authMsg.AuthTicket }, ( result ) =>
	{
		...
	}, ProcessCloudError );
}
else
{
	PlayFabServerAPI.RedeemMatchmakerTicket( new RedeemMatchmakerTicketRequest() { Ticket = authMsg.AuthTicket, LobbyId = ServerSettingsData.GameId.ToString() }, ( result ) =>
	{
		...
	}, ProcessCloudError );
}
0 Likes 0 ·
Sarah Zhang avatar image
Sarah Zhang answered

Do you mean you want to let the second player join the existing session? If so, as our documentation -- https://docs.microsoft.com/en-us/rest/api/playfab/client/matchmaking/matchmake?view=playfab-rest said, if the goal is to match the player into a specific active session, only the LobbyId is required.

10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Matt avatar image
Matt answered

Not quite. So I set my server instances to support many players (each game is a 1-vs-1 battle, but I have a single instance support something like 10,000 players). When I first enable a build in a particular region, there are no server instances. When the first player attempts to connect to a multiplayer game, PlayFab will instantiate a server instance that the player can join (and up to 9,999 others). The second player would attempt to join a multiplayer game also, and they would actually join that existing server instance and possibly get matched with the first player (if they have the same honor and such). However...it seems like there's a rare chance that the second player, if attempting to join at the exact same time as the first player, ends up creating his/her own instance, thus having 2 server instances running at once.

10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.