question

dan avatar image
dan asked

Do I really need Photon for Turn Based Multiplayer?

I've started work on a turn-based game that uses shared group data to log the game state and moves.

Apologies if this is a dumb question, but do I actually need Photon?

If I check the data every five seconds, I can pretty much have a sweet, turn-based flow using shared group data alone. Or am I missing something...

Cheers,

Dan

photonShared Group Data
10 |1200

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

brendan avatar image
brendan answered

Yes, if you need to have players be aware of updates from other players in real-time, you'll need to use either Photon or a custom game server. PlayFab is a backend service for games that provides a wide range of features, but polling for updates to data every few seconds would result in a high number of calls per game session per player. Depending on what other calls are necessary to run the game session, that could easily push you into a call rate that's outside the scope of our fair use terms. In general, games that are only using the core service should aim for a few API calls per minute on average (bursts are fine, as long as the average over the lifetime of the player session works out that way).

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

dan avatar image dan commented ·

Ah. Fair enough! :D

Do you have a guide for fair usage so I can make sure I am not spamming the API with the other elements in my game?

0 Likes 0 ·
brendan avatar image brendan ♦♦ dan commented ·

There's no single set of numbers we could provide, since the characteristics of the calls - total data, which specific calls are being used, etc. - varies the effective "cost" in terms of CPU and data table read/write. Simply put, our costs are largely down to how much data you change, and how frequently. We have a number of limits for the rate at which different API calls can be made, but those are "burst" rate limits that prevent any one title from impacting the performance of the service. The way to think about it is what I said above - the title should aim to make a few API calls per minute on average over the lifetime of the user session. Another way to look at this is, if you're making a dozen or more calls per minute (on average over the player session), you should definitely be optimizing.

But again, it's not a hard rule, and developers in our pro and enterprise tiers should work directly with us via a ticket, to sort out any issues or work out the details for extra resources (we can provide private verticals to allow for high call rates where needed, for those tiers).

0 Likes 0 ·
dan avatar image dan commented ·

Thanks - that's useful info! :)

0 Likes 0 ·
Chris Brooks avatar image
Chris Brooks answered

I had a similar question though not about polling. Polling is a well known anti-pattern riddled with issues :)


I am currently migrating over my back-end from another well known Cloud Code/Script based service that was recently purchased and sunsetted.


My game is turn based with up to eight players. Players enter a procedurally generated hexagonal map when the game/match is started. I would need to persist the current state of the map, player resources, units, turn order and other elements in shared group data. The system is authoritative and the shared data can only be changed after validation through cloudscript. The players cannot alter the data directly.

Example use case:

  • Player 1 attacks a unit controlled by player two.
  • The client(Unity) determines that this is possible and calls ExecuteCloudScriptRequest("Attack",args)
  • The cloudscript validates the action and updates the unit status in the shared data.
  • the cloudscript then sends an event notification to all of the players/members of that group to refresh their shared data.
  • The clients each receive the event and they update their game based on the payload.

Questions...
I have not found a way to raise and listen for an event in Unity through the playfab api.


Is this the right approach or should I design it a different way? This is similar to how the current system works in the other service.


Thanks,
Chris

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.

Error rendering WebPanel (widgets/consolidation-widget.ftl): org.hibernate.hql.internal.ast.QuerySyntaxException: AvailableConsolidation is not mapped [from AvailableConsolidation up where up.node = :node]