This is kinda strange, because usually this types of faults happening in other way.
In my (yet) little shooter game I have very tricky bullets. There is gun component, that has replicated variables such as gun integrity, temperature etc.
Also I noticed that I forgot to replicate one variable… Well, that doesn’t changes anything. I’d not even used it yet.
These variables replicated in very strange way.
Here is a screenshot of server messages:
What actually is going on: Client can only see self and server’s replicated variables. Server can only see self variables. Same thing happens if I launch 3 players, there is just not enough screen space to see all messages.
Everything else is “default”.
What I have:
The player character (that owns UGunComponent) having it’s variable bReplicates equals true.
The gun component having it’s variable bReplicates equals true.
Both bReplicates are defined in initializators.
The gun component has GetLifetimeReplicatedProps override and UnrealNetwork.h included:
#include "UnrealNetwork.h"
...
void UGunComponent::GetLifetimeReplicatedProps(TArray< FLifetimeProperty > & OutLifetimeProps) const
{
Super::GetLifetimeReplicatedProps(OutLifetimeProps);
// Replicate to everyone
DOREPLIFETIME(UGunComponent, heat);
DOREPLIFETIME(UGunComponent, integrity);
// There is also must be bOverheat, that I mentioned in the beginning.
}
I’ve noticed that even Player State is not replicating some variables, such as structs:
void APState::GetLifetimeReplicatedProps(TArray< FLifetimeProperty > & OutLifetimeProps) const
{
Super::GetLifetimeReplicatedProps(OutLifetimeProps);
DOREPLIFETIME(APState, bIsDead); //Successfully replicated
DOREPLIFETIME(APState, Kills); //Successfully replicated
DOREPLIFETIME(APState, Deaths); //Successfully replicated
DOREPLIFETIME(APState, Damage); //Successfully replicated
DOREPLIFETIME(APState, bulletSetup); //struct here not replicated
DOREPLIFETIME(APState, gunSetup); // and here too
}
They both do same thing as above: server replicates to clients, but not the other way.
What have I forgot?
Is it a bug?