o3de-multiplayersample
o3de-multiplayersample copied to clipboard
NvCloth and Blast gems define the server target and are built for the dedicated server
Describe the bug From my recent test, NvCloth and Blast gems are built for the MultiplayerSample dedicated server target, but they are not required to run the server. This issue increases the build time and package size for the server target.
Steps to reproduce Steps to reproduce the behavior:
- Clone MultiplayerSample
- Configure and build the MultiplayerSample.ServerLauncher target
- Check the build folder for NvCloth and Blast related libraries
Expected behavior
- Gems that are not required by the dedicated server do not define the server target.
- Unused libraries are not built for the server launcher.
Actual behavior NvCloth and Blast related libraries were built for the server launcher but may not actually be in use.
Found in Branch Development
Desktop/Device (please complete the following information):
- Device: PC
- OS: Windows
Additional context I tried to remove the server targets defined for the NvCloth/Blast Gems and rebuilt the server. Verified that the dedicated server could launch without issue.
Blast Gem definitely needs to run on the server, when it breaks a mesh apart it creates sub-colliders which interact with the world and may affect physically to other entities in the world.
NvCloth Gem has two parts:
- Generic Cloth System
- Mesh Cloth Component
The cloth system offers a generic API that customers can use to apply particle simulation on any arbitrary sets of points. It's generic, so it can be used for anything and customers might want them to be run on the server. In addition, if nobody is adding cloths to the system it doesn't add any computational cost to the server. So I think it makes sense to keep this in the server as well and not limit what customers want to do with it.
The Mesh cloth component on the other hand uses the cloth system to apply cloth simulation to static/skeletal meshes. This component is meant to be client only because it only offers visual enhancement and the simulated cloth doesn't affect any other entities. But this has already been taken care of, the runtime cloth component is checking if it's running on a server, and if it is then it's not doing anything.
https://github.com/o3de/o3de/blob/development/Gems/NvCloth/Code/Source/Components/ClothComponent.cpp
void ClothComponent::Activate()
{
// Cloth components do not run on dedicated servers.
if (auto* console = AZ::Interface<AZ::IConsole>::Get())
{
bool isDedicated = false;
if (const auto result = console->GetCvarValue("sv_isDedicated", isDedicated);
result == AZ::GetValueResult::Success && isDedicated)
{
return;
}
}
AZ::Render::MeshComponentNotificationBus::Handler::BusConnect(GetEntityId());
}
One improvement could be to separate the cloth system and the mesh cloth components in different libraries, so only the system is built for the server, but that's a minor improvement, at the expense of making NvCloth Gem a bit more complex, so I'm not sure it's worth making that separation.
I think this answers why we want to keep blast and cloth in the server (as it is doing right now).
If there is anything else to discuss or there are other concerns please let me know, otherwise please close this bug.
These gems could be removed from MPS as they are not used.
When we triaged this bug in sig-core meeting we entered into a conversation about if "should blast & cloth be run on server", and I was asked to comment this info here, that's why I answered it that way :)
But if this issue is just about MultiplayerSampler
project, if this specific project doesn't use Blast or Cloth gems, just disable these two gems for this project and you're good to go, as @lmbr-pip indicates.
Need to review if gems are still active