Download

Replicated Decals - The proper way

Hello everyone,

I am working on a networked project where my decals are an important part of my gameplay mechanic.
Let’s say we have a spell cast somewhere a decal is showing the affected area of this spell.

I’m questioning myself about the proper way to manage my decals.

What I am doing right now is that I spawn the decal on the server which replicates on the clients.
It’s actually not working well as the decal is showing on the clients but with no material loaded.

Questions:

  • Is it normal that my decal spawned on the server did not replicate the material used on the clients? (Material set with SetDecalMaterial(mat))
  • Is spawning a decal on the server side irrelevant and should always be spawned on the client side?

It might be an odd question, but a hint would be very appreciated.
Thank you

Decals aren’t usually replicated and aren’t really supposed to be most of the time, so it doesn’t surprise me that this doesn’t work. Decal Components don’t have any replicated properties so it seems reasonable that even if you replicate the component itself, the client would only know to create the component and do nothing else.

My suggestion would be instead of wasting actor channels on individual decals, just create a data structure you can replicate through some kind of manager actor, which will allow clients to create the decals themselves locally.

Usually however - impact effects and decals are all handled client-side (you don’t want to waste cycles on dedicated servers processing things that will never be rendered). Unless the Server is doing something the client doesn’t know about, it should be fine to create the decals client-side anyway when the spell impacts something on the client.

Hello TheJamsh,

Thank you for your reply.
I’m using this decal as an indicator of spell range that every connected player will be able to see.
So it’s very important for me that its position and state is accurate to all clients.

I will go with your suggestion.
Thank you very much.

Edit:

The weird part is that it is replicating everything except its material. For example, the scale is replicated properly.