Screen Timeout Issues. How to prevent this or fix?

Get help using Construct 2

Post » Wed Sep 12, 2012 5:22 pm

First time asking for help on here, so hopefully this is the right place.

I have a cloud compiled CocoonJS app that I'm testing on Android devices. The issue seems to vary from device to device, but basically here's what happens. When the screen times out, the game breaks in some way. Unlocking the device to resume the game has varying results: screen goes completely black or white and won't resume, the graphics get either shrunk, offset, or streched oddly making it unplayable, or the device locks up completely, requiring a reboot. Most of the time, it just takes hitting the back button to exit out of the app, and relaunching it to get things back to normal. (Note: On my Android tablet, it works great and I can even swap between other apps and back to it, and it'll resume properly.)

Has anyone else experienced any similar problems with resuming their games, after the screen times out? Does anyone have any tips for a workaround or is there a way to prevent the screen from timing out?

The two devices I've tested this are on Gingerbead Android 2.3, and maybe it has to do with the lock screens being in the portrait orientation... so, that when it tries to resume the game, you'll see it switching to the landscape orientation and that's when things break. (My tablet is running Android 4.0 ICS, and the lock screen is landscape orientation, so maybe that's why it works?) I'm using scale mode with an oversized background sprite, and some anchored sprites.

I can post a capx file later tonight if that'll help. Similar behavior can be found even when letting the screen timeout while in the Cocoon JS launcher, so it'd be easy to verify.

*EDIT*
Added some screenshots of the Before and After to clarify the issue.

Before

After
Crazyhowie2012-09-13 00:05:34
B
17
S
2
G
3
Posts: 28
Reputation: 3,034

Post » Wed Sep 12, 2012 9:40 pm

I'd probably ask @Ludei about this.
B
90
S
30
G
24
Posts: 3,189
Reputation: 32,400

Post » Wed Sep 12, 2012 10:58 pm

Yeah, I think I'll put an inquiry into them tonight. Maybe try to capture some screens or a video of it to help clarify. I'm trying to get more feedback from other users on their devices to see if there's a common step to reproduce.

I was mostly just wanting to check with the community first. I'm not sure if other users testing their apps on CocoonJS would normally test for this. I have my timeout settings really low to save battery, so I discovered the issue pretty quickly.

If anyone else gets a chance and wouldn't mind running a quick test on their app in the CocoonJS Launcher, let the screen timeout, and see if things are stable upon unlock and resume, I would greatly greatly appreciate it!
B
17
S
2
G
3
Posts: 28
Reputation: 3,034

Post » Thu Sep 13, 2012 12:02 am

Sorry to spam my own post, but it does seem to be a lock screen/orientation related issue. I mentioned that the game resumed properly on my tablet, because it locked in landscape and the game plays in landscape. Well, I decided to test it in portrait mode and got some results.

Before Display Timeout


Lock Screen After Waking Device


The After
B
17
S
2
G
3
Posts: 28
Reputation: 3,034

Post » Thu Sep 13, 2012 12:47 am

I'm pretty sure this is a CocoonJS bug. It sounds like they are not handling the lost context event properly, which means if the device goes to sleep and wakes up the game state is lost. It's possible to fix it - you need to ask @Ludei to do that though.
Scirra Founder
B
359
S
214
G
72
Posts: 22,946
Reputation: 178,518


Return to How do I....?

Who is online

Users browsing this forum: Rezzon71, tarek2 and 25 guests