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
0
Question by Daftcube · Apr 13, 2014 at 06:20 AM · photonteams

Photon Unity Networking: Teams?

Hello! I'm making a multiplayer space game. I need teams for my game to be engaging or fun, but I'm not 100% sure how to do it. I have an overall concept on how it will work, but I'm not sure how if this will work or if there is a more efficient way of doing this.

My plan:

  1. When a player connects, a function is called on a 'game controller' script which asks "This player needs a team!", and sends his gameobject's address in the hierarchy to the script.

  2. The game controller checks the red team value and compares it against the blue team value. If one team has a lower amount of players than another team, put the player on the team with the lower count of players (This will sort of balance it.) If they are equal, choose red.

  3. Once the game controller selected a team for the player, the game controller locates the player's gameobject and sets the "ship controller" script's team value to either RED or BLUE. The script will resolve any friendly fire, and it should work.

Please tell me if this is a rock solid plan, if there are any flaws, or if there are places for this to be improved. Thanks for your time!

Comment
Add comment · Show 2
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 jpthek9 · Jan 07, 2015 at 04:20 PM 0
Share

Bump. This topic needs to be covered more in-depth.

avatar image SnotE101 · Feb 07, 2015 at 11:09 PM 0
Share

I agree as well.

2 Replies

· Add your reply
  • Sort: 
avatar image
0

Answer by CaptainMadbeard · Jan 08, 2015 at 05:35 AM

This plan does seem pretty solid, but you should probably use a Random.Range() command between 1 and 2 inclusive to decide where a player gets put when teams are equal. Otherwise, red team may gain an unfair advantage by having an extra player by default.

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
avatar image
0

Answer by NickK10 · Feb 08, 2015 at 12:19 AM

CaptainMadbeard said it exactly how it needs to be done.

 int RandomSelection() {
     int team = Random.Range(0, 1);
     return team;
 }
 
 
 //Then you can just do a simple. 
 
 if(RandomSelection() == 0) {
      team = "red";
 } else {
      team = "blue";
 }

Just to make it fair. When equal.

Comment
Add comment · Show 1 · 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
avatar image SnotE101 · Feb 08, 2015 at 01:22 AM 0
Share

How would you sync between the network?

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

28 People are following this question.

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

Related Questions

error CS0246: The type or namespace name `SpawnSpot' could not be found. Are you missing a using directive or an assembly reference 0 Answers

How do I keep values synchronized over the Photon Network? 1 Answer

how to put photon networg o my game? 0 Answers

Multiplayer using Photon ?? 1 Answer

Syncing audio over network using Photon Unity 3D Networking 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