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 /
  • API and SDK Questions /
avatar image
Question by Denzie Gray · Sep 19, 2020 at 05:03 PM · Player Dataunity3dphotonShared Group Data

Is there an Updated guide for Async Photon Unity? Turnbased Chess Game

I took a look at:
https://community.playfab.com/questions/9573/memorydemocloudscript-question.html?childToView=10075#comment-10075

and:
https://community.playfab.com/questions/515/207129407-Persistent-turn-based-games-.html

And I have some questions in regards to integrating Async Multiplayer in our game.

The game is a Chess Variant built in Unity and I am looking for the best practices for creating and loading the games and storing completed games for a replay feature.

The threads above mention Shared Group Data and User Group Data having a 100 key limit.

Is there another way/API in playfab to cache the games?

https://community.playfab.com/questions/668/208478838-GetGameList-implementation-in-Photon-Cloudscript-example-missing.html

The above thread seems outdated but doesn't offer a new option.

Using this next link for the following questions:
https://github.com/JohnTube/MemoryDemoCloudScript/blob/master/MemoryDemo.js

In regards to Photon, when we return an response other than 0(considered "SUCCESS"), does that error prevent the intercepted call from completing? Could a dev use this to prevent state change?

In "if(args.Type==='Create')" on line 274, we have an if statement, is this value based solely on the users command? What I mean is say the Room already exists and I call the create method as a client will the handler on 268 be called or will the client be rejected? And what if I call Create and the room is cached/inactive? Do I have to check all saved rooms?


The last ones are probably questions for Hamza.

There seems to be some ambiguity in what Photon abdicates to PlayFab/External Webhooks and I would like some clarity. An updated Turn based example would be useful. Does one exist?

Thanks for reading. I look forward to a long discussion.

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 Hamza Lazaar · Sep 20, 2020 at 12:56 AM

Hi @Denzie Gray,

Thank you for choosing Photon!

Hamza here, replying to questions addressed to me or related to Photon:

"In regards to Photon, when we return an response other than 0(considered "SUCCESS"), does that error prevent the intercepted call from completing?"

As you can read in the documentation here, ResultCode!=0 in PathCreate response (and IsPersistent is true and both PathCreate & PathClose) will result in a failure of room creation (or loading): client will receive error code 32752.

In all other hooks except PathGameClose, if ResultCode!=0 and if HasErrorInfo is true, all joined clients will receive ErrorInfo event but the operation itself triggering the hook will be processed successfully. In PathClose, simply nothing special happens no matter the ResultCode value the room will be removed from Photon server.

"does that error prevent the intercepted call from completing?" ==> yes and no. yes in PathGameCreate and IsPersistent is true and both PathCreate & PathClose are configured. no in others.

"Could a dev use this to prevent state change?" ==> not sure I get this but the idea behind it is to allow or not room creation or loading when persistence is used.

"In "if(args.Type==='Create')" on line 274, we have an if statement, is this value based solely on the users command? What I mean is say the Room already exists and I call the create method as a client will the handler on 268 be called or will the client be rejected? And what if I call Create and the room is cached/inactive? Do I have to check all saved rooms?"

most of the following is just summarizing or rewriting the webhooks documentation page:

A. If the client calls CreateRoom:

A.1. if the room exists/lives in Photon server, no webhook triggered and an error (32766) will be returned to the client.

A.2. if the room does not exist in Photon server, PathCreate webhook will be triggered with argument Type == Create.

B. if the client calls JoinRoom:

B.1. if the room exists/lives in Photon server, PathJoin webhook will be triggered.

B.2. if the room does not exist in Photon server, if AsyncJoin is true (or not configured) and IsPersistent is true and both PathCreate & PathClose are configured PathCreate webhook will be triggered with argument Type == Load. otherwise, no webhook triggered and an error (32758) will be returned to the client.

C. if the client calls JoinOrCreateRoom:

C.1. if the room exists/lives in Photon server, PathJoin webhook will be triggered.

C.2. if the room does not exist in Photon server, if AsyncJoin is true (or not configured) and IsPersistent is true and both PathCreate & PathClose are configured PathCreate webhook will be triggered with argument Type == Load. otherwise, no webhook triggered and the room will be created.

D. if the client calls RejoinRoom:

D.1. if the room exists/lives in Photon server, PathJoin webhook will be triggered.

D.2. if the room does not exist in Photon server, if IsPersistent is true and both PathCreate & PathClose are configured PathCreate webhook will be triggered with argument Type == Load. otherwise, no webhook triggered and the room will be created.

---

After that, in PathCreate, it's your responsibility to allow or disallow room creation or return any previously saved room state.

"There seems to be some ambiguity in what Photon abdicates to PlayFab/External Webhooks and I would like some clarity. An updated Turn based example would be useful. Does one exist?"
there is no demo and I don't think there will be any time soon.

Comment
Denzie Gray

People who like this

1 Show 6 · 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
avatar image Denzie Gray · Sep 21, 2020 at 05:28 AM 0
Share

First, Thanks for the response!

C.2. if the room does not exist in Photon server, if AsyncJoin is true (or not configured) and IsPersistent is trueand bothPathCreate & PathClose are configured PathCreate webhook will be triggered with argument Type == Load. otherwise, no webhook triggered and the room will be created.


When you mean otherwise, you mean that if AsyncJoin or etc is not set? ex:
JoinOrCreate will be Type == Create if Async & IsPersistent &
and both PathCreate & PathClose are configured and the room does not exist?


Are there any plans to allow the interception of the other handlers similar to PathCreate?


If I edit the 'State' during RoomPropertyUpdates could I return it to users as a way to
enforce valid state? I ask because in your Load example of MemorDemoCloud.js I saw you return 'State'.


Lastly When I send an error to the client, the log returns the PhotonSecretKey in the message. Is this a bug? I set ErrorInfo to false and waited and I still saw the Key. Is there a setting to disable it?

avatar image Hamza Lazaar Denzie Gray · Sep 21, 2020 at 11:16 AM 1
Share

"When you mean otherwise, you mean that if AsyncJoin or etc is not set?"

I mean any of the conditions is not met: AsyncJoin is false, IsPersistent is false, PathCreate is not configured, PathClose is not configured.
"Are there any plans to allow the interception of the other handlers similar to PathCreate?" not in the near future, no ETA.

"If I edit the 'State' during RoomPropertyUpdates could I return it to users as a way to enforce valid state?"
State can be edited but this is not recommended and risky and we do not fully support this as State can become broken easily. I personally modify State but in order for this to take effect:
- edit only the nonbinary parts.
- keep same types and range, etc. values changed should be valid.

- if you add or remove values also, State should remain valid still.
- modify State given in PathClose, Type="save" and return modified version in response to PathCreate, Type="Load"
"
Is there a setting to disable it?"
No.

avatar image Denzie Gray Hamza Lazaar · Sep 21, 2020 at 04:49 PM 0
Share

1:

"State can be edited but this is not recommended and risky and we do not fully support this as State can become broken easily. I personally modify State but in order for this to take effect:
- edit only the nonbinary parts.
- keep same types and range, etc. values changed should be valid.

- if you add or remove values also, State should remain valid still."


Ok, my question here is if I change the state at that time, could I return it like in RoomCreate?


Say a user changes a value and RoomPropertyUpdated is triggered:

If I follow your guidelines and alter the 'State' in the call would they get the changes

I made included in the update?


2:

"Is there a setting to disable it?"
No.

For your last response, isn't it dangerous to send the Secret Key?
Right now, a user could read it in the player.logs. Is this not a problem? Wouldn't a user be able to make calls to the API? How can I send a non-0 ResultCode without exposing the key?

In a previous thread there was a limit of 100 games. Is that still the case?


Thanks again for responding.

EDIT:

If a client sets webhooks to false via a hack or w.e., would the command execute?
I mean if they set room propertites with webforward == false.

Show more comments
Show more comments
avatar image Hamza Lazaar · Sep 24, 2020 at 02:14 PM 1
Share

discussion continued here

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

    4 People are following this question.

    avatar image avatar image avatar image avatar image

    Related Questions

    Connection PlayFab with Photon 1 Answer

    How to get Display Name by e-mail(Unity) ? 1 Answer

    Read and write frequently updated data 1 Answer

    Trouble uploading a text file as an entity file onto playfab. 1 Answer

    Unable to create game (Unity Photon, Error 32752),Unable to create match (Unity Photon, Error 32752) 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