Crosswalk Intel XDK experiences

  • Hi Mayfly,

    I have checked your XDKOffline.apk

    And inspected the app, found the error message from console:

    "Uncaught TypeError: Cannot read property 'closeModal' of undefined "

    I have a short investigation about this error, and found it should be c2runtime error:

    There is no 'UI' item under 'Clay' for crosswalk, and will cause the javascript error.

    I have just commented out below codes in c2runtime.js

    13846: if( ID )

    Clay['UI']['closeModal']( 'clay-' + ID + '-wrapper' );

    else

    13849: Clay['UI']['closeModal']();

    And the game continued, have you missed some js file in your project?

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Hi guangzhen

    Many thanks for taking the time to look into this. I will update my apk this afternoon and retest. If there are any files missing then they are not being generated by either C2 or XDK build as everything should be made automatically?

    Ashley is there a chance that some clay.io files are not being exported properly for XDK? I remember there was something similar with clay and CJS were you had to implement some files into the exported zip file before cloud compiling it.

    THanks

  • guangzhen, That's weird. I don't think it has to do with my image specifically, because even if I use the default splashscreen image, it also happens. So far, I've tested on a HTC One and Sony Z1 and they both have the same issues. I also notice earlier that there are other members beside me who are facing this same problem. For your information, it was built using the stable built. I will try it with the beta build and report if the issue still persist.

  • rekjl

    I get the same issues with al my XDK builds. Put the phone in portrait and open the app. Turn to landscape and you get a half black and white screen for a moment while it loads. I have also noticed that sometimes a splashscreen will display if you have loaded in images, even if you choose not to have one displayed. Happens on stable and beta builds for me everytime.

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

  • 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?

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

    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.

    , 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.

  • 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.

  • > 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!

  • 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!

    , 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.

  • >

    > 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!

    >

    , 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?

  • 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?

  • 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?

    , 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.

  • 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.

  • >

    >

    > 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?

    >

    , 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.

Jump to:
Active Users
There are 2 visitors browsing this topic (0 users and 2 guests)