Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
2
Question by timsk · Apr 11, 2012 at 05:08 PM · c#networkrpc

Check bool on another player

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 :).

Comment
Add comment · Show 6
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image DJSwiti · Apr 11, 2012 at 05:26 PM 0
Share

Have you tried doing a "static bool ready = false;" on every players? And then a if(PlayerX.ready == true && PlayerY.ready == true) ......

avatar image timsk · Apr 11, 2012 at 05:34 PM 0
Share

static variables would suit the situation I think. $$anonymous$$y 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."

avatar image DJSwiti · Apr 11, 2012 at 05:45 PM 0
Share

Shit yea. Leaves IN the game or BEFORE launching the game ? If everyone isn't ready, Player2 can leave, to free his place. I think you must write it down on paper. it's called "specifications" : you write all the features down that you want to do, and then check if it's realizable or not, and if it is, then, check how you can do it.

avatar image timsk · Apr 11, 2012 at 05:50 PM 1
Share

I 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 consu$$anonymous$$g to allow. I don't feel that a simple "ready check" should make us re-think the decision to allow during-game joins.

avatar image DJSwiti · Apr 11, 2012 at 06:17 PM 0
Share

No problem. But think of that : nowadays, very recent games has that function, and if only severals games use that system, i think it is because it is hard to make. And devs are not alone on the project. Here you are the only guy. And you are not so experienced. I think you should give up that "replace player who was in ame" feature. Think first of your game, and of bans if a players leaves.

Show more comments

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by Jaws959 · Feb 13, 2015 at 07:54 AM

Hi there, I am actually trying to do exactly the same scenario here on a game I am currently making. For each player, the Photon Network Plugin uses allocated View ID's which can be set for each player for example, "int userID = PhotonNetwork.AllocateViewID ();" Using this might help you control each player's view as you can write IF statements for their specific userID, however I still do not know how to get the boolean synchronized to make ready check.

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

7 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

how to properly clean up the NetworkView to prevent errors ? 0 Answers

Multiplayer Moving Bullet 1 Answer

Check RPC is from Server 1 Answer

RPC call not sending correct data 0 Answers

How can i send a Player list to every Client 0 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges