Cloth simulation and replication

Hello !

I am doing an online game (on dedicated server) and I was wondering how to deal with cloth simulation and replication.

I do some search and found that cloth simulation take to much bandwidth, so it is a very bad idea to replicate it.

So, my question is how can I try to do something similar to it, without do real clothing simulation ?

I know that I can add a bone on the mesh and then animate it in the animation but is is quite complicate for me since don’t know how to do it, I am not a graphist ^^ and I have a lot of cloth and lot of animations…

Is there another way to “cheat” and reproduce something similar to cloth simulation (even if it is worse) ?

Another thing that I need to precise : in my game I have separate mesh for cloth and body and I merge them together to do one unique mesh so it is quite different from just having multiple meshes in the blueprint.

Thank you everybody for your help !

All the best

Just trying to understand your question better: is there a specific reason why the cloth physics need to look exactly identical on the server and client? My Unreal game had NPCs with cloth skirts, but I just let the server and clients compute the cloth physics separately, and it looked visually good on both client and server. I feel like that’s what most games do. Is there something special in your game that you can’t do it that way?

No, there is no reason for me to not do that, it is a really good idea :slight_smile: But would you explain a little more how to do it ? I have no idea how to make the server and client compute it separately.
In fact, all I know about clothing simultation is to create it (by selecting what should mode in the mesh) and then press play and it works… But here it seems that it doesn’t work like this. I have to say to the client to execute it and I have no idea how to do it…

Also, will the merge mesh be a problem ? Because I don’t know if it break the cloth simulation…

Thank you a lot for your answer ! :slight_smile:

I would suggest just looking at Unreal’s official networking example here:

In the Video for Part 4 you can clearly see that they have a Client and Server Character both using cloth physics. I think the SkeletalMesh asset they’re using just comes with a cloth physics asset from when it was imported. No need to tell the Pawn to execute it.

Ok, thank you for your answer :slight_smile: I tried in my project and add a skeletal mesh (another) to my pawn to test it and it works well.
But if I tried to merge it (Merge mesh that is describe here Working with Modular Characters | Unreal Engine Documentation) then it breaks the simulation. I have no idea if it because it is stopped, if it is just totally break or something else…
But in the documentation at the end in the array they said that physic work with merge mesh so I am quite lost…

Thank you a lot again for your help and your time :slight_smile:

Oh, you may be right. It probably has to do with the Mesh - Merge technique. I think when they say “Physics: Yes” they actually mean that the arms+legs will accurately collide with physics objects in the scene. The fact that Morph Targets don’t work with Mesh Merge could suggest that cloth simulation doesn’t either… Does it work if you use the “Copy Pose” or “Master” techniques instead?

I can’t use that :frowning: Merge mesh is much better for multiplayer games according to UE. When I was using the master technique it was not good. When I replicate set master pose component to let the other player see each other correctly I had a gap. The animation of the bodies and the clothes wasn’t exactly playing at the same time and it was really ugly.

Then, since merge mesh is better I think I will keep it but maybe I have a solution to do merging and cloth simulation ?
Maybe after merging a mesh I can pass a physic asset and play cloth simulation (no idea if it is possible) ? Or maybe I can also merge the physic asssets (I have no idea of how it can works but…
In fact, merging mesh just conduct to have one skeletal mesh instead of several but it is still a skeletal mesh so technically, it should be possible to do something after merging.

Do you think that it can be possible ?

Thank you again for your time and your help :slight_smile:

So, thanks to nrossol I know how to make the cloth simulation work in multiplayer. (In fact we don’t have to do anything ^^’). I still have a problem since I use a merge mesh but I think that I will search and then create another post if needed but for my new problem : merge physic.

Thank you a lot again nrossol for your help :slight_smile: