Players not spawning into correct positions...

I followed the setup for the Gunslinger example project (as well as another tutorial I found doing the same thing) and can not for the life of me get this to work properly and have no idea how to debug it to fix it.

You can see in the screens below that I’m trying to spawn 2 pawns to specific player starts set up in the level. I get various results with no real consistency. When I play in a new PIE window with 2 players (no dedicated server), the players are spawned in at a different player start each time. Never see the first player (server) go to the Player1 start point consistently.

Sometimes, one player will spawn who the hell knows where with the camera looking into the sky (I think it’s under the world, but can’t tell since it’s a static pawn and no camera movement). If I don’t have the DoOnce nodes hooked up, I sometimes get 4 pawns spawned, but can’t see all of them. Where would those be coming from?

I have a million other issues with my game related to this online setup, but for now I would love to get this working correctly since it’s set up like the tutorials, but does not perform at all the way it’s advertised.

Any help would be greatly appreciated.

&stc=1

&stc=1

&stc=1

I will just copy paste quote my FB Group response to you, so others can see it too:

Thanks for the reply. Seems like some good info to start looking into. To answer a few questions at once. Nearly everything regarding the player spawning/networking is done because that’s what the tutorial did. Not sure how it worked for them, but it sure as hell isn’t for me. I’ll try moving the Respawn event into the PlayerController and see if that gives me better luck.

I’ll look into the other stuff as well as soon as I can figure out what it means. ← Producer, not programmer. :slight_smile:

Ok, played with this a little bit and got some new info.

Still crashing while debugging so that sucks and I can’t tell what happens after the first player spawns. However, I can more easily see that more than 1 pawn is spawning and it’s not consistent. Sometimes it’s 3 sometimes 4 and strangely it seems to be double that. I added some debug info to my UMG widget to get all pawns and list them by name. If I run PIE with 2 players, one window shows 3 (or 4) pawns listed by name 0-3 and the other window shows the same number, but listed 4-7. Looking in the editor while it’s running, I can open the Pawn and select 8 different pawns to debug from the drop-down.

I’ve verified that the Respawn is only called from the player controller, but notice that there are 3 controllers existing while the game is running. Where would the 3rd be coming from? Also, I re-hooked up the DoOnce nodes so why would it run that spawn so many times? Better yet, why is it not consistent? I’m literally running, looking at numbers, killing it and running again. No crashes or changes in between. This makes no sense at all.

Good news is, something is different and the initial functionality of the pawn is working again (dealing cards to it). It’s not in the right place or interactive, but that part wasn’t working before.

Back to it…

Keep remembering that you are debugging a Multiplayer Game.

Pawns do exists on boths sides. The Server has a Pawn, the Client has a pawn, the Server has the Client Pawn, otherwise the player would not see each other, same goes for the Client who got a Server Pawn.

PlayerControllers are a bit different. While the Server has a PlayerController version of the Clients one, the Client only has his own. So when being on the Client side, you can’t get any other PlayerController, despite
your own. On the other hand, the server has an instance of all of them.

So without talking a calculator, the Server PC + the Clients PC + the Clients PC on the Server Side = 3.

I can’t tell what your crash is without getting a proper CrashLog or general Log. When the Editor Crashs, it should give you a Window with a Crash Log. Also you have a Saved Folder in your Project and in it there is a Logs folder.
Might wanna check that out too.

8 Pawn are a bit much. Regarding above information, you should have 4 Pawns in the Debugger in total when both players have a correctly spawn Pawn.

I don’t get why so many are spawning. The Post Login is called once per player (also the Switch has Authority isn’t needed, since the Client doesn’t even have a GameMode actor, so there can’t be a remote call :D).

Maybe you want to use EventBegingPlay in the GameMode and in it, you make the “GetAllActorsOfClass” thing where you pack all different Spawns into the 2 arrays.
Then you only leave everything that comes after the Completed exec of the For each loop in the PostLogin, because there is not need to call that GetAllActorsOfClass every time a player joins.

I mean, the spawns don’t change do they? And even if, you are not redoing them, but just trying to add them again and again, which won’t work since it’s an “AddUnique” call.

Also: What you describe seeing in the UMG are the 4 pawns that exist on the Server 0-3 and the 4 that exists on the Client 4-7. They are different Actors, but normally 1 of the Clients Actor
is connected to one of the Server actors.

Like the Servers Pawn with number 0 is the pawn number 4 on the Client. Networking is just sending data from one pawn to some kind of puppet on the other player, which will imitate the movement based on the information
that were send (replicated) over the net.

Ok, this gets weirder and weirder.

Check out the picture below. I have 2 start points, the ones used in the BP. No pawns in the level to start, only spawned in when Respawn runs.

From the drop-down of pawns to debug, I see 56-60.
In the world outliner, I see 56-59 (57 and 59 having PCs attached). The same is reflected in my UI seen below in between the camera insets.
When I eject from the game and select the spawned Pawns they are numbered 60-63 (see the camera inset labels). Client lists 60-63 in the UI, maybe that’s part of the wierdness?

So, why are so many visible in-game? Why are they not the same numbers? WTF?

Ok, reading what you say above, how many Pawns should exist in a 2 player game with no dedicated server? 3? 1 Server, 1 Client and 1 Client representative on the server? The game shown in the attached image is only 2 players but has 8 Pawns and only 2 PCs.

Also, I have no idea what positions they are taking when spawned. My player starts are centered at top and bottom of the deck near the edge of the white ‘table’. The two larger cones (what I added to show pawns more easily) are at points I don’t recognize. The other two smaller ones (actually below the table) are roughly at hard coded points I put in to test spawning since I couldn’t tell if the player start arrays were working. Not 100% sure they are right, but much closer than the other ones.

From what you said before, if multiple PCs and Pawns exist for server and client, how can one tell what they are referring to when blueprints execute commands? Maybe more importantly, why would the server see all versions of the pawns and not just the ‘master’ one it’s using to send info back to the client?

&stc=1

Alright, further testing has revealed a few things.

  1. Locations are actually probably right for the pawns. I thing things are offset in the BP so they wouldn’t spawn quite centered. Yay…
  2. If I disconnect the EventPostLogin in the GameMode, only 2 pawns, 2 PCs, etc. get created according to the server’s World Outliner. They are even at the right place. Is it possible that PostLogin automatically spawns that stuff and I’m just doubling it up with an explicit call? If so, I should be able to just get the player info and possess the pawns right? Or something along those lines?

Still digging…

Ah wow, i’m not home, so only a short answer to ome problem: Have you set the DefaultPawnClass in your GameMode to None? Otherwise it will spawn double the numbers. And it should be 4 Pawns and 3 PCs. If the DefaultPlayerPawn is not None, the game will also spawn that for each player which results im 8 pawns.