Crosswalk Intel XDK experiences

Discussion and feedback on Construct 2

Post » Thu May 29, 2014 3:15 am

GameThirsty wrote:Has anyone noticed that the battery usage is VERY high using Crosswalk, even when the app is exited and paused in the background?


Thanks for your reporting this issue. Logically, it would not be very high in power consumption since we already have special considerations and handling for power saving, e.g. JS timer pause when switching to background, resource releasing when app is exited.

Could you please upload your workload so that we can analyze further?
B
4
S
1
Posts: 35
Reputation: 416

Post » Thu May 29, 2014 4:55 am

Mayfly wrote:I managed to sort my issue with regards to signing my apk and updating an older CJS google play store listing.

@silverforce
I also get the blurry image issue even on small images. I have to set the high DPI to yes to make smooth graphics for my app. I believe this will give a performance issue on most phones though :( In CJS all my graphics were fine with that turned off.


@Silverforce, @Mayfly, I managed to set up the test case to reproduce the blurry image issue, and work out a solution to resolve it for Crosswalk.

As mentioned by @Mayfly, the image would NOT become blurry if the high DPI is turned on by Contruct2. That is true because, on a high dpi device, the display density is always greater than 1, for example, it is 2.0 on Google Nexus 7, and so window.devicePixelRatio in Crosswalk engine is also set to 2.0. The value of window.devicePixelRatio will be used to draw canvas by C2 runtime if high dpi mode is turned on, to get a more sharp image. In case of high dpi mode is turned off, C2 runtime tries to draw the canvas with the default value 1.0 on a high-dpi screen, as a result, the final image output becomes blurry since the pixels drawn by C2 runtime would be hard-scaled to fit the high-dpi screen dimension.

The solution for Crosswalk is simple, you can pass --force-device-scale-factor=1.0 command line option to Crosswalk engine in assets/xwalk-command-line. Note the command line file is supported from Crosswalk 6.

With the above command line option, the Crosswalk engine force to set the device scale factor to 1.0, and so window.devicePixelRatio is 1.0 accordingly no matter the value of the device density. In this case, when C2 runtime would draw the canvas which can fit the screen dimension without hard-scaled.

The memory consumption is decided by the size of canvas. In case of high dpi mode is enabled, for example, on Nexus7 with 1920x1200 resolution, the canvas size is 1920x1080, while in case of high dpi mode is disabled, the canvas size is 960x540.

Another way to resolve this issue is to enable high dpi mode in C2. Don't worry, it won't consume more memory than CJS. The reason is, CJS has its own implementation for canvas, it internally enables high dpi mode for canvas drawing on a high dpi device regardless of whether it is enabled in Contruct2 project setting.
Last edited by hmin on Thu May 29, 2014 5:26 am, edited 1 time in total.
B
4
S
1
Posts: 35
Reputation: 416

Post » Thu May 29, 2014 4:56 am

@Mayfly, for it to also happen on stable builds is definitely a worry. Hopefully @guangzhen can find the problems and Intel will be able to fix this issue soon. As this problem does make it impossible to release the game.

@GameThirsty, that's interesting! I had no idea. Because I've yet to try cacoon, I can't really tell. So far for my phone, I can't really tell.
B
46
S
23
G
31
Posts: 693
Reputation: 20,637

Post » Thu May 29, 2014 6:37 am

hmin wrote:
Mayfly wrote:I managed to sort my issue with regards to signing my apk and updating an older CJS google play store listing.

With the above command line option, the Crosswalk engine force to set the device scale factor to 1.0, and so window.devicePixelRatio is 1.0 accordingly no matter the value of the device density. In this case, when C2 runtime would draw the canvas which can fit the screen dimension without hard-scaled.

The memory consumption is decided by the size of canvas. In case of high dpi mode is enabled, for example, on Nexus7 with 1920x1200 resolution, the canvas size is 1920x1080, while in case of high dpi mode is disabled, the canvas size is 960x540.

Another way to resolve this issue is to enable high dpi mode in C2. Don't worry, it won't consume more memory than CJS. The reason is, CJS has its own implementation for canvas, it internally enables high dpi mode for canvas drawing on a high dpi device regardless of whether it is enabled in Contruct2 project setting.


Hmin really nice work on the fix.

Can I ask for clarification?

Its noted that in C2, enabling high DPI will reduce performance in crosswalk compiled games. Does the forcing via command line to 1 density work differently so that it doesn't reduce performance?

Either way its good to know the blurry image issue can be easily resolved. Thanks!
B
70
S
24
G
19
Posts: 1,757
Reputation: 17,614

Post » Thu May 29, 2014 9:36 am

Silverforce wrote:Its noted that in C2, enabling high DPI will reduce performance in crosswalk compiled games. Does the forcing via command line to 1 density work differently so that it doesn't reduce performance?

Either way its good to know the blurry image issue can be easily resolved. Thanks!


@Silverforce, may I know how much performance impact in high DPI mode? According to my observation, the way by command line option is almost the same as by C2 configuration for high DPI, so they should be at the same performance level.
B
4
S
1
Posts: 35
Reputation: 416

Post » Thu May 29, 2014 10:54 am

hmin wrote:
Silverforce wrote:Its noted that in C2, enabling high DPI will reduce performance in crosswalk compiled games. Does the forcing via command line to 1 density work differently so that it doesn't reduce performance?

Either way its good to know the blurry image issue can be easily resolved. Thanks!


@Silverforce, may I know how much performance impact in high DPI mode? According to my observation, the way by command line option is almost the same as by C2 configuration for high DPI, so they should be at the same performance level.


Hmin, thanks for the response. I will do some more testing with XDK (with C2 set for high DPI and the command line option) & CocoonJS tomorrow. My ISP is horrible so uploading a big project takes me a very long time.

Just from your own experience, which option results in the best image quality or performance (or they are the same, no difference)? Enabling high DPI in C2 or using the command line option with XWalk?
B
70
S
24
G
19
Posts: 1,757
Reputation: 17,614

Post » Thu May 29, 2014 10:14 pm

@hmin

I prefer not to show people my project, it is my main project. Maybe it is just my phone, it is getting rather old and the battery is starting to go with it.


On another note, I did notice that the app's (no matter if its a plain new project or my main project), sometimes close for no reason when I exit the app and re open it. (not exiting the app entire, just closing it using home button, and opening it up later, or sometimes if i keep the app running and just turn off the phones screen, and turn it back on, app crashes and restarts.) is this something you are aware of as well?
B
18
S
6
Posts: 348
Reputation: 2,633

Post » Fri May 30, 2014 1:16 am

Silverforce wrote:
Just from your own experience, which option results in the best image quality or performance (or they are the same, no difference)? Enabling high DPI in C2 or using the command line option with XWalk?


@Sliverforce, both of the two ways (enabling high dpi in C2 and using cmd line option with XWalk) are the same in image quality and performance. They are two different ways to let Crosswalk engine use the right devicePixelRatio when painting canvas.
B
4
S
1
Posts: 35
Reputation: 416

Post » Fri May 30, 2014 1:26 am

GameThirsty wrote:@hmin

I prefer not to show people my project, it is my main project. Maybe it is just my phone, it is getting rather old and the battery is starting to go with it.


On another note, I did notice that the app's (no matter if its a plain new project or my main project), sometimes close for no reason when I exit the app and re open it. (not exiting the app entire, just closing it using home button, and opening it up later, or sometimes if i keep the app running and just turn off the phones screen, and turn it back on, app crashes and restarts.) is this something you are aware of as well?


@GameThirsty, the issue your reported is by-design for all apps running on Android system. On Android, each app has its lifecycle, the system may terminate an background app to free resource if the Android system is running into low memory. An app would be switched to background if you press home button or back button or turn off the screen. This is why you find the app exits and restarts when re-opening it again.

Regarding to the crashes, did you have an evidence? for example, an error dialog or adb logcat error message.
B
4
S
1
Posts: 35
Reputation: 416

Post » Fri May 30, 2014 3:41 am

hmin wrote:
Silverforce wrote:
Just from your own experience, which option results in the best image quality or performance (or they are the same, no difference)? Enabling high DPI in C2 or using the command line option with XWalk?


@Sliverforce, both of the two ways (enabling high dpi in C2 and using cmd line option with XWalk) are the same in image quality and performance. They are two different ways to let Crosswalk engine use the right devicePixelRatio when painting canvas.


I've just tested with High DPI in C2 and compiled with Intel XDK using the canary beta option. It broke my WebGL effect "Glass" (from C2's default effects), it works fine with High DPI is set to No in C2. Quite strange.

All it is is a 128 x 128 white sprite with Glass effect, set to grow by 20 pixels height and width every frame.

As for the High DPI setting itself, it works at making the image much better quality (same as CocoonJS). There is a noticeable drop in performance, I am doing more tests now to give you an exact performance loss figure.

Edit: Seems to go from an average fps of 45 to 40 with the DPI settings but on high DPI, it has more drops down to 30 fps. CocoonJS is most of the time 60 fps, with dips to 50. This is on my LG G-Pad with Snapdragon S600.
B
70
S
24
G
19
Posts: 1,757
Reputation: 17,614

PreviousNext

Return to Construct 2 General

Who is online

Users browsing this forum: No registered users and 18 guests