Multiplayer multiple spawn points

This issue is coming up a lot

I dont have a BP solution

but here is the C++ solution

Rama

#Thought to Epic

Make a BlueprintImplementable Version of

// AGameMode
    /** select best spawn point for player */
        virtual AActor* ChoosePlayerStart(AController* Player) OVERRIDE;

?

I have set up a test project, and can get multiple clients to connect to the server and interact with each other, but they all seem to want to spawn at the first instance of the ‘playerStart’ object.

What controls which ‘playerStart’ object the pawn should spawn at? I imagine it would have something to do with the ‘Player Start Tag’ field in ‘Player Start’ object, but I am unsure how to use it.

At the moment, if a player hasn’t moved off the spawn location when another player connects, they get an ‘unable to spawn at location’ error

Thanks in advance

Thanks Rama, this helps alot

What I did was teleport each player character to different locations based on their player controller id on level begin play using blueprint. It seems to be processed fast enough that even if you’re testing two clients on the same PC with the same join time they won’t get stuck on each other and player 2’s controller will get assigned a pawn with no problems.

Hi PolytizeMeCapN, would you mind posting a screenshot of your blueprint?
I’m trying to accomplish the same thing but not quite sure where to start.

Well kinda figured it out for myself but am only part way there. Using “Get Player Character” but unfortunately this only works for player 0, how do I get a reference to the current player character?

An answer is in the UE4 forum by Tom Shannon. Come learn multiplayer blueprints with me.
He even provided a working example to download.

https://forums.unrealengine.com/showthread.php?2107-Come-Learn-Blueprint-Multiplayer-with-me!-(aka-Tom-s-a-Glutton-for-Punishment)

Our soultion was to make our own GameMode sub class and override ChooseSpawnPoint. Then copy the Unreal engine original source to it and then customize it.

The internal engine algorithm is as follows…

  • From a list of all Player Start Points, find one that is not already ‘taken’ by another player spawning in.
  • If there is one, ‘take’ it and return that spawn point AActor *. By ‘take’ it we mean there are two lists, one of unoccupied start points, and one of occupied (taken) start points.
  • If there is no unclaimed start point, simply return the first start point in the list.

Since we are on Steam we plan to add in “spawn near friends” and/or “spawn away from hostiles” and/or “spawn in building if possible” and/or “elite spawn points” and/or “spawn away from a DMZ” in team matches and/or “spawn else where but in the same building”. But for now, just the default code.