question

Zhi Kang Shao avatar image
Zhi Kang Shao asked

How to get the LobbyID as custom game server

We have custom game server hosting via PlayFab working and also players finding the server via Client/Matchmake and joining it. So far so good. Now we want to authenticate the joining player server-side using Server/RedeemMatchmakerTicket which requires the player's Ticket (received from the client) and the game server's LobbyID. How does the game server instance know its ID? Is it the <game_id> command line argument that starts the server?

Matchmaking
10 |1200

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

1 Answer

·
brendan avatar image
brendan answered

Exactly right - the <game_id> is the LobbyID of the server instance. I'll get the game server tutorial updated to reflect that.

7 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.

Zhi Kang Shao avatar image Zhi Kang Shao commented ·

Thanks for the fast reply. :)

0 Likes 0 ·
jonas.barnaby@gmail.com avatar image jonas.barnaby@gmail.com commented ·

Hi, guys

Sorry for bumping the thread but we've got some questions about this very subject, so I thought it was better to write them down here.

You said that "the <game_id> is the LobbyID of the server". If I understand it correctly this means the server itself and not any game instance generated by that server, is that correct?

Assuming this is the case. The process begins when the player selects a map in the game client, then a game instance is created on the server and Playfab notifies the player with the game instance's LobbyID (with the format of a PlayfabID) which the player uses to connect to that particular instance in the server. Thing is, the game instance created doesn't know its own LobbyID until a client connects with it. Is there a way for the game instance to know its own LobbyID? Some API call at code level?

Thanks!

0 Likes 0 ·
brendan avatar image brendan jonas.barnaby@gmail.com commented ·

Thanks - exactly the right thing to do, so that we have all the info in one place. I've edited the response to clarify - the game_id is the LobbyID of the server instance, specifically. The game build is your code, which runs in an instance. The instances run on a server host, which is the server machine.

The game_id is passed into the server instance when it is started, if you're using the default command line though, so it is definitely available on the server.

0 Likes 0 ·
ryancoastek avatar image ryancoastek brendan commented ·

Hey I just had a quick question regarding retrieving the game_id. How are these command line arguments accessed within Unity? Thanks.

0 Likes 0 ·
Show more comments
Ben avatar image Ben commented ·

Is there a difference between the LobbyID and GameID? When browsing my archived games, the LobbyID shown seems to be completely different from what is passed by the game_id argument.

0 Likes 0 ·
brendan avatar image brendan Ben commented ·

The Game ID is indeed the Lobby ID. It's a numeric value, and appears in hexadecimal form in the Archived Games tab. When you receive it on the server, you're getting a ulong, so it's in decimal form.

0 Likes 0 ·

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.