Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[C3 runtime] Instant Games not correctly handling suspend/resume #2403

Closed
RichardAstrom opened this issue Dec 5, 2018 · 12 comments
Closed
Assignees
Labels

Comments

@RichardAstrom
Copy link

RichardAstrom commented Dec 5, 2018

Problem description

Games exported with the Instant Games Plugin and the C3 runtime gets really slow and unresponsive when you minimize (not close) the game (when playing with Facebook Messenger) and enter it again multiple times in a row. The FPS also increases by around 60 FPS everytime. This only happens if you export as an Instant Game and only on Android (we've tested both Android 6.0.1 & 8.1.0) not on iOS.

Attach a .c3p

instant_games_fps_test.zip

Steps to reproduce

  1. Export the test project as HTML5.
  2. Upload it to the Instant Games Web Hosting.
  3. Test it in Facebook Messenger.
  4. Minimize Messenger (do not close it).
  5. Enter it again (it gets slower everytime you repeat steps 4-5).

Observed result

The FPS-counter adds another 60 fps (or whatever FPS you started with) everytime you enter the test. And although it says that the FPS gets higher (there doesn't seem to be any limit), what you notice is that the actual FPS gets lower because everything slows down. Note: this does not happen if you export with the C2 runtime.

Expected result

The FPS should stay the same and there should be no slow down.

First affected release

r128 (beta)

Affected browsers/platforms

  • Chrome: Yes? (Facebook Messenger for Android)

System details

View details

Platform information
Browser: Chrome
Browser version: 70.0.3538.110
Browser engine: Blink
Browser architecture: 64-bit
Context: webapp
Operating system: Windows
Operating system version: 10
Operating system architecture: 64-bit
Device type: desktop
Device pixel ratio: 1
Logical CPU cores: 4
Approx. device memory: 8 GB
User agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.110 Safari/537.36
C3 release: r128 (beta)
Language setting: en-US

Local storage
Storage quota (approx): 14 gb
Storage usage (approx): 187 mb (1.3%)
Persistant storage: Yes

Browser support notes
This list contains missing features that are not required, but could improve performance or user experience if supported.

Nothing is missing. Everything is OK!
WebGL information
Version string: WebGL 2.0 (OpenGL ES 3.0 Chromium)
Numeric version: 2
Supports NPOT textures: yes
Supports GPU profiling: yes
Supports highp precision: yes
Vendor: Google Inc.
Renderer: ANGLE (AMD Radeon HD 7800 Series Direct3D11 vs_5_0 ps_5_0)
Major performance caveat: no
Maximum texture size: 16384
Point size range: 1 to 1024
Extensions:

EXT_color_buffer_float
EXT_disjoint_timer_query_webgl2
EXT_texture_filter_anisotropic
OES_texture_float_linear
WEBGL_compressed_texture_s3tc
WEBGL_compressed_texture_s3tc_srgb
WEBGL_debug_renderer_info
WEBGL_debug_shaders
WEBGL_lose_context
Audio information
System sample rate: 48000 Hz
Output channels: 2
Output interpretation: speakers
Supported decode formats:

Ogg Opus (audio/ogg; codecs=opus)
WebM Opus (audio/webm; codecs=opus)
Ogg Vorbis (audio/ogg; codecs=vorbis)
WebM Vorbis (audio/webm; codecs=vorbis)
MPEG-4 AAC (audio/mp4; codecs=mp4a.40.5)
MP3 (audio/mpeg)
FLAC (audio/flac)
PCM WAV (audio/wav; codecs=1)
Supported encode formats:

WebM Opus (audio/webm; codecs=opus)
Video information
Supported decode formats:

WebM VP9 (video/webm; codecs=vp9)
WebM VP8 (video/webm; codecs=vp8)
Ogg Theora (video/ogg; codecs=theora)
H.264 (video/mp4; codecs=avc1.42E01E)
Supported encode formats:

WebM VP9 (video/webm; codecs=vp9)
WebM VP8 (video/webm; codecs=vp8)

@AshleyScirra
Copy link
Member

It sounds like the page visibility events are broken. The runtime should suspend on minimize and resume on restore, but it sounds like FB is only sending resume events, which might cause the framerate to stack up as it re-registers requestAnimationFrame loops. So this might be a bug in Messenger instead.

@RichardAstrom
Copy link
Author

Ok! But this doesn't happen if we export with the C2 runtime, any thoughts on that?

@AshleyScirra
Copy link
Member

I guess it's a bug which we previously worked around. This is why it's better to fix the root problem than just work around it... I suppose we can work around it again, but it will leave the real problem in the Messenger platform still there. Have you tried reporting it to Facebook?

@AshleyScirra AshleyScirra changed the title [C3 runtime] Slow downs and wrong FPS when using Instant Games Plugin for Android [C3 runtime] Instant Games not correctly handling suspend/resume Dec 5, 2018
@RichardAstrom
Copy link
Author

If you can find a workaround (or a fix), that would be wonderful. We would much rather use the C3 runtime for our current and future projects. We will report it to Facebook as well. Thanks!

@masscube
Copy link

masscube commented Dec 8, 2018

An update would be very useful for my current instant game project...

@AshleyScirra
Copy link
Member

You should contact Facebook to get the root cause fixed. All we can do is work around it, which is unreliable.

@masscube
Copy link

@RichardAstrom has you reported the bug to facebook already ?! This is an importend problem for instant games with c3 runtime.. i'm need a solution for the current project.. mh..

@RichardAstrom
Copy link
Author

@masscube Yes, I reported it to Facebook on Dec 6. I got a reply that they would investigate it and the current status is "Assigned". So, we're still using the C2 runtime.

@masscube
Copy link

Ah ok, thank you. I hope the fix come soon...

@masscube
Copy link

masscube commented Jan 8, 2019

Any news @RichardAstrom ? Its a littlebit bad, i can't release any (only) c3 runtime game on fb instant games..

@RichardAstrom
Copy link
Author

@masscube Nope, nothing, status is still "Assigned". Here's the link to the bug report:

https://developers.facebook.com/support/bugs/557900621304566/

@AshleyScirra
Copy link
Member

I believe this is an issue with the Instant Games SDK. I posted in the bug report explaining my findings.

Unfortunately there isn't an obvious workaround in this case so I think I will leave it to FB to fix, and hopefully they'll get on it soon. Closing this issue and will follow up on the report at https://developers.facebook.com/support/bugs/557900621304566/.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants