Soft Body Physics

Will Soft Bodies & Deformable Objects be included in the game ?

3 Likes

Even if soft body/cloth/rope/water physics would be added, these would be very expensive to network, it’s basically like ragdolls but 10 times worse.

As long as the object is represented with many moving sub-objects (particles, segments, joints, etc.), you need to send positions of all of them as they change from the server to all clients, that’s why this kind of stuff is expensive.

Could still be used clientside but this means it’s just for effects and stuff, so it’s hard to tell if it’s even worth the effort in this case.

1 Like

It’s worth for a realistic destruction system

1 Like

Not really no, Gmod destruction maps are not that popular, if it would be for something it would be because Garry thought it would be a fun project, which I guess takes priority over it being “worth it” or not.

2 Likes

Gibs are what’s usually used for “realistic destruction” of rigid objects, not soft/deformable bodies.

Source offers such a system, but in Source 1 you had to model the gibs for a model yourself and compile them as models basically, that’s why you have all these wood crate piece models in gmod.

I hope that we’ll have a flexible enough API to procedurally generate chunks of models by cutting them with some voronoi diagrams and such, generating realistic clientside or even serverside gibs for stuff.

There are many games that have complex physics simulations used for gameplay purposes but most of these games are singleplayer. There are also some multiplayer games that have these types of physics but it’s usually just clientside effects. For a fresh example, there’s a game called Teardown that came out recently, it’s all based around complex physics, but again, it’s singleplayer. Making this game multiplayer would be a nightmare if possible at all, the amount of data to synchronize between players is tremendous.

In conclusion, it’ll probably be possible to get things breakable in a realistic manner by installing an addon that generates nice gibs, but I doubt soft body/rope/cloth/deformable/fluid physics will be a viable option.

3 Likes

I was talking about vehicle destruction for example

1 Like

You know what game had soft body physics on vehicles? Mod&Play.
'Nuff said :sunglasses:

1 Like

There are some tricks that can be used for that (if you want the front of your car to smash when you hit a wall, for example), and they don’t actually require soft/deformable body physics simulation. You’d just need to calculate where the dent should appear and how big it should be, etc., on the server and let the clients deform the model in an appropriate way procedurally or via morph parameters or something, it was already done in Source and can sure be done in Source 2.

5 Likes

Maybe. I haven’t looked into it.

10 Likes

You know what multiplayer game has deformations on vehicles that are pretty nice and networked? Gta online.
We just have to find a smart way to network these deformations or to only send partial data so that the other clients can run the same simulation (sending only parameters to achieve the same effect instead of sending the effect itself might help save network data)

1 Like

There are many old games that did that, racing games mostly, you can find games that are like 15 years old that did exactly what you described.

1 Like

I believe to achieve a somewhat performant deformation for cars and stuff, most games use the following simplification:
Imagine a sphere with points on its cardinal directions marked. If you collide that sphere against a wall and want to deform it, you don’t need to send the new vector position to all of the points that were affected by the collision, you can just send the new distance from the center and let the client actually morph it or whatever.

The problem with this is that you are unable to make more complex dents, you can only deform towards a specific single point. In cars this is not a big deal, because they will most likely have convex basic shapes and you can mask this simplification by making the actual deformation look more irregular and stuff. However, this simplification is not helpful for many other soft body scenarios.

GTA Online is P2P and I believe the car deformations are calculated client side and sent to the rest of the lobby whenever… just like many other aspects that should be “server side” but aren’t, that’s why there are so many ways to cheat in that game. But yea, there are surely other games that did networked vehicle deformation.

1 Like

Couldn’t we network physics P2P? Or does that introduce vulnerabilities (i know gta is so easy to cheat in) but i mean, deformations are mostly visual so i don’t see many ways being able to cheat that would break the game in any way. Or perhaps this can be protected if the devs give a shit about anticheat? Idk? perhaps there’s something to gain from P2P physics stuff (or atleast offloading the heavier stuff for p2p)

Or maybe just isolating players that can see a physics event take place and make the server only calculate it for them? Or the further away you are from a deformation/rope/etc the less precise it is for you?

1 Like

You could just network the damage event and let each client calculate the result. If you store the events you can just network the table when players need to see the entity. Deforming the collision meshes and having damage change how physics interact would be harder to do. You could also just network paint scrapes as textures for example. (E.g as an alpha map for wear textures)

1 Like

It’d be much easier (less convincing though) to just pre-make deformations and damage of different parts of the vehicle as morph targets, this way you can network the whole car damage state by just like 20-30 floats which is nothing. Dent positions wouldn’t be placed perfectly where they should but it’s a good tradeoff between realism and efficiency. You have a chance to model the damage in a realistic way in 3D software by hand or by performing expensive physics simulations offline and baking the results, which is an advantage. That’s an old but effective approach, even the old GTA:SA did it this way.

2 Likes

The way it was done in Source 1 by some community members is that they made the “destroyed” model warp based on flex values (same system Source uses for facial animations), they’d interpolate between 0 and 1.

Downside of this is that the damaged mesh isn’t actually “random” - It’s just a premade mesh.

1 Like

Basically what I described above

2 Likes

Yep, a much better solution rather than a full on soft-body solution. While it’d be cool, it could be seen as a gimmick. There are whole engines build around the idea of soft-body physics (BeamNG) and I don’t think Source 2 would be able to handle a proper simulation of stuff like that.

1 Like

It’s not even about an engine being able or unable to perform realistic simulations of that kind or even performing them efficiently or not, it’s more about networking really.

There’s no silver bullet for just making it work great, you’d either load your network with loads of deformation data or find compromises.

Take ragdolls as an example, all you need to network to define ragdoll’s state is just like 15-20 transforms (pos, ang basically) of its joints, but remember that it happens tens (or preferably even a hundred) times per second for every player who sees the entity. Try spawning 100 ragdolls and move them around all at the same time, with net_graph 4. This will give you a brief idea of the amount of data to sync and why it’s a problem.

2 Likes

Oh I know, just look at gmod and basic bone manipulation on the server. It chugs hard doing that. This is why Lua animation libraries never kicked off.

2 Likes