Download

Replication help. Multiplayer gametype networking.

Hi UE4 community, im having trouble getting my head around replicating in Blueprints. Ive got a gametype setup similar to Conquest on BF, instead at the moment a player picks up an object and then needs to take it to a flag for that flag to be captured. However im having trouble figuring out how to properly replicate to all clients that a player has captured a flag and that they should update on their screen the colour change for that flag.

The build i have at the moment seems to work somewhat, at the moment when the server captures a flag instead of turning to the correct colour for that team, the flag material seems to turn a shade of grey instead but only on clients. However when the client captures a flag it appears correct on both client and server.

Below is a screenshot of what it looks like and the following blueprint of the Flag itself that handles changing its colour.

http://ltbb.org/devilsd/UnrealEngine/images/Correct_Incorrect.JPG

http://ltbb.org/devilsd/UnrealEngine/images/FlagBP.JPG

It would be really helpful if someone could explain to me in detail what im doing wrong and what the DOs and DONTs are for replicating to keep me out of trouble.

Below is also a link to a download of the entire project. Its not very big only 100MB~ if someone wants to take a closer look at all of it and give me a few more pointers on how to better handle things for replication.

http://ltbb.org/devilsd/UnrealEngine/LTBB.rar

Thanks for your help, if there is anymore information you need please let me know.

Sorry for the large images, im not sure how to make them smaller or put them into a spoiler type thing.

You need to have the client send to the server an RPC saying “I’m at the flag, so change it”, the server should verify the client has the appropriate token and then change the value on the flag. The flag should have a replicated variable with a Notify on it that when it gets changed it does the material change to the appropriate colour. So basically RPC to the server, server updates replicated variable, replication causes client-side notify, clients update material.

I have an event on the flag fire when a player overlaps an collider attached to the flag, i tried to use an SwitchHasAuthority node to run the check that the player can capture the flag on the Authority and then change the flags color. The flag has a “Team” variable which ive now set to RepNotify which gets set along with the flags color (Its current set team determines its color), but instead of now the client seeing grey when the server captures a flag its now changed to clients cant see when eachother captures a flag.

This is really frustrating, im trying to see if the Content Examples can help explain it to me better. Id still really like it if someone could explain in greater details what the best way to handle these sorts of things would be.

Its working now. Im sorry, i forgot that RepNotify creates an actual function for that variable so that you can input your logic for when that variable changes. I put my material changing logic into the OnRep_Team function that was autogenerated and it works fine now.