How to reduce draw calls

Hi everyone,

I am trying to optimize a game lobby. And I am using Cocos Creator version 2.0.9.

The lobby uses 3 sprite-sheet, despite of that i am getting 37 draw calls.

And when I am enabling the Labels, draw call jumped to 94. The labels are used with caching mode (Bit Map and Char) and the total fonts used on the game lobby are 5.

So i want to know how can i reduce draw calls.

Thanks

checkout this post with some helpful tips: Tutorial: Scrollview Optimization in Cocos Creator

1 Like

actually when i 'm adding the sprite in the scene hierarchy from already using sprite-sheet. It increase the draw call count by 1.

Reference to 1st image, this screen uses only 3 sprite-sheet(created using texture packer) then i want to know why the draw are 37. It should be 3 or 4.

Thanks.

This is just a guess, but what may be happening is that it’s switching between your sprite sheet and the font texture used for each label constantly, using an extra draw call each time, since it’s breaking batching.

Try explicitly setting the Z layer of the labels to something different to the sprites. Use the same Z layer for all labels if they’re all child nodes of the same parent (if it’s a local Z value), but if you’re using global Z (assuming creator supports it), then set them all to the same global Z if they’re not child nodes of a clipping area. For all other sprites, set them to whatever local Z value is appropriate for your scene.

2 Likes

Thanks a lot.

Just something of note, if you’re doing development on Windows or Linux, and you have an nVidia graphics card, then you should use their free tool, nsight-graphics, for debugging issues like this. For example, it will show you exactly which texture is being used in each and every draw call.

2 Likes

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.