• Runtimes
  • Cocos 2DX runtime - repetitive CCSkeletonAnimation loads?

We are using the Cocos 2DX runtime for spine.

Does anyone know of any issues with using CCObject::copy on CCSkeletonAnimation? Is it okay to duplicate these objects?

We are testing our game right now for performance and are finding that the biggest performance issue we have in our battlemap is the repetitive loading of the same Spine object (really, the JSON) over and over again.

We are just starting to look at exporting the spine as a binary instance, which will probably help, but we are creating lots of CCSkeletonAnimation objects either way, so being able to copy could really cut down the load time.

Any recommendations around performance?

Related Discussions
...

Looks like one way to do this, from reading more of the API, would be to create a single SkeletonData object, which is then fed into CCSkeletonAnimation::createWithData(skeletonData).

This would skip a the file-based JSON parsing step again, I assume. Thoughts?

Will give it a try and report back.

I think that's the way to do it. In Spine-Unity/C#, SkeletonData is a singular object that loads once and gets reused for all instances of a SkeletonAnimation that share that data.

Let's wait for a second opinion though. Not sure about how it might be different in Cocos.

Hi, we are now trying to use the SkeletonData approach and are getting a memory leak for the atlas names. We're using the Cocos-2DX runtime and have posted about it here:

http://www.cocos2d-x.org/forums/6/topics/40957

Can anyone on the Spine team help us look at this? We are trying to patch the code to resolve the issue but are currently a bit stuck. Happy to help even if pointed in the right direction.

do not use old spine runtime in cocos2d-x extension, it is very old. And Upgrade to lastest is quite simple. you just grabbed spine-c and spine-cocos2dx code into your classes folder, add in your xcodeproj ,and add include search paths, and last do not forget to delete the folder references for old spine and include spine code in cocos-ext.h.

5 jours plus tard

Sorry for the delay. Yep, SkeletonData is intended to be loaded onec and can be used for multiple skeletons. A few memory leaks have been fixed in spine-cocos2d-iphone so be sure to use the latest.

Thanks all, we have no achieved SkeletonData caching using the cocos2dx runtime and are very happy with our new performance specs! Love Spine!