question

dan avatar image
dan asked

Having a spot of bother with Photon Custom Properties and CloudScript. Help appreciated!

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

CloudScriptphoton
10 |1200

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

1 Answer

·
brendan avatar image
brendan answered

So, from your event info, everything is working as expected in terms of the callback and where the data should be - it's that for some reason, the data you're setting up in the Room in Photon isn't being sent to us. I'd have to ask you to work with the Exit Games folks to get info on why their service isn't sending that data to us, as they're the only ones who can support their service tech (we don't have access to their source code or logs). You can get support for Photon Chat and Photon Realtime in their forums, here: http://forum.photonengine.com/

2 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 ·

Coolio. I asked on the Photon forums, and apparently the custom properties need to be exposed to the lobby. This should be easy enough. Here is the Photon forum thread.

0 Likes 0 ·
Hamza Lazaar avatar image Hamza Lazaar dan commented ·

And I have answered there.

0 Likes 0 ·

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.