Working Memory Demo with PlayFab?

Where can I find source of the Memory Demo with PlayFab? I know that the cloudscript is available on github, and the Memory Demo for Photon without Playfab, but is there a Memory Demo with PlayFab that uses the cloudscript from github?

Thanks!

Comments

  • JohnTube
    JohnTube ✭✭✭✭✭
    edited April 2017
    Hi @utwsoft,

    Thank you for choosing Photon!

    I guess you are the one asking here on PlayFab forums as well.
    I'm the one who made that CloudScript repo. I think some edge cases are not handled and when I did that CloudScript integration, PlayFab didn't have today's strict limits.
    You are the first person to ask for this. Thank you for your interest. My efforts are rewarded finally!
    So what you should do is:
    - create a PlayFab title
    - enable Photon Add-On for that title
    - upload the MemoryDemo CloudScript to that title
    - download the custom MemoryDemo integration with PlayFab from here (very old 2015)
    - open MemoryDemo scene
    - fix errors if any
    - set up the AppID
    - test it

    I strongly suggest to make a "simpler" custom CloudScript solution for your game with TypeScript!
    I can answer your questions regarding this here or on PlayFab forums.
  • Thanks! Yes, that is me on the PlayFab boards. I haven't had a chance to try this out yet, but hopefully I will some time. And also, thanks for the TypeScript tip. It definitely gives developing Javascript a lot more of a production environment, with Visual Studio. I can also see how this can be more streamlined with github integration in both VS and Playfab.

    Is the Memory Game Demo designed to be played synchronously even if it is turn-based? I don't fully understand some parts of the CloudScript, particularly the RoomLeft webhook:
            if (args.Inactive) {
                data.Actors[args.ActorNr].Inactive = true;
            } else {
                delete data.Actors[args.ActorNr];
                deleteSharedGroupEntry(getGamesListId(currentPlayerId), args.GameId);
            }
            if (undefinedOrNull(data.LeaveEvents)) {
                data.LeaveEvents = {};
            }
            data.LeaveEvents[timestamp] = {ActorNr: args.ActorNr, UserId: args.UserId, CanRejoin: args.Inactive};
            updateSharedGroupData(args.GameId, data);
            return {ResultCode: 0, Message: 'OK'};
    The client is set up such that if it's a turn-based game, Inactive is always set to false, so that means the current player is removed from the match data, and the room reference is removed from the gameslist, yet at the very end, we call update shared group data on the room shared group... This tells me that the room still exists (and would close after TTL?), and since the player is removed, the player cannot rejoin the game at a future time: i.e. asynchronous gameplay. Can you provide some insight into this? Thanks!
  • JohnTube
    JohnTube ✭✭✭✭✭
    The client is set up such that if it's a turn-based game, Inactive is always set to false
    I don't understand. by client you mean Unity client right? Inactive doesn't matter on the client. The key is PlayerTTL.

    This tells me that the room still exists (and would close after TTL?)
    IIRC: If by TTL you mean EmptyRoomTTL then yes. The room data (SharedGroup and value in creator's SharedGroup) is removed only in RoomClosed webhook.

    When I made that MemoryDemo CloudScript I wanted to be as much generic as possible for everything related to webhooks logic and to handle all cases and possible argument values ("Inactive" included).

    Also in a turnbased game a player can leave the game for good (resigns, "rage quit", etc.) so Inactive could be false. Some other "unexpected" leave reasons also may have Inactive set to false. See here for more details.