Hey everyone,
I am totally new to networking and I think I may be misunderstanding how variable replication actually works. Basically what I am trying to do is this:
Each PlayerController in the current game session has an array of CharacterStructs – essentially a party system. When the game begins, my custom GameState grabs the CharacterStructs from each player in the game (2 in all) and loads those into its own _team1 and _team2 arrays. This loading is only done on the server so each player cannot somehow gain access to the other player’s characters. It works perfectly fine: the server gains all this CharacterStruct information, nicely separated into two internal arrays.
The next part of the process is going through each _team array and spawning those characters on Server/Clients, taking the information and loading it into a PlayerPawn_BP and spawning those instances in the world. This is where it gets mucky I think. If I have 2 players going in a Listen Server/Client setup, the Server spawns all of the characters correctly, but the Client will not. It still spawns the character, mind you – just a blank PlayerPawn_BP instance. I think the clients are pulling the empty _team arrays from the GameState, and not the modified arrays.
This is strange to me because both _team1 and _team2 are set to replicate! My understanding is that, once the server sets those arrays to their correct values, they are replicated to the client, and then the client would have access to these new values.
Is that incorrect somehow? Am I woefully ignorant of how replication works?
Thanks!
Taylor