I developing cross-platform game using cocos2d-x, few days ago I started porting it from iOS to Android and I saw really strange problem. I using DrawNode class to render some simple objects(like circles), my app gets really laggy on Android phones(I tested app on Huawei P8 Lite and Samsung Galaxy A5-16), on iPhone 6 there is no problem with that. Maybe somebody meet problem like that and know, how to solve it?
My code of this functionality is really simple, I start from creating DrawNode object, next I draw on it using RenderCircle methods and at the end I push it on the screen by visit method in every frame. I wonder, how can I batch it in some way and create new circles only, when some status in app is changed. I know, that in cocos2dx v3 Sprite Is batched automatically, but I don’t know, how can I achieve that in DrawNode object? And why I don’t have similar problems in old iOS devices?
No, this isn’t a drawing app, this is a typical game.
I recall there being a few GitHub issues about DrawNode performance where one of the engineers wrote some ideas on batching. I will see if I can locate them.
I read that one should use as few DrawNode objects as possible. Instead of creating multiple DrawNode objects just use one DrawNode and draw multiple shapes.
About that type of optimization I know and I use it now. When I don’t use it I get really laggy screen on iPhone, now on iOS run really smoothly, but on Android is some problem with it. I noticed, that method drawSolidCircle slow down application at most.