tomlooman / EpicSurvivalGame

Third-person Survival Game for Unreal Engine (Sample Project)
https://www.tomlooman.com/unreal-engine-cpp-survival-sample-game/
MIT License
3.24k stars 1.18k forks source link

Inconsistent player spawn behaviour #76

Open Zenahr opened 3 years ago

Zenahr commented 3 years ago

When joining a session from the Main Menu, new players are spawned with the SpectatorPawn class. In contrast, when starting the networked session from one of the playable maps directly, this is not the case.

I've dug almost all Classes (GameMode, GameState, SCoopGameMode, SGameState, the Level Blueprint, SPlayerStart and a bunch more...)

I can't find the code that handles which Pawn is being spawned and possessed by newly joined players. Any pointers for me?

SlackingVeteran commented 3 years ago

I have the exact same issue as you. I created a dedicated server, first client that connects to server spawns as a player, rest spawn as a spectator. I am wondering if spawn at team member feature that was added lil while back is the culprit. I have spent countless hours today trying to figure out why any players after the first one is spawned as spectator, will try to revert the buddy spawn feature tomorrow and see if that helps

Edit: Running multiplayer on PIE and standalone works just fine but not on packaged version

Zenahr commented 3 years ago

I have the exact same issue as you. I created a dedicated server, first client that connects to server spawns as a player, rest spawn as a spectator. I am wondering if spawn at team member feature that was added lil while back is the culprit. I have spent countless hours today trying to figure out why any players after the first one is spawned as spectator, will try to revert the buddy spawn feature tomorrow and see if that helps

Edit: Running multiplayer on PIE and standalone works just fine but not on packaged version

I've managed to fix it by commenting out a couple lines. The way spectators are implemented inside Unreal's GameplayFramework is kinda scuffed so I'd rather roll my own or as I did just turn it off. I'll see if I can find the lines I commented out and post it here (dirty fix).

SlackingVeteran commented 3 years ago

I've managed to fix it by commenting out a couple lines. The way spectators are implemented inside Unreal's GameplayFramework is kinda scuffed so I'd rather roll my own or as I did just turn it off. I'll see if I can find the lines I commented out and post it here (dirty fix).

Would be great if you could find out what lines you commented out.

Also while running in editor mode I see pawns are created dynamically and possessed but just like you mentioned in original comment I havent been able to figure out where its handled