OK... Turn-based multiplayer work continues. I am making good progress but have hit a snag.
As far as I understand, for Photon, the game state data is stored by a room's Custom Properties.
My game has a deck of cards, so to test things out I am storing the order of the deck in a Custom Property.
I can retrieve the deck data from Photon AOK, but can't seem to get it in CloudScript.
Here is the callback I am using to investigate things:
// Triggered automatically when a Photon room is first created handlers.RoomCreated = function (args) { server.WriteTitleEvent({ EventName : "room_created", Body: { "ID" : args.GameId, "Players" : args.CreateOptions.MaxPlayers, "Args" : args, "Custom Properties" : args.CreateOptions.CustomProperties, "Deck" : args.CreateOptions.CustomProperties.Deck, "State" : args.State } }); };
However, when I investigate the resultant Playstream event, the JSON looks like this:
{ "EventName": "room_created", "EventNamespace": "title.B433", "EntityType": "title", "Source": "B433", "EventId": "477e84a04e63480388e839a0c833d66f", "EntityId": "B433", "SourceType": "GameServer", "Timestamp": "2017-10-25T19:28:23.635286Z", "History": null, "CustomTags": null, "Reserved": null, "ID": "257165017963", "Players": 2, "Args": { "ActorNr": 1, "AppVersion": "1.0_1.83", "AppId": "3311d6d1-1323-4dd6-9b6d-17d1d40a84aa", "CreateOptions": { "MaxPlayers": 2, "IsVisible": false, "LobbyId": null, "LobbyType": 0, "CustomProperties": {}, "EmptyRoomTTL": 12000, "PlayerTTL": -1, "CheckUserOnJoin": true, "DeleteCacheOnLeave": false, "SuppressRoomEvents": false, "PublishUserId": true, "ExpectedUsers": null }, "GameId": "257165017963", "Region": "CAE", "Type": "Create", "UserId": "59FCE1AD1A872162", "Username": "" }, "['Custom Properties']": {} }
The custom properties do not seem to be getting sent. Or am I just coding it wrong (Java is not my strong suit)?
Any ideas how to correctly reference the Custom Properties of my room?
Thanks,
Dan