Microsoft Azure PlayFab logo
    • Multiplayer
    • LiveOps
    • Data & Analytics
    • Add-ons
    • For Any Role

      • Engineer
      • Designer
      • Executive
      • Marketer
    • For Any Stage

      • Build
      • Improve
      • Grow
    • For Any Size

      • Solo
      • Indie
      • AAA
  • Runs on PlayFab
  • Pricing
    • Blog
    • Forums
    • Contact us
  • Sign up
  • Sign in
  • Ask a question
  • Spaces
    • PlayStream
    • Feature Requests
    • Add-on Marketplace
    • Bugs
    • API and SDK Questions
    • General Discussion
    • LiveOps
    • Topics
    • Questions
    • Articles
    • Ideas
    • Users
    • Badges
  • Home /
  • General Discussion /
avatar image
Question by aaron123 · Jun 29, 2017 at 10:18 PM · unity3dphoton

Current State of Turn Based Games

Iv'e read most of the previous related questions but I want a little clarification. Im making a turn based async game (think risk for mobile) using Unity and Photon. From what I understand, I should create a "GameState" json string in unity after each turn containing all of the important game information (characters, their positions/health) and then send this to PlayFab Group data to be stored for the current room/game. Then, when a player rejoins the room, I can replicate this gamestate in unity by using photons WebRPCs to get the current "GameState" json string from Playfab and parsing it out to replicate the game on the rejoining client. I repeat the sendGameStateToPlayfab(string gameStateJson) function (that I make) after each turn so that it is constantly up to date and any rejoining or just joining players can replicate it on their client. Is this the correct use of PlayFab for an async game? I know its primarily used for authentication and what not, but is their a better way to do the persistent room stuff?

Comment

People who like this

0 Show 0
10 |1200 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

1 Reply

· Add your reply
  • Sort: 
avatar image
Best Answer

Answer by Brendan · Jun 29, 2017 at 11:23 PM

For the sake of others who haven't seen it, this is the main thread where we discussed saving the state of async games in Photon: https://community.playfab.com/questions/515/207129407-Persistent-turn-based-games-.html.

In general, the pattern would be:

At the end of a player's turn, write the game state info to a Shared Group.

When another player starts their turn, or logs in to check the state of the game, read from that Shared Group.

Comment

People who like this

0 Show 0 · Share
10 |1200 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Navigation

Spaces
  • General Discussion
  • API and SDK Questions
  • Feature Requests
  • PlayStream
  • Bugs
  • Add-on Marketplace
  • LiveOps
  • Follow this Question

    Answers Answers and Comments

    1 Person is following this question.

    avatar image

    Related Questions

    Setting up Playfab + Photon on Unity... which SDKs do I need? 1 Answer

    Photon player properties 1 Answer

    Can the photo selected from the gallery be specific to the user logged in with playfab and displayed in the photon rooms? 2 Answers

    How to pass a value to the instantiated object? (PUN2) 1 Answer

    Viewing Users' Profile Photo in Photon Room 1 Answer

    PlayFab

    • Multiplayer
    • LiveOps
    • Data & Analytics
    • Runs on PlayFab
    • Pricing

    Solutions

    • For Any Role

      • Engineer
      • Designer
      • Executive
      • Marketer
    • For Any Stage

      • Build
      • Improve
      • Grow
    • For Any Size

      • Solo
      • Indie
      • AAA

    Engineers

    • Documentation
    • Quickstarts
    • API Reference
    • SDKs
    • Usage Limits

    Resources

    • Forums
    • Contact us
    • Blog
    • Service Health
    • Terms of Service
    • Attribution

    Follow us

    • Facebook
    • Twitter
    • LinkedIn
    • YouTube
    • Sitemap
    • Contact Microsoft
    • Privacy & cookies
    • Terms of use
    • Trademarks
    • Safety & eco
    • About our ads
    • © Microsoft 2020
    • Anonymous
    • Sign in
    • Create
    • Ask a question
    • Create an article
    • Post an idea
    • Spaces
    • PlayStream
    • Feature Requests
    • Add-on Marketplace
    • Bugs
    • API and SDK Questions
    • General Discussion
    • LiveOps
    • Explore
    • Topics
    • Questions
    • Articles
    • Ideas
    • Users
    • Badges