Is there a drawback to having a shitton of bodygroups?

Title. Thanks.

i believe there is a hardcoded limit but i’ve never experienced any performance drop with a large number.

If there are way too many bodygroups on one model, it can crash when trying to enable one of the later ones. I’m not sure of the exact amount at the moment, but it happened when I had compiled my Kamen Rider Fourze model for Garry’s Mod many years ago (I had to separate all of the extra parts into bonemergable models instead).

According to the Valve Developer Wiki:

You can have any number of bodygroups so long as the number of possible combinations doesn’t exceed 4,294,967,296; otherwise it’ll crash when attempting to switch to the out-of-range combinations.

As for OP’s question, having a ton of bodygroups will increase the precache time slightly when first loading the model, which is hardly a problem.

All Source limits, from mapping to modelling all trace back into 32 bit values. The problem with the engine limits really is that you simply cannot go over certain numbers.

I should point out that “blank” bodygroups also count towards the limit.

I could be wrong, but I believe having a bodygroup with a single model on it also counts. You should use $body in this case, since that does not count towards the total number.

Not really related and a bit late but I put too many bodygroups and as a result the compiler failed to compile: http://forum.facepunch.com/showthread.php?t=1581361
This might be something for crowbar but it’s relevant since it’s the most used.

You guys do know he asked what the drawbacks of having lots of bodygroups is, right? Not “How many bodygroups can I have”.

To actually answer your question, overki11, the only real drawback is it makes the model heavy, both filesize-wise (for uploading or transferring) and memory-consumption-wise.

Testing a single model with 2 * 2 * 2 * 2 * 6 * 2 * 6 * 3 * 24 = 82944 bodygroup combinations, and then comparing it to a recompile with all of the bodygroups removed (so it’s only the reference mesh):

SFM Base Memory Load: 1271.67MB

SFM Memory Load with bodygroups compiled: 1409.20 MB (+137.53MB)
Model file size with bodygroups compiled*: 10.3MB

SFM Memory Load with bodygroups not compiled: 1382.99 (+111.32MB)
Model file size with bodygroups not compiled: 2.61MB

*Sum of all model files’ (.dx90.vtx, .mdl, and .vvd) sizes, as reported by Windows 7’s quick-report at the bottom of a window.

In practice, this means that if you’re going to be using a lot of models in a scene, then you will start to run into performance problems faster, the more bodygroups those models have. The lighter the model is, the more of them you can have on a scene at a time.