When a client enters a game and receives all the other players in the game, is there an event that fires for those other players somewhere?

On the client side as I join a game, I’d like to get info about the other players in the game as they get replicated into my instance.
Is there an event for this? If not, it’s a bit more work to check for clients joining in the game mode and individually sending info about the others in the game. It would be much easier to add an event in the character, controller or state blueprint directly.

Game mode will replicate the pawn when it is spawned. Game State will replicate the Player state for each.

Each of those players on your end is a Simulated Proxy. Each will spawn a local pawn which has a Begin play that is executed.

In a game in progress, when I join as a client, BeginPlay doesn’t fire for the other players already in the game.
I could cycle through all other players in a loop in the client’s BeginPlay, but there could be timing issues (don’t know when the client’s own BeginPlay gets called relative to when the other players get replicated locally).
I can put a loop in game mode, like I said in the OP, but I thought there might be an event for when a different player get initially replicated locally.

The game doesn’t exist on your client until you join. On join all relevant players/actors etc currently in game are replicated to you. Thus your client will spawn a “Simulated Proxy” of them. The character class in which the Pawn uses will have and execute a begin play when it spawns on your client.


Game State holds an array of all players… player states. Any info you need about another player should come from the player state… well it depends on the data you want. But in general you should use the Player State for any and all relevant data.

Game State is replicated to all clients. It holds “Player State” data for all players connected.

Knowing this you could create an event/timer that’s triggered when you spawn in that loops the player array.

Get Game State → Cast to your GS class → As GS → Get Player Array → loop

That is not right - BeginPlay fires for every created/replicated actor, regardless of whether you join mid-game or not.

For example, edit your PlayerState BP and add PrintString(GetPlayerName) in BeginPlay.
Start a game with two clients Roy & Pam. Wait a bit, then join with third client Jim.
When Jim joins, all of this happens :

  • Jim’s PlayerState is created on server, and BeginPlay triggers immediately for this new actor, on server.
  • Jim’s PlayerState is replicated to Roy & Pam, and BeginPlay triggers for this new actor, on their client side.
  • All existing PlayerStates (Roy,Pam,Jim) are replicated to Jim, and BeginPlay triggers for all three new actors, on Jim’s client side. However be aware there is no defined replication order.

It’s similar for Characters, except they are subject to network relevancy, so they might not be replicated until you see them. And when they fall out of relevancy they are destroyed. When they come back into view again they are created again, and BeginPlay is called again. So for a single character instance on server side, it might be created and destroyed multiple times at various points for various clients (and BeginPlay called every time).

3 Likes