I am not sure but how is bone animation good for the performance? wouldn't the increase of movement with the players (especialy when there are many players in a game) cause much more lag due to all the limbs moving around?
It's not that bone animation is good for performance, it's more a matter of what part of the computer is doing the work. There is a CPU and a GPU, both of which work in parallel. The GPU is the tricky one. GPU's are designed to do their work in large batches. Sending many small batches to the GPU is terribly inefficient and costly for performance as opposed to sending a few large batches.
The trick to good performance is making sure both are working at near maximum, without having to interrupt or wait on each other.
For the following description there are 2 key words: Model and Instance.
1. Model refers to the Avatar itself. For each Avatar there is one Model.
2. Instance refers to each instance of the same avatar. e.g. if there are currently 12 Zombies active in the game, the Zombie Model has 12 instances. There are usually multiple instances per model.
With the current voxel models, the game has to do three things every frame (60 x a second).
1. Setup the transformation data for each Instance of each Model. The transformation data is assembled on the CPU, and then sent to the GPU. Having to send the data separately for each Model is inefficient (many small batches).
2. Execute one Draw call for each Model. The Draw call is executed on the CPU. It sets up the GPU data and states needed for the GPU to do the rendering. Just like step 1, having to execute a separate Draw call for each model is inefficient (many small batches).
3. The GPU renders all the instances for each Model (in parallel with the CPU, so the CPU can be getting on with other work while the GPU does the rendering).
The fact that steps 1 and 2 must be executed separately for each model is the problem. If there are 30 avatars currently used in the game, it must be done 30 times. There is a performance cost for each setup and draw call.
If you add Bone animation to this system, you no longer have one Model per Avatar, you will have at least 4 (head, torso, arm, leg), and more for more complex creatures, like dragons, etc.
So now if there are 30 Avatars in the game, steps 1 and 2 would have to be done at least 120 times, instead of 30. On top of that, the bones transformations themselves must also be calculated. The performance of Avatars now is already bad enough, this would just bring the game to it's knees.
Step 1: All the data for all instances of all the models can now be assembled and sent to the GPU as one batch (one big batch, rather than many small batches as before). This is because there is now actually only one model, a single cuboid (bone). Multiple cuboids are used to make up an avatar, but as far as the CPU and GPU are concerned, the model is now the cuboid, not the avatar.
Step 2 only requires one draw call for all instances of all models (again one big batch, rather than many small). For the same reason as step 1. The GPU is now just rendering a single batch of cuboids, rather than separate batches of different voxel models.
With bone animation, Step 1 now has an extra thing to do that it didn't have to do before, that is calculate the bone animation transformations. But the savings on being able to do Step 1 and Step 2 as one large batch are typically greater than the cost of the bone animation transformation calculation.
So if cuboids are used, bone animation is actually cheaper to do than the currently unanimated voxel models. And because the GPU jobs are a few large batches rather than many small batches, there is much less interaction between CPU and GPU resulting in better parallel performance.
Also, because cuboid models are typically only 6 - 10 cuboids per instance, compared to hundreds or thousands per instance as in the current voxel models, that's a massive reduction in the number of vertices shaded by the GPU (vertex shader). There are also savings for the pixel shader (GPU), although not as great as the vertex shader.
So with cuboid based bone animation, both the CPU and the GPU are doing less work than with the current unanimated voxel models, and they are also working together in parallel better, meaning less downtime (waiting) and less potential GPU stalls (which are very bad for performance).
There are several other smaller performance gains the cuboid models give. Once is to do with draw culling. With the existing models, it's too expensive to do draw culling on the instances, so the game just draws every instance, even if it's out of view of the player. That means the GPU is doing work it shouldn't need to. With the cuboid models, the draw culling will have virtually no performance cost, so it will be implemented and the GPU will have even less work to do.