Weird Texture issue

Ok so here is the deal. I have a 2d tiled game. On my latest game, I have a weird issue with texture and I have no idea why I have this ( I could only reproduce it once but players do find it from time to time). Here are some information.

  • It happens to some people (probably 5% or so)
  • It happens after they play for a while (30 minutes or so) without quitting the game/going to the background etc
  • The game has 15-20 textures/spriteframes from TexturePacker from 512x512 to 2048x2048 (not necessary PoT)
  • I load all sprite frames at the beginning and do not unload them.

Suddenly, when the player plays, the screen goes all wrong as if all the textures were now corrupted. But when you look closely, you realize that all tiles now point to the distortioned Monsters spriteframes. The UI (which is in a different spriteframe) also points to the Monsters spriteframe.

Like if all textures now point to the distortioned monster spriteframe. It is always the monsters that ends up displayed.

Anyone would have an idea what could cause the issue? Some pointers as to where to look for. It only happens on Android. The devices where it happens are not necessarily low-end devices. The game uses about 300 megs of memory. So technically it should not be an out-of-memory issue. It happens on 1 gig+ memory devices

Could it be unloaded memory, the texture itself, the shaders, triangles, material or what not?

It would help to give some more info, such as which version of Cocos2d-x?

Have you checked the github repo issues for any mention of something similar? Also, best to check both merged and un-merged PRs on github for changes you may not have in the version you’re using, in case this issue has been reported before and fixed.

There is one obvious difference about Android, which is this (in CCPlatformMacros.h):

 * Enable it if you want to cache the texture data.
 * Not enabling for Emscripten any more -- doesn't seem necessary and don't want
 * to be different from other platforms unless there's a good reason.
 * @since v0.99.5
    #define CC_ENABLE_CACHE_TEXTURE_DATA       1
    #define CC_ENABLE_CACHE_TEXTURE_DATA       0

You could try setting that to 0 for Android, and then try to reproduce the issue. If it doesn’t occur, then you’ve at least narrowed down where it is happening.

Thanks for the info, but I don’t think this is related.

I have 5 games out there, the first 3 do not have the issue and the last 2 do have it. They all use the same version of cocos (3.17) and the same game engine that we put on top of cocos. However, the last 2 games had some major modifications/new features etc in the game engine.

We understand that part of what we modified created it. However, since there is quite a bit of modification, we are unable to figure out what did this. So I was wondering if someone saw something similar before and could point to some kind of direction as to what could cause this to reduce the place we have to look.