- Home /
How do you make teams in a multiplayer game?
I'm currently making an 8-bit retro multiplayer game, but I don't know how to make teams. I've watched this video: Unity:Tutorial on intro to networking to make a multiplayer game, but it doesn't tell you how to have different types of players. I need my game to have two teams: Red, and Blue, I want the player's to be different colors depending on their team. I also need to have different spawn points for each team. So, basically I need help with making teams, and have different colored players, and having different spawn points.(BTW my players are cubes/boxes)
Have you successfully finished a single-player game? It sounds like the problems you are having are pretty elementary, (a spawn point is just a Vector3, a $$anonymous$$m color is just a $$anonymous$$aterial...) and if you can't figure that stuff out, then the real program$$anonymous$$g issues you're going to come up against in making a >2 player networked game will be way over your head and you should spend more time on the basics.
I think I'll follow $$anonymous$$iloblargh's advice and work on more basic things.
Answer by nastasache · Dec 16, 2013 at 10:29 AM
To create teams, you can simple use some variables along the players, specifying the team; there's nothing special but basic logic. For example:
Having a players list:
playersNames[1] = A;
playersNames[2] = B;
playersNames[3] = C;
playersNames[4] = D;
And two collections of spawn points:
spawnPointsRed[0] = Vector3;
spawnPointsRed[1] = Vector3;
spawnPointsRed[2] = Vector3;
spawnPointsBlue[0] = Vector3;
spawnPointsBlue[1] = Vector3;
spawnPointsBlue[2] = Vector3;
when player join, choose name, Red or Blue, fill the playersNames, look to indexes and fill other list by player index as:
playersTeams[1] = Red;
playersTeams[2] = Red;
playersTeams[3] = Blue;
playersTeams[4] = Blue;
So players A&B = Red team, players C&D = Blue team.
Spawn players A&B in a random value from spawnPointsRed, assign Red material.
Spawn players C&D in a random value from spawnPointsBlue, assign Blue material.
I will integrate a feature like this on next update of FPShootNet project under Asset Store.
Thanks, UFO You can see these working at http://www.addframe.net/index.php?p=fpshootnet (multiplayer); I have used exactly above rules.
Answer by edthered1009 · Aug 28, 2019 at 06:37 PM
How do I change my playermodels? There is only a few color differences between the two models, so how do I change them without going through the strenuous process of changing all of those references?
Thanks!
Your answer
Follow this Question
Related Questions
Unity networking tutorial? 6 Answers
Muliplayer Team System? 1 Answer
Syncing SpriteRenderer Between Clients 0 Answers
How do I setup a specific Multiplayer game where there are rounds and teams? 1 Answer