Hi everyone,
I’ve recently started the multiplayer for a project. I don’t have much experience with networking in unity, so I’m blaming lack of experience for this brain-block…
My problem is:
I have a bool ready; This bool is used on the menu to see if the player is ready, if they are display that they are and show a “Start game” button. Easy stuff! Now I’m having trouble checking the ready status of other players. All players need to know the ready status of all the other players, so that the GUI will update for each player.
This really boils down to “How do I check a variable on another player across a network”. RPC’s can’t return values for obvious reasons.
I have tried using RPC’s to pass variables, as shown in This Question but even then, I need to update the GUI based on the value of other players variable status, not just assign a variable to another players variable. I was thinking of assigning each player a number, then associating the ready bool in some way to that… But then it all gets convoluted and I start feeling like I’m overthinking things.
I would’ve thought that accessing variables on other players would be pretty simple, as I’m sure it would be used a LOT in multiplayer games, if someone could shed some light on this for me that would be great.
Thanks a lot!
Edit: I’m using Photon Cloud for networking. Not sure if that opens more options for me, or helps someone help me :).
static variables would suit the situation I think. My problem with your idea would be "playerx". Where and how would "playerx" be assigned? I did design I small system of incrementing an int when a player joins, then adding that to the end of a string variable set to "Player". But my problem with that is, what happens if player2 leaves in a 4 player game? Again... "then it all gets convoluted and I start feeling like I'm overthinking things."
– timskI know how to prepare and design a system before I start working on it, I also don't feel that advice helps to answer the question. Thank you though, I appreciate that your trying to help. I feel you may be fishing for information: We would like to leave the game open to players during a game, this feature might be removed later if it proves too difficult and time consuming to allow. I don't feel that a simple "ready check" should make us re-think the decision to allow during-game joins.
– timskI think i will but in here and say that he is not the only guy we are a team of 5 this is the last thing we need to get right before we will move on and start adding actual gameplay features. Also Timsk is very experienced in code and i know for a fact he knows C#, JS, ObjectiveC all he is asking is "Is there a simple way to do this" or is it as complicated as it seems thats why he asked "Or am i overcomplicating things"
– john-essy