Creating CCNode Objects in Different Thread


#1

I’m wondering if it’s possible to create CCNode objects (e.g. CCScene, CCSprite, CCTMXTileMap, etc) in a different thread using cocos2dx 2.x. The reason why I want to do so is because the creation of my scenes is causing visible hiccups, which can last up to 1 second or so. At first, I suspected that it is caused by the loading of textures (like around 50MB of them for a single scene). But even after having the loaded in the background via addImageAsync, the hiccups are still there. So obviously, the creation of the scene is what causing the hiccups.

Thank you. :slight_smile:


#2

If you are using xcode, I suggest, do profiling first to see what’s actually slow your game down, also try reuse things instead of creating them everytime


http://gameprogrammingpatterns.com/object-pool.html