Large-scale game Z-order problem with Batchnodes

Hey guys,

I’m currently developing an isometric game that has a fairly annoying problem relating to a limitation of Cocos2D-X.

It’s a large-scale strategy-style game with a lot of sprites. For now, the ground tiles all sit in one batchnode, ground tile decorations in another, trees in another, and players in another.

The problem is some of these layers do need to overlap with each other, and even if they didn’t, I’m running out of space in the 2K sprite sheets for each layer and we’ve got barely 1/4 of the artwork done.

Unfortunately the best I can think of now is to ditch the batchnodes and add/remove sprites on the fly as they get close to being on-screen or move off screen.

Can anyone suggest a solution for this that doesn’t involve ditching the batchnodes? The performance hit is utterly terrifying.

Rohan

I think you can set vertex z by CCNode::setVertexZ().
Then OpenGL will do z order test for you.

Thanks. We’re most of the way building a way to do it now with VertexZ.