[Replication] Two deck of cards, but only the server sees if they are modified. (Shuffled, card taken/given)

I’m making a card game, but I hit a wall with this problem. The GameMode:

  1. Finds the 2 decks on the level at the start. (They are part of the level.)
  2. Fills them up with 52 cards (all of them are spawned at the same relative (0,0,0) location)
  3. Shuffles their order.
  4. Rearranges the deck, so every piece of card would be at their place.

The server does this all perfectly fine, but the client only sees maybe 1, 2, and 4.
And even after that if a card is taken away/added to the decks, the server sees it, the client doesn’t.

Here is the call in the GameMode:

And here are the events in the Deck:

I’m quite desperate for any help, so here is the whole project, it’s quite small: [The Project’s Zip (~3MB)][3]


Like I mentioned before I never made a multiplayer game before, but I have seen the tutorials, and from what i saw in your code, everything seems to be well written.

However I noticed that you showed a screenshot of your SpeedGM, yet the Game mode that you are using for your game is MainMenuGM. Is it possible that you are working on the wrong gamemode?

It seems that the Shuffle event only gets replicated if it is called from a client owning the deck (or the cards, I’m a bit new to this as well.)

You could try setting it to to be the same type of RPC as the Rearrange event.

I checked it, no, it’s not the case. In the Project Settings the MainMenuGM is set to default, but in the WorldSettings at the SpeedMap, it is overwritten to SpeedGM!

Sadly, that’s still not the case, I tried a lot of replication combo with the events, but always the same result. I put a GamePlay pic above about it.

And the pic about the current situation:

My idea about the replication was that the spawning of cards should only happen once, and it should happen on the server. The shuffling should also be made by the server, since if the client shuffles somehow else, it becomes a chaos. (But the array is also replicated, so it should work). But the rearranging is almost only cosmetic, so it is enough if every client does this step themselves. (But the movement of the cards are also replicated in their options by default)

I don’t have the time to go through your entire project and attempt to pin point where you are having issues. I also don’t have the time to work up a whole visual Blueprint, where the cards get organized. But, I did put together a setup where the GameMode generates the two decks and randomizes them before sending them to the PlayerController(s).

From there, the PlayerControllers have the functionality to send the decks to the client(s) so the clients can generate the visual apsects of the deck, through a Blueprint or whatever.

From there, its up to you to tell the server what the client(s) want to do (pick, move, remove cards, etc).



Thanks, I will definitely check out!

The replication was good. The problem was that the cards change their texture in the Construction function, and somehow that doesn’t happen at the clients. So when I replaced it to the Event BeginPlay, it worked perfectly.

Sadly, that wasn’t the problem.