How to compare local array to master client

Options
So I'm really new to networking and coding, and I've run into a wall. I'm trying to figure out what the best approach is for doing what I want and I would love some input.

In each Photon Room I have 2 or more players. Each player has the same set of dominoes, and slots where the dominoes can be placed. The players will place these dominoes independent of each other with the goal being to match placement and z-rotation of each domino to the master client's identical domino. This is where I'm stuck.

I'm trying to understand how to compare local player's domino A to master client's domino A, and do this for each domino in play. For each domino that matches rotation and parent, I want to add to a score counter and display this score on a separate scene.

As of now, I can print the local parent and rotation value for each domino, but I don't know how to compare them to the master client. I'm able to print this using a foreach loop, but haven't created an array or list. I've been looking into using RPCs and it seems like the right direction, but I'm not really sure how to approach it. I've also considered custom properties for the Room or for each player, but again, I'm not sure how to structure or execute this.

I'm happy to post any code that I have for better understanding of the project, but I'm just lost at the moment and would lovesome feedback on the best approach for something like this. Any help is appreciated, and thanks in advanced!

Comments

  • Tobias
    Options
    As the dominoes are the same for all players, I would just give them an ID and load them as part of the scene. Then, you can set a custom property per domino ID, which contains the transform data that's needed. Position and rotation (maybe just one axis). I would store those 2 values maybe as object[2].
    Custom properties force you to use a string but you can turn each int ID into a string easily.

    The master client would set the properties as room properties. Everyone else could either just keep their state local (if you don't want to send this to the others) or set player properties.

    Then, compare and assign points.

    Have a look here:
    https://doc.photonengine.com/en-us/pun/current/gameplay/synchronization-and-state