Teams/RoomLobby for Multiplayer FPS in Unity

Updated on May 17, 2017 in Tutorial Ideas
Share on Facebook0Tweet about this on TwitterShare on Google+0Share on Reddit0
12 on October 31, 2016

Hey there, i watched the Making a Multiplayer FPS in Unity Series and i realy liked it,
and I wanted to change my version into a Team-Shooter,
which has a Room Lobby where people can choose a team beforejoiing into the actual game.
But i have no clue how to set up teams and how to tell the network manager that it shouldnt use every spawnpoint for every player, nor do i know how to set up this room.
I already wrote a mail to Asbjørn Thirslund himself and he replied I should ask this question in the forum so that other people can benefit from this information too.
I personaly would like to see a continuation of the tutorial series, with these and more features.

  • Liked by
  • iEx15t
  • Speedymax02
Reply
0 on November 7, 2016

I also want to know what to do if I want to add NPCs to a multiplayer game.

  • Liked by
Reply
Cancel
0 on November 8, 2016

I haven’t done it before and not 100% sure but from what i know you will either have to write your own lobby manager(shouldn’t be too hard) or use the built-in lobby manager and use some clever coding.. the first one would probably be much better as it’d give you much more freedom.

  • Liked by
Reply
Cancel
0 on November 12, 2016

But how to manage Teams?

  • Liked by
Reply
Cancel
0 on December 6, 2016

For example, if i want the players from each team to have different playermodels and stats

  • Liked by
Reply
Cancel
0 on December 12, 2016

I’ve been banging my head on my keyboard trying to figure out Team Setups since this summer. There is a Pun Teams script included with PUN, it is the Red Team/Blue Team config but offers no clue how to use it.  Quill18 has an old team setup, that is kind of hit and miss years later.  The antiquated UI Button system is hard to change and not a lot of references on the old system.  I happened across this Forum because I remember seeing a tut about Photon and setting up controlls for individual players.  Q18’s moves all players at same control so far and  I’m on tut #20…..I have different playermodels for each team selected, so the change the color on one model just doesn’t cut it.  Please!  Please!  Please Brackeys do one of your clear and concise tutorials on Teams.  As Skyteks with different player modes, stats, and team scores. Oh and names displayed above heads. For this Christmas!!! Thanks for your consideration!  : D

  • Liked by
Reply
Cancel
0 on December 30, 2016

This is exactly what i mean with Teams-implementation, because the builtin unity networkmanager and networklobbymanager dont support any difference between the players (their prefabs) and different spawnpoints per team. I had hoped the “Merry Fragmas 3.0” lifestream tutorial from Unity would show that, but they once again only showed the very basics of a MP-Shooter.
It would be realy awesome if the game would have a basic team system, so that people could build onto it and make different play-modes like Team-DeathMatch, Capture the Flag and so on. Because just normal Deathmatch is very boring and there are already tons of tutorials showing only that.
So please TEAMS for the Multiplayer FPS in Unity!

  • Liked by
Reply
Cancel
0 on January 3, 2017

Are you using Photon? I created a team-based online FPS some years ago and if I remember right (don’t have Unity openend right now) you should be able to set PlayerPrefs or something similar on each player, which can store whatever you want – team, character class and so forth.. I will look at my code tomorrow if I still have it and share my code with you guys. I remember it was really, really easy once you knew how it was done! 🙂

  • Liked by
Reply
Cancel
0 on January 3, 2017

Oh nevermind.. found it..

Here’s a small portion of the code.. This will help you alot I hope

using Hashtable = ExitGames.Client.Photon.Hashtable;
public void SpawnPlayer(Team t_team)
    {
            if (OurPlayer != null)
            {
                PhotonNetwork.Destroy(OurPlayer);
            }
            Hashtable PlayerTeam = new Hashtable();
            PlayerTeam.Add("Team", t_team.ToString());
            PhotonNetwork.player.SetCustomProperties(PlayerTeam);
            if (t_team == Team.Recon)
            {
                OurPlayer = PhotonNetwork.Instantiate(Player_Team_1.name, GetSpawn(ReconSpawnPoint), Quaternion.identity, 0);
            }
            else if (t_team == Team.Delta)
            {
                OurPlayer = PhotonNetwork.Instantiate(Player_Team_2.name, GetSpawn(DeltaSpawnPoint), Quaternion.identity, 0);
            }
            else
            {
                OurPlayer = PhotonNetwork.Instantiate(Player_Team_1.name, GetSpawn(AllSpawnPoints), Quaternion.identity, 0);
            }
        }
        else
        {
    }
  • Liked by
Reply
Cancel
0 on January 3, 2017

You can also get the team, in this case of all players, like this:

foreach(PhotonPlayer player in PhotonNetwork.playerList) {
    Debug.Log("Player " + player + " team: " + (string)player.customProperties["Team"]);
}

  • Liked by
Reply
Cancel
0 on January 3, 2017

This way, you can use more than 2 teams (blue/red team that PUN wants us to use).. You can create as many teams as you like. I usually have three teams.. Team A, Team B and Spectators.. but ofc you can add more.. 🙂

  • Liked by
Reply
Cancel