Webhook for Player Properties Changes

JohnTube
JohnTube ✭✭✭✭✭
Hi,

Since changing the Player's properties will broadcast an event to the other players can you add a webhook to get the updates from server side like with Room properties ?

edit : Is it possible to have PlayerProperties available in the GameJoin Webhook ?
edit 2 : Is it possible to include a isInactive per Player in the GameEvent Webhook ? I want to know if the opponent is inactive when sending a move to send a push notification directly from server side code instead of client code. The only workaround I see is to add a flag in the event data.

Thanks

Comments

  • JohnTube wrote:
    Since changing the Player's properties will broadcast an event to the other players can you add a webhook to get the updates from server side like with Room properties ?
    That is what the SetProperties Webhook is for ... like for events you have to set the flag:
    opParameters.Add(ParameterCode.EventForward, true);
    JohnTube wrote:
    edit : Is it possible to have PlayerProperties available in the GameJoin Webhook ?
    Not in the current version - can't promise when we'll do - but I agree the feature makes sense.
    JohnTube wrote:
    edit 2 : Is it possible to include a isInactive per Player in the GameEvent Webhook ? I want to know if the opponent is inactive when sending a move to send a push notification directly from server side code instead of client code. The only workaround I see is to add a flag in the event data.

    Not with the current live version - but we already noticed this. And we're adding it in the update planned for this week.
  • JohnTube
    JohnTube ✭✭✭✭✭
    Philip wrote:
    That is what the SetProperties Webhook is for ... like for events you have to set the flag:
    opParameters.Add(ParameterCode.EventForward, true);

    I don't know if you got my question but I'm assuming you did.
    I will try this by implementing an override method OpSetPropertiesOfActor in LoadBalancingPeer that takes 3 parameters :
    public virtual bool OpSetPropertiesOfActor(int actorNr, Hashtable actorProperties, bool webForward) {
                if (this.DebugOut >= DebugLevel.INFO) {
                    this.Listener.DebugReturn(DebugLevel.INFO, "OpSetPropertiesOfActor()");
                }
    
                Dictionary<byte, object> opParameters = new Dictionary<byte, object>();
                opParameters.Add(ParameterCode.Properties, actorProperties);
                opParameters.Add(ParameterCode.ActorNr, actorNr);
                opParameters.Add(ParameterCode.Broadcast, true);
                if (webForward) {
                    opParameters[ParameterCode.EventForward] = true;
                }
                return this.OpCustom((byte)OperationCode.SetProperties, opParameters, true, 0, false);
            }
    
  • Re-reading your original question ...
    Since changing the Player's properties will broadcast an event to the other players can you add a webhook to get the updates from server side like with Room properties
    ... Yes - you can trigger it like when you set Room properties.

    Meaning that the code change you propose in the client should work - and is what I meant.
  • JohnTube
    JohnTube ✭✭✭✭✭
    Then why don't you rename the GameProperties / SetProperties webhook and update the documentation here and your post here ? And add the option to do this from the LoadBalancingClient ?

    edit : I can confirm that this works after testing it but it would be perfect if we could make a difference between Roomproperties and PlayerProperties like from client side (// we get PLAYERproperties if actorNr > 0 or ROOMproperties if actorNumber is not set or 0).
  • JohnTube wrote:
    Then why don't you rename the GameProperties / SetProperties webhook and update the documentation here and your post here ? And add the option to do this from the LoadBalancingClient ?

    edit : I can confirm that this works after testing it but it would be perfect if we could make a difference between Roomproperties and PlayerProperties like from client side (// we get PLAYERproperties if actorNr > 0 or ROOMproperties if actorNumber is not set or 0).

    Hi John,

    thanks and you do have a point - we'll have to discuss on our end on how to proceed.

    -Philip