Performance drop with large coordinate value

Performance drop with large coordinate value
0.0 0



I’m building an endless top-scrolling platformer game.
I set up the scene so that the camera will follow a node that will constantly move to the top to create some sort of parallax effect (using CCFollow).
I also used a scheduler to spawn upcoming contents (enemies, etc.) on top of the screen right before they appear in the camera, and to remove them once gets too far off the screen (using removeChildAndCleanup(true)).
The game runs smoothly at the beginning but as the camera reaches higher Y coordinate value (eg. 80.000*) the FPS is starting to drop and starting to become unplayable when it reaches the Y value of 150.000* because of the low FPS.
I tested this in Galaxy S III (GT-I9300) so I’m afraid this will be a major problem on devices with lower processing ability.
Is there a workaround for this? Or am I using a bad approach to implement the game?

I’m using Cocos2D-X 2.1.4.

Thank you.


Are you sure that the framerate really drops? If you see jittering animation, it could be related to low precision of floating-point operations due to high values of coordinates.


Yes, it runs at full 60 FPS at the beginning and slowly drops until around ~30-40 FPS at the mentioned Y-position.
And yes, the animations are jittering too sometimes at high coords. How do I overcome it?