Tile glitches from tilemap on android.

I’ve built my game for android and am running it on my Nexus S and I’m noticing an odd issue around tiles from a loaded tilemap (especially when the screen is moving).

I’ve attached a screenshot (it won’t let me add more files?) that shows the issue on the left and right side. Though I’ve certainly seen more issues (though it is a little hard to get a good screenshot).

This issue does not occur when I target Mac OS and build for that. Any tips are appreciated! Let me know if I should provide more information or try to get a better screenshot.

Thanks,
C.J.

EDIT
Versions

cocos2dx: 2.1rc0-x-2.1.3

sdk: The ADT bundle (20130522) from http://developer.android.com/
ndk: r8e
target: android-8


Screenshot_2013-07-03-00-17-00.png (13.9 KB)

No responses, maybe a different approach would be better ;)…

I assume someone has successfully used CCTMXTiledMap on an android device and didn’t have VERY noticeable alignment issues (or other odd graphical issues)when the screen moved around. If that someone is you, what picture type did you use? Did you build it using Texture Packer? If so, what options did you select? What android API version were you targeting (I left it as 8 which is what it was set at in the proj.android folder)?

Maybe that’ll help :).

Hi,

Please try putting the below code after loading your tmx file. Let me know if it works for you.

CCArray* pChildrenArray = map~~>getChildren;
CCSpriteBatchNode* child = NULL;
CCObject* pObject = NULL;
CCARRAY_FOREACH
{
child = pObject;
if
break;
child~~>getTexture()->setAntiAliasTexParameters();
}

Nope made it worse :).

Attached is the screenshot of how it looked.

EDIT Though this feels like its on the right track (visually very similar)? Any suggestions on what I could pass to setTexParameters() to see if it would help? I’ll go investigate how to use this in the mean time :).

Try setting CC_FIX_ARTIFACTS_BY_STRECHING_TEXEL to 1 (defined in include/ccConfig.h)

That fixed similar issues for me in windows platform, maybe it helps in android also.

Thanks, that did the trick.

After playing around with it I realized that it was borrowing a pixel from the tile next to it. I’m guessing it was trying to draw the tile on a spot that slightly larger than the tile size so it went to its neighbor. I could probably avoid having that issue by better laying out my sprite sheets in the future though having it stretch (which is what that flag sounds like it does) solves the issue well enough for me.

@ C.J. Kimberlin
I fixed the similar issue with that code. What type of projection are you using? If you are using kCCDirectorProjection3D , try setting it to kCCDirectorProjection2D
In your AppDelegate.cpp in function applicationDidFinishLaunching() put the below code

CCDirector::sharedDirector()->setProjection(kCCDirectorProjection2D);

This code may solve your problem.

Placing that line reduces the graphical issues but there are still some when the screen moves.