Sprites appearing as black rectangles in my game

Hi everyone,

I’ve created a game for iOS and Android and have just released on both respective stores. The game works fine on all iOS devices, however there seems to be an issue on a select group of Android devices. It works on most Android devices but yeah there are a few showing this particular issue…

The issue people have experienced is that when they open the game, everything is black. The background is black. All the sprites are black. So pretty much all they see is a black screen and this obviously makes the game unplayable. The music and sounds however are fine. Even though the buttons are black, they are still pressable and responsive. I haven’t been able to track down what’s causing the issue, but what i can tell you is my game’s images are all derived from a massive spritesheet (png file). Each sprite seem to appear as black rectangles (their physics body shape). There are however 2 images that are separate from this spritesheet (clouds images i use in the game), and they seem to appear fine! So there seems to be an issue with displaying sprites from the spritesheet.

The other main lead that MIGHT help pinpoint the problem is that the Android devices manifesting this anomaly are Samsungs with Android 5.0.1 and Knox version 2.3. I’m suspicious that there is some issue with sprites on Lollipop. My friend who is seeing the issue has a Samsung Galaxy Note4. Her husband has the exact same phone but older Android version and it works fine on his.

Has anyone seen issues like this recently? How have you come to resolve it. If not, does anyone have any suggestions on how i can fix this?

Thanks.

Is there any one you know that has the problem where you could borrow their device, plug it in to your USB port and run “adb logcat” to look at the device’s console log.

Rob

Hi Rob, yes i’ve spoken to one of my friends who has the issue on her phone and she’s letting me borrow it for 1 night. I’ll try running that command tonight. Is there anything you expect to see in the logs?

Is there anyway your engineers can possibly run tests on their end to check that sprites appear correctly on Android versions >= 5.0.1? I’m not insinuating that they haven’t done this during their development, i just wanted reassurance that they don’t see the issue either  :wink:

Thanks.

We ran a full battery of tests just a few weeks ago when we release the latest public build.  I personally ran tests of all of our sample apps (including all of our sprite samples) on my Google Nexus 7 running Android 5.1 and there were no problems.

I’m looking for any errors or warnings that might be in the log.

Rob

Are you setting defaults anywhere? If you’re doing something like display.setDefault for textureWrapX/Y to “repeat” or anything else that requires the image to be sized in powers of two, it will cause issue. There are gotchas that may not be triggered on every device.

Thanks Rob. I ended up using Google’s monitor tool and couldn’t find anything suspicious in the logs.

Then i decided to create a test app for testing loading of sprites and they were fine. I then used that same test app against my game’s spritesheet and then i was able to reproduce the problem. The only difference was the size of the spritesheet.png file. My game’s spritesheet is massive, like 6000x8000. As an exercise, i removed a whole bunch of sprites from there to make it smaller and inputted it back into my test app and it worked!

So to fix my game, i had to split my spritesheet into 2 smaller spritesheets. Can anyone explain this? I thought if the texture size of spritesheets were too big then android would just scale it down? Are there any drawbacks to what i did?

Hi Michael, no don’t set any defaults anywhere. I did see an old forum post with regards to that though. Unfortunately, it didn’t help. Yeah it’s a bit discouraging to see your app work on some android devices and doesn’t work on others.

What does system.getInfo(“maxTextureSize”) return on those devices?

I will  have to get clarification on this.  I know we shrink images down to 2048, but I don’t know if we resize image sheet before we try and make individual images and sprites out of it.

But that would cause the black images.

Rob

Unfortunately, I only had one intimate night with the phone in question. I should have thought of retrieving that information  :frowning:

Hmm ok. Well at least we’re on to something here. It would be great if you could get some clarification Rob. Much appreciated.

Also Rob, if what you say explains the black images, then why does it work on iOS and other Android devices?

Different device/os combinations have different maxTextureSize limits.

Rob

So the maxTextureSize limits haven’t been exceeded in the iOS cases?

Engineering has confirmed that we resize to the maxTextureSize for Android for display.newImageRect, display.newImage and display.newImageSheet.  Is it possible your individual sprites were too large?

If you’ve worked around this great.

Rob

I see. No, my individual sprites would not have been too large. They include things like buttons and other smallish images which i doubt would have been larger than the maxTextureSize of any device.

The workaround worked but it would be good to find out why it worked.

Is there any one you know that has the problem where you could borrow their device, plug it in to your USB port and run “adb logcat” to look at the device’s console log.

Rob

Hi Rob, yes i’ve spoken to one of my friends who has the issue on her phone and she’s letting me borrow it for 1 night. I’ll try running that command tonight. Is there anything you expect to see in the logs?

Is there anyway your engineers can possibly run tests on their end to check that sprites appear correctly on Android versions >= 5.0.1? I’m not insinuating that they haven’t done this during their development, i just wanted reassurance that they don’t see the issue either  :wink:

Thanks.

We ran a full battery of tests just a few weeks ago when we release the latest public build.  I personally ran tests of all of our sample apps (including all of our sprite samples) on my Google Nexus 7 running Android 5.1 and there were no problems.

I’m looking for any errors or warnings that might be in the log.

Rob

Are you setting defaults anywhere? If you’re doing something like display.setDefault for textureWrapX/Y to “repeat” or anything else that requires the image to be sized in powers of two, it will cause issue. There are gotchas that may not be triggered on every device.

Thanks Rob. I ended up using Google’s monitor tool and couldn’t find anything suspicious in the logs.

Then i decided to create a test app for testing loading of sprites and they were fine. I then used that same test app against my game’s spritesheet and then i was able to reproduce the problem. The only difference was the size of the spritesheet.png file. My game’s spritesheet is massive, like 6000x8000. As an exercise, i removed a whole bunch of sprites from there to make it smaller and inputted it back into my test app and it worked!

So to fix my game, i had to split my spritesheet into 2 smaller spritesheets. Can anyone explain this? I thought if the texture size of spritesheets were too big then android would just scale it down? Are there any drawbacks to what i did?

Hi Michael, no don’t set any defaults anywhere. I did see an old forum post with regards to that though. Unfortunately, it didn’t help. Yeah it’s a bit discouraging to see your app work on some android devices and doesn’t work on others.