Spawning Clientside Ragdolls

In Source2 you don’t need a special ragdoll entity to create a ragdoll clientside. I haven’t looked into the serverside yet, but I assume we still need to use a special one to network the physics bone positions.

Here I’m spawning clientside ragdolls. In Source2 pretty much all entities can run purely clientside. This means our code doesn’t have to do special stuff… to spawn this I’m just doing…

var ent = new ModelEntity();
ent.Pos = EyePos;
ent.Rot = EyeRot;
ent.MoveUsingPhysics = true;
ent.UsePhysicsCollision = true;
ent.SetModel( "models/citizen/citizen.vmdl" );

this is impressive

To clarify: This means that the amount of physics we can simulate only depends on our hardware, and does not weigh the server down? What about NPCs?

Well yeah - but obviously if the entities are clientside… you’ll be the only person that can see them.


Well yeah, but we can sync minimal info between you and other clients thanks to this - or i might’ve misunderstood the point

because its related to this:

1 Like

If you want a physics object to show up the same for everyone, you’d have to use serverside physics objects and those will have to be handled by the server.

Clientside objects remove the load from the server but at the same time won’t synchronize between different players, meaning other players won’t see them and won’t sync up physics wise if you create them on multiple clients at the same time.

Эта шедевар :dollar:

or you do some tricky messy stuff @helios mentioned to sync them between clients

Yeah - they still have their uses. Most games don’t have serverside ragdolls, so there’s that.

But beyond that you could set a variable on your player describing what they’re wearing, then create all the clothing entities clientside etc.


very nice!

Sorry I should have specified that they won’t line up correctly physics wise.

That aside clientside entities are great as Garry mentioned for either things that don’t have to be synchronized (Death ragdolls, temporary effects) or don’t require physics at all (Player clothing, other ‘accessories’ parented to entities) since you can just network the necessary appearance data and let the client do the heavy lifting instead of an entity.

1 Like