Color picker on a room doesn't work! Spent 48 hrs looking for ways, nothing worked!

Options
I'm so exhausted, I've tried almost everything but nothing seems to work. When the players enter the room, I want everyone to choose a color and one person can't choose the same color with another player (Same with among us colorpicker). I've tried maybe 100 ways already and nothing seems to work. I used customroom properties and localplayer properties to do them but nothing works exactly. I'm tired and exhausted. Im so frustrated and realized that maybe you guys can help, I just hope someone would reply. This is my last resort. Thanks in advance!!

Comments

  • Tobias
    Options
    Ohboy. I'm sorry to read you're so frustrated!

    I am not sure if this is PUN or maybe you are starting from the wrong end of the story. Networked games are hard(er) to make. You have to wrap your head around what needs syncing and what doesn't. Also, nothing you do networked is instant - everything has varying amounts of lag...

    I would possibly use Custom Room Properties for this. Store the color as key and the user who uses it as value of that. The user is identified as Player.ActorNumber (an integer).
    When the Master gets in the room, let it set up the key-values with 0. To pick colors, you can then use Check And Swap (CAS) when setting the properties. Meaning: Player 1 picks color "g" (short for green) by telling the server to change the "g" property to 1 under the condition the "g" value is still 0.

    That the logic. In terms of code, have a look at the CAS description here.
  • GhegiEreh
    Options
    Tobias wrote: »
    Ohboy. I'm sorry to read you're so frustrated!

    I am not sure if this is PUN or maybe you are starting from the wrong end of the story. Networked games are hard(er) to make. You have to wrap your head around what needs syncing and what doesn't. Also, nothing you do networked is instant - everything has varying amounts of lag...

    I would possibly use Custom Room Properties for this. Store the color as key and the user who uses it as value of that. The user is identified as Player.ActorNumber (an integer).
    When the Master gets in the room, let it set up the key-values with 0. To pick colors, you can then use Check And Swap (CAS) when setting the properties. Meaning: Player 1 picks color "g" (short for green) by telling the server to change the "g" property to 1 under the condition the "g" value is still 0.

    That the logic. In terms of code, have a look at the CAS description here.

    Thank you for this. I will try this out!
  • Riad
    Options
    @Tobias

    In an effort to not start another thread, I'm having a similar but slightly different problem.

    When the players enter a room each player picks the color of their player, no problem.

    When the players enter the game all the local players have the correct colors, but all the remote players are the default gray. So you see your player as the color you picked, but the other 3 players are gray.

    I'm using SetCustomProperties to do this. Any thoughts on why all the other players would be instantiated without the color?

    If need be I can post up the code.

    Thanks in advance,
    Rob
  • Tobias
    Options
    Using SetCustomProperties to share the color is probably a good idea. At some point you need to read the value and turn it into a material / color again and assign it per player and character. This is obviously not done automatically with the sync of the prop.