HTML5 game performance on mobiles is often a problem, especially with old devices. CocoonJS by Ludei is a service that wraps your game as a native mobile app (similar to how PhoneGap works), but also significantly boosts performance using hardware acceleration. This can result in a 5-10x performance increase, often resolving performance problems.
Integrating with CocoonJS features
To add CocoonJS specific features to your game, such as adverts or in-app purchases, add the CocoonJS object to your project.
For more information about how to set up the Cloud Compiler for adverts, refer to the official Ludei documentation here: http://wiki.ludei.com/cocoonjs:extensions:ad
Exporting for CocoonJS
In the Export Project dialog, choose Export for: CocoonJS.
Open the folder exported to. When exporting to CocoonJS, you will just get a single .zip file exported. This is the file you need to submit to the CocoonJS service.
Get the CocoonJS Launcher
To test your game works before building it, install the CocoonJS Launcher app for your phone.
CocoonJS Launcher in the Google Play store
CocoonJS Launcher in the iTunes store
Run the app and press Your app. You'll need to press the Register button and get a registration code. When you receive your code, enter it in to the app. It'll be saved so you only need to enter it once.
Testing with the CocoonJS Launcher
To test your game, enter its URL (e.g. from the public link on Dropbox) to the Launcher app, and press Launch current. CocoonJS will download the zip, then launch the game.
After pressing Launch current, you can also later press Launch previous to run the last entered URL again. There are also options to save your games to the SD card so you can preview several of them even without a connection.
You can touch the cog button to enable debug mode. In debug mode an FPS counter will appear. You can press the FPS counter to see a debug log which may include helpful information about unsupported features or any errors that happened.
It's also possible to use Preview over Wifi when testing with the CocoonJS launcher, which helps speed up testing cycles significantly. Just enter the preview URL in to the Launcher app's URL field, e.g. 192.168.1.3
Compatibility
The following features are not supported in CocoonJS. If any of them are used, Construct 2 will print a message to the debug log saying that they are not supported.
- The form control plugins Textbox and Button are not supported.
- The XML object is not supported.
- The Facebook object is not supported.
- The letterbox fullscreen modes are not supported. If they are selected, it will fall back to 'Scale outer' mode instead.
- The Text plugin's 'Set web font' action is not supported.
- The WebStorage plugin's session storage is not available. Use local storage or global variables instead.
Using the Cloud Compilation system
Once you've tested your game with the launcher and are happy that everything is working, you can go ahead and build it. Ludei provide the Cloud Compilation system, which is where you upload your app to Ludei's servers which build it in to Android and iOS native apps.
To find out more about this process, it is best to use Ludei's documentation. Visit this URL to get started using the Cloud Compilation system:
http://wiki.ludei.com/cocoonjs:cloud
And best of luck publishing your iOS and Android apps!