Multi-Resolution Scaling Problems

Multi-Resolution Scaling Problems
0.0 0


I am having problems with setting up multi-resolution support while using a TMX tile map. I have followed the wiki guide and everything scales alright; however, it causes flickering and artifacts on tiles on my TMX tile map when the tile map is moved. Is there a way around preventing flickering and artifacts from occurring when content scaling is done (there is no flickering or artifacts when the content is not scaled)? I have border padded my tiles by 2 and have margin spacing of 2 as well as having extrusion applied to each tile.

Does anyone know of a fix for this issue with TMX tile maps? Thanks for any help.

If I can get any feedback or help with this ASAP.

Here is a list of what has already been done/tried to fix the problem without any success:

  • Added a padding of 2 to spritesheets
  • Added margin spacing of 2 to spritesheets
  • Added extrusion to spritesheets
  • Set projection to 2D
  • Set the design resolution size
  • Scaled content properly according to the Multi-Resolution support page
  • Ensured anti-aliasing is not used
  • All tiles are even sizes
  • Thanks to Leszek’s suggestion: Disabled CC_NODE_RENDER_SUBPIXEL and CC_SPRITEBATCHNODE_RENDER_SUBPIXEL in ccConfig.h


Try to use 2d projection.


Thanks for your reply James. I am currently using 2D Projection but unfortunately I still have this issue. It only fixes flickering/artifacts when the map is not scaled.

I tested all of the orthogonal code in the cocos2d-x TileMapTest but the same thing occurs when scaling is done; I have added the code below for one of them as an example, can anyone tell me if the below code also produces flickering when they run it?
With my project I am getting artifacts as well as flickering with my resources, most likely because my tiles are seamless tiles whereas the tiles used in the example are not seamless tiles.

NOTE: You will need to add “orthogonal-test-zorder.tmx”, “grossinis_sister1.png”, “ortho-test1.png” cocos2d-x sample images to the project you use the below code in for testing:

// on “init” you need to initialize your instance
bool HelloWorld::init()
 bool bRet = false;
 // super init first

CC\_BREAK\_IF(! CCLayer::init());

 // add your codes below…

CCTMXTiledMap **map = CCTMXTiledMap::create;
 m\_tamara = CCSprite::create;
 CCActionInterval** move = CCMoveBy::create(10, ccp(400,450));
 CCActionInterval\* back = move~~\>reverse;
 CCFiniteTimeAction\* seq = CCSequence::create;
 m\_tamara~~\>runAction( CCRepeatForever::create((CCActionInterval**)seq));
 // Scale the map to reproduce the flickering problem
 // Create follow player action to move the map to reproduces the flickering problem during movement when scaling has occured
 // Set the map’s boundary region
 float fMaxBoundaryWidth = map~~\>getMapSize.width** map~~\>getTileSize.width;
 float fMaxBoundaryHeight = map~~\>getMapSize().height \* map~~\>getTileSize.height;
 cocos2d::CCRect mapBoundary = CCRect;
 // Create the follow action
 CCAction\* pFollowAction = cocos2d::CCFollow::create;
 // Run the follow action

bRet = true;
 } while (0);

return bRet;

void HelloWorld::onEnter()

// NOTE: I usually set this in AppDelegate but I have done it here onEnter to replicate the TileMapTest. Either way makes no difference to this problem.
void HelloWorld::repositionSprite
 CCPoint p = m\_tamara~~\>getPosition();
 CCNode\* map = getChildByTag(1);

// there are only 4 layers. (grass and 3 trees layers)
 // if tamara \< 81, z=4
 // if tamara \< 162, z=3
 // if tamara \< 243,z=2

// ~~10: customization for this particular sample
 int newZ = 4~~ ( (p.y-10) / 81);
 newZ = max(newZ,0);

map-\>reorderChild(m\_tamara, newZ);


So is there no one who can help with this? I still need a fix.


You can try changing #define CC_FIX_ARTIFACTS_BY_STRECHING_TEXEL 0 to #define CC_FIX_ARTIFACTS_BY_STRECHING_TEXEL 1 in ccConfig.h


Thanks for your reply Leszek but that doesn’t help either. I had already tried all of the general possible routes cocos2d-x is meant to fix their artifacting and flickering problems but none of those seem to fix it so I was hoping someone knew of something else that could be done.

I should probably list what I have done/tried:

  • Added a padding of 2 to spritesheets
  • Added margin spacing of 2 to spritesheets
  • Added extrusion to spritesheets
  • Set projection to 2D
  • Set the design resolution size
  • Scaled content properly according to the Multi-Resolution support page
    EDIT: Forgot to add - Anti-aliasing is not used

By the looks of it, and the lack of responses, I think I’m going to avoid scaling in my tile-based games unless someone manages to come up with a solution or better scaling support is implemented.


You also might try disabling subpixel render (CC_NODE_RENDER_SUBPIXEL and CC_SPRITEBATCHNODE_RENDER_SUBPIXEL in ccConfig.h). It may albo be a good idea to have all the sprites/tiles at even sizes. I’m not sure if this is related to your problem but you can also look at this:


Thanks Leszek, I really appreciate the support; unfortunately I’ve just tried CC_NODE_RENDER_SUBPIXEL and CC_SPRITEBATCHNODE_RENDER_SUBPIXEL now due to your suggestion but it didn’t make any difference.

I forgot to add turning off anti-aliasing to the list of things I have already done - I turn off anti-aliasing when making my tile maps due to being 2D projection as anti-aliasing with 2D projection causes horrible artifacts and flicker. I will edit it now and put this list in my first post, as well as adding your suggestions to my list now too.

EDIT: Forgot to mention that I do have all of my tiles at even sizes.



have you solved this issue? I have the same flickering with cocos2d-x 2.2.2
I also tried your suggestions above.

If I set projection to 2D I see many vertical lines which are as high as a tile. When I set no projection (default = 3D) the pixels seems to wobble over the screen.

I have these effects only when I do scroll the map.


any update?


I leave this here just in case someone wants another point of view to this problem. I had this same artifacts-tile issue with cocos2d-x 3.8, and also tried all the suggestions related in this topic without success. So at the end I changed my first idea (to use a TMX map directly as a visible layer in the game) and I did the next:

  • First, in Tiled I exported the TMX map as a PNG image.
  • Second, I loaded this image as a Sprite in Cocos2dx.
  • Third, I loaded also the original TMX map to check objects positions, collision shapes, etc.

Its not the best option I guess, but if you’re desperate (as I was) with this issue maybe this solution can be enough to continue with your work.