There have been some questions and requests for help with making team select in a multiplayer game. I’ve decided since I’m rewriting my code for Ultraball (http://www.ultraballgame.com vote for my greenlight soon!) to go over how I accomplish this in an example project that is all blue prints.
Ultimately we want to stream line all players to funnel into a dedicated server much like team fortress where you pick a team and join it. No lobby needed.
In this example project we are going to do the following.
- Create team spawn points and spectator spawn point
- By default you join as spectator
- We use a custom spectator class because true spectator cannot cast to game mode as they are not considered a player.
- We will keep our widgets on PC because we don’t want to lose access to them when changing classes of pawn
- We will also have the game mode keep track of player starts so we don’t spawn on top of each other by going through a list.
- We will have a chance team bind on PC so we can access it even when we have destroyed our character
- We will use various built in overrides and built in functions to keep this simple.
Download Link:
or
http://www.ultraballgame.com/downloads/TeamSelect.zip
I didn’t parse out the starter content that was not used so its 671Megs UE4 v4.15.0
I’ll be making a video explaining the building of this system soon enough.
Included:
- Team Spawns for team players adjustable by a simple enumeration var.
- Replicated Health Bars over players
- Damage by world placed object on overlap.
- Regeneration of health by pickup in world.
- Use of blur in UMG.
- Skin Change based on Team when possessing Character
- Use of Spawn Points through array to ensure players do not spawn in the same place.
- Override use in game mode for Choose/Select Player Start.
- Override use in game mode for Choose Default Pawn
- Use of RestartPlayer to make it all possible.