question

gouzhen007 avatar image
gouzhen007 asked

Live Event Hosting Technical Challenge

In our game, we are planning to host simple global live competition events like the following:

At 8PM, competition opens, players get notified and can opt in. Competition starts and say last for one minute. All players submit their scores at the end and top performances will be announced shortly. This event applies to all players and we do not divide players into groups.

Here's our plan to achieve this solely with Playfab without having our own authoritative server:

1. a CloudScript would run and create a competition token when about to host a competition.

2. Init or reset our competition leaderboard.

3. Playfab sends Notifications/Messages to our players with competition token.

4. Players can choose too join the competition will be in waiting screen.

5. Playfab sends Notifications/Messages to all participating players to start the game.

6. After player finished the game session, player will call a cloudscript with the competition token to report their score.

7. After certain cutoff time, a cloudscript runs and generates the winners and Notify/message all players.

There are few things we are not sure of.

  • How to send Notifications/Messages to players, who are currently in the game (app is running). what feature of playfab can we use to achieve this given that we also have desktop users? so I guess the push notification feature won't work.
  • Is sending a large number of notification/messages (e.g. > 10,000) at the short burst be a problem, does it exceed the limit of cloudscript running time?

Thanks for ideas and feedbacks!

CloudScriptPush Notifications
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

Can you clarify what a "competition token" is? Is it an actual inventory item, or just a Tag of some kind? How do players gain one?

What I would recommend is using a catalog item, so that the player can have tournament entry tickets that they use to join a tournament. When they try to enter a tournament, if they're not already in it, check that they have one and consume one from their total.

Sending a Push Notification (which it sounds like isn't the model you need, so more on that below, but for this, I'll address it for the folks building mobile games) to users to announce the start of an event isn't a good idea, unless you're sending it well in advance and using a delayed delivery mechanism via advanced Push features, using a plugin. If you send a Push to 100,000 players, they don't all go out in a second - it takes time to process all of them, which would give the first players an unfair advantage. Instead, I'd promote your tournament ahead of time in the in-game interface, and once it's live, have the interface reflect that. That has the added advantage of incentivizing people who haven't gotten a tournament token to get one for the next time.

Now, on 4, what is the "waiting screen"? It sounds like you mean that all the players will play at the same time. If so, you'll either need custom game servers or Photon to drive that, so that you can collect players in Rooms and then launch the tournament session.

And for 7, you could simply use our Prize Tables, potentially (https://api.playfab.com/docs/tutorials/landing-tournaments/using-prize-tables).

But all that aside, the key questions are the bottom two from your post:

1. How to send messages to players on desktop. Push Messages are for mobile, right now (Apple/Google). You could use our Email system to send notifications and updates to players, but it sounds like you want to have an instant notification system on desktop. To do that, you'd need to have an open socket connection to the client, so that you can push data to it. We do not have a built-in socket connection right now, though we do plan to add one in future. For now, you would need to use a custom game server to accomplish that.

2. Cloud Script is designed for relatively lightweight, short-lived logic. As such, trying to make thousands (or, realistically, even hundreds) of calls from it therefore would not be supported. For your specific scenario, this is really something you'll need custom game servers for.

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.

gouzhen007 avatar image gouzhen007 commented ·

Thanks for the answer. Using catalog item as token is a great idea. Regarding my second question, even if I have a custom server to send notifications to thousands to players, it will result in large number of API calls in a very short period of time too, would that not be a problem?

0 Likes 0 ·
brendan avatar image brendan gouzhen007 commented ·

In your model, there's no API call you'd be making through PlayFab, since you're not using Push - you want to send data directly to the client, which requires an open socket connection (via your server). But that said, the Server API is designed for cases where a single server might be working with thousands of connected players, so yes, it can make a high number of Server API requests per minute - far higher than the Client API. It's not unlimited, so you do need to throttle it to some extent, but if you're taking one action per player in a few seconds for 1,000 players, that's not an issue.

1 Like 1 ·

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.