Hacker News new | ask | show | jobs
by mephitix 3047 days ago
"Games can be compiled to iOS, Android and native apps via 3rd party tools"

Gonna need some explanation here... does it spit out native code? Where are the tools? And since it's HTML5 why can't I just run the thing in a native web view? Are there perf issues?

4 comments

I built a (very simple) game in Phaser a couple of years ago and used cocoon (https://cocoon.io/) to package it up into an Android and iOS app. Basically it packages the HTML/JS/CSS app into a native webview.

Phaser is a great framework. I managed to conceive, write the game from scratch and have it in the app store within a day.

It's no longer on the iOS store as I didn't continue to pay my dev licence, but happy to share the play store link if anyone is interested.

Can we see the game? :)
Of course! Though, I just tried to launch it on my phone for the first time in a year or so and it just crashes at the title screen YMMV (OnePlus3 running 8.0.0)

https://play.google.com/store/apps/details?id=com.fraserhart...

It crashed for me too. It's a shame, I was curious to see what was achievable in a day of work!
I had many issues with iOS since their web view component didn’t enjoy full webgl accelleration. This made opening my game slow in chrome and slow when wrapped in a cordova app without using crosswalk, eventually just reduced graphic demands precalculating composed sprites, placing caps on concurrent bullets, reducing the game area etc.

In the end was running well enough from the browser too making wrapping moot.

It’s published at http://increstellar.com and the code is not obfuscated but beware: it’s very amateurish

I'm not part of the Phaser development team, but I imagine the 3rd party tool they're referencing is Cordova. If you're using the CLI generator for Cordova, you'd put your finished project in the `www` folder and plug in your test device to see how it runs. This creates a webview app that runs on Android and iOS devices.

I'm not an Android or Swift dev, but I imagine you can just stick it in a native webview, which is what I believe Cordova does.

As for performance I can't imagine it's super-performant, but I do know the lead dev does his best to aim for 60fps rendering even under heavy duress.

It could also be using something like Ejecta[1], which wraps a javascript engine with a simple native reimplementation of the canvas API. Ejecta is great because its lightweight - you don't pull in all of Webkit like cordova. (And thus you don't have to deal with any of its opaque, ever-changing quirks.)

[1] http://impactjs.com/ejecta

I would love to know this as well. Ideally it should just map the WebGL calls to native OpenGL. If this is not the case, why not?