Replicating save to others

So I have a presumably simple problem. I’m trying to learn how to do online replication and I’m having a hard time of it.

So I made a test to try it out, make a character that is saved locally and then you play that character on a server, the only thing that is unique is the color you select that is saved to a file.

So the server sees everything correct, except the name, but I’ll probably get that sorted out once I figure this out. I should mention this is a drop in and play kind of game.

This is the blueprint, one of the help files suggested using an input for the event but it never works unless i reference the variable manually.

But the problem is the server sees it, but its not replicating to the clients. The event is being multicast and the material instance is created in the construction script. What am I missing here?

Hey,

You didn’t mention which blueprint this was in. With replication this is very important. For example a game mode only exists on server, so a multicast should work. If it’s a character, it’s different. As a quick implementation, you can do a switch has authority, if true call multicast. If false, call a run on server custom event, which calls the multicast. Also note that events fired before someone else joins doesn’t tell them anything, you need to use replicated variables, so when they join they read the variable that’s replicated so they pick up any details that a multicast had previously set.

Ah sorry, this was in the character BP. I have the character data struct, which contains all the variables about a character as replicated.

I changed the BP a bit and got some weird results.

I moved the material instance creation from the construction script into the actual event and it looked promising for a second. It is changing the colors and the ones that join after are the correct color too. It’s just…

SERVER Client1 Client 2

Whenever a player joins, it alters the color of the player who joined before them on their screen to that player’s color plus their own color. So if the player who joined before was red, and this player joined was blue, on the 2nd player’s screen, the 1st player would be purple.

What is the best way to implement this, it feels really close to working.

Hi Daniel, it took me a year and a half to understand how this works and I wanna thank you for helping me. I got it to work finally.