
Show HN: Ejecta, A Fast, Open Source JavaScript, Canvas Implementation for iOS - phoboslab
http://impactjs.com/ejecta
======
phoboslab
Thanks for the great response so far!

I also wrote about some implementation details of the Canvas API and the
challenges with OpenGL in my blog:

<http://www.phoboslab.org/log/2012/09/ejecta>

~~~
mrspeaker
Thanks very much for open sourcing this. Keep up the good work - everything
you post is great... great information, and great code. Thanks again!

------
soapdog
I purchased ImpactJS after picking the "Creating HTML5 Games" book about it. I
was really surprised with the quality of the toolkit and how responsive the
developer is. I think it was the best investment I made this year and I can't
wait to release some games.

~~~
city41
I'm very happy with impact. It's well designed and easy to extend. After quite
a bit of exploring different frameworks and engines (including writing my
own), I think impact is my long term game dev solution.

------
programminggeek
ImpactJS is a fantastic tool and Ejecta solves a real problem in a smart way.
Phobos Lab does awesome work.

~~~
firlefans
This guy is a hacker in the truest sense, I read a blog post over a year ago
about him tinkering away on this. It didn't seem he'd take it this far. It's a
great achievement and I'm glad he's been insightful enough to keep it free.

~~~
yesimahuman
I used Impact two years ago on something and I was so impressed with the API
simplicity and power (not to mention the fact that it ran very well). This guy
does great work.

------
drcode
Any plans on making it usable without XCode? (or a Mac, for that matter.)

Since the users just write javascript code, as long as you give them a way to
insert that code into an app, they wouldn't really need to use the XCode build
system at all (I know, app store rules would need to be addressed...)

~~~
imaffett
DirectCanvas from appMobi (I work there) is based on iOS impact (and enhanced)
- <http://www.appmobi.com> . No need for a Mac or XCode.

------
dj2stein9
This looks like a great way to build iOS games in HTML5.

If he could to get this to work as an Android project it could be used to
build games for OUYA.

------
TazeTSchnitzel
I want this in the browser. Throw away the DOM, and let's just have canvas and
JS. Skip loading any HTML or CSS. It would be great.

~~~
wwweston
In fact -- why do we even have browsers?

If only there were some popular write-once run-anywhere VM, we could pretty
easily get away from this weird document-oriented web thing forever.

~~~
TazeTSchnitzel
Yeah, like Java. :P

------
jaipilot747
That the canvas API is implemented with OpenGL is very impressive. CocoonJS
[1] (a similar project for Android, as noted in the comments below) seems to
have taken the same approach.

On a completely tangential note, given that the main desktop browsers now
sport hardware accelerated canvas implementations, is there a performance
difference in 2D graphics rendered with canvas vs. WebGL?

[1] <http://ludei.com/tech/cocoonjs>

~~~
spot
webgl can be much faster because you can draw many primitives with one call.
there's a lot of overhead from js down to gl.

~~~
jaipilot747
Then what is stopping browser vendors from implementing canvas directly in gl
directly, making canvas more or less a wrapper?

~~~
greggman
Canvas is directly implemented in gl (or directx) in most browsers at this
point. WebGL is still faster like the poster above says because you as the
programmer an can make optimizations that are not possible with the canvas api
like drawing many things with one call.

[http://blog.tojicode.com/2012/07/sprite-tile-maps-on-
gpu.htm...](http://blog.tojicode.com/2012/07/sprite-tile-maps-on-gpu.html)

------
kevingadd
Isn't JS performance going to suffer if it's using a custom build of JSC that
can't JIT?

~~~
killahpriest
Native iOS doesn't have JIT

~~~
kevingadd
The browser certainly does. Or is this only an alternative to a WebView in an
app store app?

~~~
vicapow
even google wasn't able to include a JIT in Chrome for iOS

~~~
mamp
Safari uses a JIT. Other browsers and UIWebView based applications are not
allowed to access the JIT, apparently because it is a security risk. Even lua
based apps are not allowed to run luajit because code generation on iOS isn't
allowed within apps.

------
arturadib
Interesting! I created Node-Five with a similar goal in mind (low-level
graphics and audio from the HTML5 spec):

<http://documentup.com/arturadib/node-five>

Glad to see someone had the same idea for iOS :)

------
dsirijus
Pretty cool.

What about the support for Android, any plans for that?

~~~
kylebrown
I was curious about that too. With android support, it would be a good
alternative to Corona (use js instead of Lua).

For iOS, an added benefit of is that JavascriptCore uses Nitro, unlike
UIWebView.

~~~
jevinskie
JSC as used by an app store app does not use Nitro. As the post stated, JSC is
a private framework and the only way to use it in an approved app is to import
the source into your project and build a copy of JSC that is bundled with your
app. Since the JSC that you use is contained within your executable, iOS
doesn't allow the write and execute permissions in memory that would be
necessary for JIT.

------
wklauss
Reminds me of CocoonJS (basically the same idea, also support for Android but
closed source).

<https://vimeo.com/45506217>

Neat in any case. Looks like a nice implementation.

------
SunboX
Really great work! One question belonging to this, do you know how to used 4x5
ColorTransform Matrices with JavaScript and WebGL/OpenGL? I can't find
anything about this on the I-net.

------
matthuggins
As far as I am aware, ImpactJS is unfortunately only for tile-based game
development on canvas. Has this influenced/limited Ejecta in any way?

------
tlrobinson
Cool. This sounds a bit like Game Closure (<http://gameclosure.com/>)

------
icemelt8
The quicker you guys realize it the better, Flash is the better choice.

------
vicapow
Apple needs to just buy you out right and include this in safari.

------
wsc981
Just wanted to tell this is some really cool work you've done.

------
grimboy
Any actual benchmarks?

~~~
phoboslab
I haven't done any formal benchmarks. A quick test with 1000 sprites runs with
60fps on the iPhone4s.

Also try loading this in Mobile Safari and compare it to the video:
<http://www.phoboslab.org/crap/bezier/>

------
acron0
Bugger. There goes my pet project. Nice one phoboslab!

------
rabidsnail
The word "Ejecta" sounds dirty. I feel weird just typing it.

~~~
antidaily
You're probably not old enough to have had a walkman?

