Low fps while 40,000 png output

Hello. I succeed to display on Android tablet 40,000 rectangles (with DrawNode): at creation time the fps is 20, but the display fps is ~60 - with scroll and zoom of the whole parent “main Node”.
But when I add many Sprite objects (all from the same png), then fps goes slow. 4,000 sprites -> ~20fps, 40,000 sprites -> ~10fps.
Question: can i make it faster?
I have “main Node” (DrawNode), I add to it as a child “bitmaps Node”, then i add Sprites to “bitmaps Node” once.
During the display i call setPosition() and setScale() to “main Node”, without recreating (and adding) rectangles and sprites.

I’ve tried SpriteBatchNode, but get no image at all (working example need, if using of SpriteBatchNode will improve fps).
Same with SpriteFrameCache - working example need, if it will improve fps.

Can you share your implementation?

The creation of the project: create with “Cocos” c++ “HelloWorld” type example, and replace there in “Classes” folder files: “HelloWorldScene.cpp” and “HelloWorldScene.h”

I succeed to build and run my project for Win32 and Android. Updated: “proj.android\libs\android-async-http-1.4.8.jar” added. C8 - 2016.04.21 - to send.ZIP (473.4 KB)

wow, 40,000 DrawNode objects. That is impressive. In a simulator, expect an extremely low frame rate. On hardware, I would expect it to be something less than 60, not not 10.

Yes, I need 200x200 tiles to migrate my game “Color Flood Filler” to Cocos.

In a simulator, expect an extremely low frame rate

Vice versa - MS Visual Studio simulator :heart_eyes: gives more than tablet: 60 fps (as it is set)… no, 10-25 fps… no, 35-60 fps (3 starts) and the render is quick.
On tablet “director->setDisplayStats(true);” shows 60-30 fps, but render is about 1 fps.

Wow, I would not expect that!

tiles40000-all-debug.zip (710.1 KB) - here is drawing via OpenGL - 50 fps (10,000 tiles via 4 draw calls = 40,000 displayed png from one file).

I apologize, properly using SpriteBatchNode i get perfect 36 fps for 40,000 png! :slight_smile:
Note: looks like max SpriteBatchNode capacity is ~10,000, so i had to use 4 SpriteBatchNode-s.

I am not sure if this is a bug or not @ricardo, what do you think?

not a bug. but a limitation of batches. we are using glshorts (16 bits) for the indices, and they cant address more than 10922 quads (6 indices per quad, and 6 * 10922 = 65532)

UPDATE: Probably if you want to render 40000 sprites, you might need something custom, or particle system or something like that. that might be more efficient.