Client character is not possessed (sometimes)

Hello, I’m running into a weird issue where sometimes the client’s player controller is not possessing the character. Each time I run it one of 3 things happens:

  1. The client’s player controller successfully possesses the character (good)
  2. The client’s player controller never possesses the character (bad)
  3. The client’s player controller eventually (after about 5-10 seconds) possesses the player character (bad)

I’m not sure what I’m doing wrong but I’ll try to explain my current setup as best as I can…

  • I’m using GameState and GameMode (not
    GameStateBase or GameModeBase)
  • In the Project Settings I have specified my
    Default Pawn Class and my Player
    Controller Class (I’m not overriding
    the game mode in world settings
    either)
  • In the level I have two PlayerStart objects, 1 for my server
    and 1 for the client (both with
    default values)
  • I didn’t change any
    replication settings in my Character
    or Player Controller classes so by
    default, the Character has Replicated
    set to true and the Player Controller
    has it set to false

Other than that I’m not doing anything that I imagine has any affect on it. One thing to note is that in my PlayerController class I’ve overridden the virtual void SetPawn(APawn* InPawn) override; function like so:

void AMyPlayerController::SetPawn(APawn* InPawn)
{
	Super::SetPawn(InPawn);
}

Just to see when/if the pawn gets set. As you might guess, when the controller fails to possess the character, InPawn is null. And in the event where it successfully possesses the character, InPawn is valid. So something is causing SetPawnto be called with null instead of the valid pawn. The callstack just says “External Code” so I’m not sure what is calling this.

Any suggestions would be greatly appreciated!!!

UPDATE: So I realized the cause of this is due to using reliable multi-casting each frame, causing the network buffer to get full and preventing the pawn possession event to get through… or something like that. But, I have no idea why a few multicasted functions each frame is killing the network that bad. It’s basically no network traffic… I have another question now which is kind of related to the network getting backed up for seemingly no reason.

1 Like