question

twoten avatar image
twoten asked

Get CurrentGames from Server API

Hello!

I currently need to call the GetCurrentGames method from a Cloudscript. Here is my idea:

I want the client to call a cloudscript. The cloudscript retrieves all CurrentGames and selects one and sends back the lobby Id of that room.

But the GetCurrentGames method is not included in the server API?

How should I solve this?

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

GetCurrentGames was added to the Client API in response to a need to be able to do client-side session selection. Can you clarify what you'd like to do in Cloud Script that would specifically require that to not be done client-side?

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.

twoten avatar image twoten commented ·

We are creating matchmaking and we are only running dedicated servers. For us we have two options:

One, is to get all servers via cloudscript and then select the most full one to fill that server up.

Or Two, do the same client sided.

However, it just feels unneccecary to expose all the server ip addresses to the client that easily. Seems like a perfect job for a cloudscript.

Any player would simply be able to get a nice JSON array of the server addresses.

0 Likes 0 ·
brendan avatar image brendan twoten commented ·

I'd have to recommend simply using GetCurrentGames as-is, then. What you're describing (moving the call to the Cloud Script) doesn't actually change anything about the way the game is selected for the client in question. The recommended pattern for something like this is to use GetCurrentGames on the client, pick a sever, and use Matchmake with that server's Lobby ID to get a slot assigned. Then when you join the client to the server, use RedeemMatchmakerTicket to allow the server to validate that the client should be allowed to join.

0 Likes 0 ·
twoten avatar image twoten brendan commented ·

That's what we are currently doing. But I would much prefer to give only the lobby Id to the player.

For us we see it as quite a security issue to expose all the servers we run just like that.

0 Likes 0 ·
Show more comments

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.