question

sugarfreegummybear avatar image
sugarfreegummybear asked

Best way to gather statistics in a fast paced game

Hello :)

Me and friends are making our first multiplayer game where up to 4 players battle against each other in matchs which can have multiple rounds. As a multiplayer Service we are using Photon.

We want to gather, for example, accuracy data but it doesn't make sense to send the fired shots to the PlayFab after every shot - this would cause a lot of network traffic. The stats are first gathered locally during the match and sent to PlayFab when the match ends. The Cloud Script in the PlayFab backend then calculates the accuracy based on fired and hit shots and updates the player's accuracy statistic and other statistics meant to be used in leaderboards.

Is this a good approach? Do you have any tips how to prevent cheating with these kind of statistics?

Leaderboards and Statistics
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

Sure, using the webhooks that are enabled via Photon should allow you to do that. In terms of cheating, if you're using Photon Realtime, you're trusting the client to send good values. If you need to prevent cheating, you should really consider moving to custom game servers, so that you have server authority over the session.

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.

sugarfreegummybear avatar image sugarfreegummybear commented ·

Thank you for your fast answer. I'm not very familiar with the webhooks. Could you clarify for me what's the benefit of using webhooks versus just Executing the Cloud Script from the client?

0 Likes 0 ·
brendan avatar image brendan sugarfreegummybear commented ·

Photon webhooks are automatically called by their service whenever client joins a room, leaves a room, sets value on a room, etc. Have a look at this guide for setup: https://doc.photonengine.com/en-us/realtime/current/reference/playfab.

There are stubs for the Cloud Script functions for these webhooks in the revision 1 Cloud Script all titles automatically have.

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.