Cocos2d-x - Spine FPS drop
Hi if anyone is using Cocos2d-x, I seriously need help.
When we started our prototype "Who must fall" we were using frame by frame animations and later chose to switch to skeletal animation. You can see below that the framerate before optimization is drawing around 40fps




and immediately after I replace the sprites with skeletal objects, I get a drop in framerate by half which makes the game almost impossible to play.


In the case of above screenshot, I only loaded one spine object, but it seems like it will load every time before it spawns. So is there a way to batch the object so that it only load once? or perhaps is there another way to spawn or delete the objects once its no longer useful. I cant find any useful example online. So can anyone please provide an example.
some anim we made...




When we started our prototype "Who must fall" we were using frame by frame animations and later chose to switch to skeletal animation. You can see below that the framerate before optimization is drawing around 40fps




and immediately after I replace the sprites with skeletal objects, I get a drop in framerate by half which makes the game almost impossible to play.


In the case of above screenshot, I only loaded one spine object, but it seems like it will load every time before it spawns. So is there a way to batch the object so that it only load once? or perhaps is there another way to spawn or delete the objects once its no longer useful. I cant find any useful example online. So can anyone please provide an example.
some anim we made...







wp_ss_20170117_0004.png
800 x 480 - 604K


wp_ss_20170117_0003.png
800 x 480 - 571K


wp_ss_20170117_0004.png
800 x 480 - 604K


wp_ss_20170117_0005.png
800 x 480 - 663K


wp_ss_20170117_0006.png
800 x 480 - 619K


wp_ss_20170117_0002.png
800 x 480 - 614K


hero.gif
736 x 383 - 272K


hero1.gif
736 x 378 - 2M


qrpg.gif
638 x 423 - 5M


bmw320.gif
563 x 276 - 9M


citi.gif
612 x 278 - 9M
Thanked by 1Bensonance
Comments
If you know how many you might need, you might be able to create the batch mesh on the first frame (or even pre-create this), and move the ones you don't need off-screen when they are not in use. (There may be a limit too, dependent on the number of bones per mesh.)
That said, even on older hardware (iPad 1 type hardware from 5+ years ago), it should be trivial to handle <2k verts and 20 draw calls. Are you sure you're gpu-bound? Can you somehow profile your main thread vs your gpu thread?
It's possible your skeletal mesh is somehow very inefficient. The more bone weights per vert, the more expensive the mesh. The more bones per mesh, the more expensive. Unity has a 4 weight maximum per vert, and had a 64 bone maximum per mesh, in case those ballpark figures are useful.
What hardware are you running this on?