Players 5-8 don't have a PlayerPawn in PlayerEntered event

Sun Dec 29, 2019 8:29 pm

Affected version: latest stable and dev builds (g4.2.4-m, g4.3pre-569-g703686bee)

In a 5+ player net game, players 5-8 don't have a PlayerPawn in the PlayerEntered event.

Steps to reproduce:
Start a netgame with the attached pk3 and 5 or more clients.
The pk3 will tell you whether each player has a PlayerPawn in the PlayerEntered event, and again in a thinker's PostBeginPlay method.

Expected result:
All players have a PlayerPawn in both PlayerEntered and PostBeginPlay.

Actual result:
Players 1-4 have a PlayerPawn in both PlayerEntered and PostBeginPlay.
Players 5-8 have a PlayerPawn in PostBeginPlay, but don't have one in PlayerEntered.
You do not have the required permissions to view the files attached to this post.

Re: Players 5-8 don't have a PlayerPawn in PlayerEntered eve

Mon Dec 30, 2019 12:21 am

I don't think this is a bug. This happens on maps where there's not enough player starts to spawn all players immediately, so the excess players get spawned later, possibly on top of the others. (though with temporary "unstucking") PlayerEntered runs long before those players spawn in.
If anything, this was bad choice on the part of whoever added this event. It should've been called from a place where the players are fully spawned already (or when the players actually spawn), but now it's too late to change this without risking breaking existing mods. It's likely a better idea to implement this feature suggestion.

Re: Players 5-8 don't have a PlayerPawn in PlayerEntered eve

Mon Dec 30, 2019 3:11 am

Doesn't PlayerRespawned do that already?

Re: Players 5-8 don't have a PlayerPawn in PlayerEntered eve

Tue Dec 31, 2019 5:22 pm

What happens when the level changes?

EDIT: Sticking an A_Log into HD's levelreset() playerpawn function (which is only called in PlayerEntered) I am getting feedback from all 7 bots when I hit the reset button the range. Can't test the very start of the game this way though.

Re: Players 5-8 don't have a PlayerPawn in PlayerEntered eve

Thu Jun 04, 2020 6:37 am

One thing is clear: Changing this event will cause even worse problems in mods using it, there have been other reports of PlayerEntered not doing what should be expected. I think it needs to be deprecated and replaced - but I don't really know how to do that without creating a mess because when Voodoo dolls spawn they are just regular players and get voodoo-fied only later when another PlayerPawn with the same number is spawned.