Hacker News new | past | comments | ask | show | jobs | submit login
Gordon: An open source Flash runtime written in pure JavaScript (github.com)
246 points by r11t on Jan 13, 2010 | hide | past | web | favorite | 97 comments



Quick link to demo:

http://github.com/tobeytailor/gordon/raw/master/demos/tiger....

Wish people made github pages a bit more friendly. It's like being thrown into a pit of 1s and 0s.



All three of them crashed my Chrome 4.0 tab.



Just in case anyone was wondering about the project name and is not too familiar with classic science fiction:

http://en.wikipedia.org/wiki/Flash_gordon


Flash! Ah ah. He's a miracle.


The demo uses 1/3 as much CPU as a similar Flash app would on my Mac. Very cool.


I'm not sure if that says more about the poor optimization of the Mac Flash plugin or the great optimization of your browser's (Safari? Mac Chrome?) JS interpreter.

Probably both.


There's a lot more overhead to the plugin model, since the browser has to call to the plugin via NPAPI and the plugin has to draw itself separately, vs. just being integrated into the normal reflow/repaint of the webpage.


[Safari 4, though I would expect Chrome to fare well too.]


Flash Gordon: Worst Search Engine Terms Since A* Algorithm


There's a band called '12 year old girls'.


I think that title belongs to "God" (http://god.rubyforge.org/)


Funny enough, that site still appears on the first page of google search results for "god".


Try D!


Scheme is pretty bad too.


There have been a couple of programming languages named 'English'.


I always thought a good anti-piracy measure would be to name your TV Show / Band / Game "The".


Like 'The The'? I always liked 'Various' but now they come up as 3rd result in Google.


Hmmm, the the are surprisingly searchable: http://www.google.com/search?sourceid=chrome&ie=UTF-8...


I always thought it would be funny to have a band named "Those Guys" and the first single would be "That Song"

Asking someone if they heard the single would thoroughly confuse people "Have you heard That Song by Those Guys?


Sort of like Van Morrisons band "Them" and of course "The Who"?


Abbott and Costello?


Yes but it still hurts people trying to legitimately find it.


So? Find the link, bookmark it and never search for it again :|


I was looking the other day for the webcam in the nearby village of, er, Flash. It took me a few seconds to realise why my searches for "Flash webcam" weren't finding it.


Of course it's damn impressive, but it doesn't seem very useful to me.

Nobody uses Flash for the language (actionscript is a terrible mash-up of javascript and Java, and haXe is not a lot better), or because we think the virtual machine is awesome in some way. Simply, we use it to bridge the gap between what web browsers can do and what native apps can do (access to webcams and microphones, local files, real tcp/ip sockets, etc, etc).

Having said all that, who knows - maybe web browsers really will eventually bridge those gaps themselves, and this will just be used to run legacy Flash code. It's possible I guess.


>this will just be used to run legacy Flash code

Wether flash stays dominant or not, this would still provide a way to run flash code without any proprietary plugin, and in any modern browser, so the interest is still big, from an user point of view


I invite you to switch your flash player off for a bit and see how many sites use it for all kinds of stuff.

It's a nuisance but it is so pervasive it's not even funny.


I already have, it is wonderful.

http://github.com/rentzsch/clicktoflash


I can get by without ads pretty fine.

(Though I still have the flash turned on for the occasional video or game.)


Actionscript 3 isn't that bad.


Compared to javascript though? (that's the point after all). I definitely prefer javascript to as3.


Compared to javascript, yes. True class-based inheritance, optional strict typing, getter setters, and methods and closures retain class scope. What's not to like? Null-reference errors?


as2 was sweet though. Object.watch and __resolve() were a lot of fun to work with.


You can use the Proxy object to do similar things to __resolve(), but it's slightly less flexible as you have to extend the class.


While no one uses Flash for the language, there are a lot of (non-developers) out there who use Flash (MX,CS4 or whatever it's called this week) to produce animation, etc - and we're still a long way of having a similar set of tools that produce 'browser native' content.

I'm intrigued as to how much Flash it does cover.


How is it not useful for people that need to be successful in an era when browsers aren't bridging those gaps themselves?


Because a user is going to get the same experience already with the latest Flash player, in any browser. In JavaScript, there are numerous differences, ranging from the subtle to the not-so-subtle (do they even have canvas?) "Standards" aren't worth anything if they aren't, you know, standard.


I think you're actually agreeing with me here. I am saying that this project Gordon has appeal for folks that may want to do something like display a SWF in iPhone Safari.


> ranging from the subtle to the not-so-subtle (do they even have canvas?)

That's the beauty of this thing. It works with svg -> supported by all browsers (with the obvious exception of IE, although I think it shouldn't be too hard to change it to support VML).


This was my 2009 new-years prediction... damn it, just out! The best demo is http://jancona.com/gordon/demos/blue.html


Framerate on the iPhone is terrible for the part with all the stars, then quite good.


Considering that the CPU usage on a Mac is lower than the Flash version of the same demo, that perhaps says a lot about the prospects of Flash on mobile devices . . .


That says nothing, considering this is coded up in an interpreted language (JS), compared to the speed of a compiled language (C/ObjC) on an official iPhone version of Flash, should there ever be one.


Languages aren't everything. Gnash, written in C++, never succeeded in replacing Flash even on platforms like *BSD where Flash was nonexistent.

In particular, when dealing with Flash, feature-completeness is going to be much more important than perfect performance. Since the Flash VM on Linux and OS X is so slow and software-renders everything, it really won't take much to improve on it. The advantages of a dynamic language are probably going to far outweigh C++'s speed, and Javascript's similarity to Actionscript is icing.

Plus, Javascript can take advantage of whatever hardware-accelerated graphics library the browser vendor chooses.


Ditto, using a 3GS.


Is there any kind of "Flashstone" benchmark app?


If you double click it it will kill Chrome. AW SNAP.


Don't know. Works fine for me..


Probably cause I am using the Dev build. Oops, time to submit a bug report.


Actually, I'm using Dev build as well.


Same here. Nothing happens. No Crashes. 4.0.288.1 stable build


Is there a non-dev build?!


Just mousing over it causes all my Chrome tabs to crash, consistently. Using release(not Dev) build.


Interesting. I thought one Chrome tab should not be able crash another.


All the three demos work fine on chrome dev build 4.0.249.64


Then don't double click it.


Has anyone tried this out? Is it more than a toy?

README says little http://github.com/tobeytailor/gordon/blob/master/README


http://wiki.github.com/tobeytailor/gordon/demos The demos are basically graphics tests: vector drawing, frame-by-frame animation, tweens.

http://wiki.github.com/tobeytailor/gordon/swf-tag-support-ta... The tag support table shows just how much is missing: everything from SWF 2 onwards! Many of those tags aren't feasible in pure JS right now, anyway.


Also, I think most of the newer SWF files have lots of actionscript bytecode which is something that Gordon probably can't handle unless they implement their own stack-based virtual machine and implement all of the mx.core set of libraries.


A custom virtual machine probably isn't necessary. There are plenty of flash decompilers which can emit AS3 source from bytecode — and since ActionScript 3.0 is basically the old ECMAScript 6 draft spec, it can be trivially downcompiled to plain old Javascript using Mascara (http://ecmascript4.com/). Ideally the conversion would take place on a server-side proxy, and its ouput would subsequently be cached, but it could theoretically be done on the client as well. Re-implementing the standard library remains a major issue, but certainly not insurmountable.


It would be possible (a bit slow though). This has already been done a few times with JS. For example, qBasic (http://stevehanov.ca/blog/index.php?id=92) or even virtualizing a whole device like the gameboy (http://www.codebase.es/jsgb/).


Interesting. Those work nicely using Safari on my iPhone. Looks promising.

But on Chrome 4.0.288.1 dev moving the mouse over any of the animations crashes the tab.


The demos don't work at all in IE8.


also nothing with opera 10


I have the same experience with Chrome. Mousing over the animation crashes not only the active tab, but all of the tabs in the window.


All the demos work fine for me on the Chrome 4.0.288.1 dev.


Interesting. Works fine on 4.0.249.49.


works for me in Chromium 4.0.266.0


It doesn't look like it supports sound or video.


There appears to be support for video in there, audio is a different issue. http://github.com/tobeytailor/gordon/blob/master/src/Movie.j...


That's the Flash Movie object, not H264 or Indeo video. A Flash Movie object is what Macromedia decided to call their hybrid format (like "page" for the Web, or "track" for audio).


Well, it could be done with HTML5 and the video tag.


It's a great new beginning, and a monumental effort on the part of one guy (the developer). Flash is undocumented (apart from what Adobe decided to share with search engine crawlers), and difficult to reverse-engineer.


This is not true at all. Flash is now an "open standard", in that Adobe released the specs to the file format, the VM, and most (all?) of the video format. For what it's worth, outside of a few errors in the documentation, it's fairly well written; I was working on a Flash->iPhone App compiler before Adobe announced theirs, and it was fairly straightforward to implement most things.


I saw a tiger head for about a second. I said, "oh cool". Then Chrome said: "Aw, snap!"


Does this actually implement the equivalent of Adobe's Flash runtime in Javascript? Does it work for all SWFs? If so, is there some sort of magic involved? If this works, how come things like Gnash and swfdec have never been able to achieve full compatability with Flash, yet this has seemingly come out of nowhere and done just that?


"Dispatch war rocket AJAX to bring back his body!"


I had already used the name for my lisp flash library :( http://wiki.freaks-unidos.net/gordon (not that it is a very original name or anything ;))


Dude!

Where on bloody earth have you been? Could you please MIT the source code for Gordon so we can work on it?

People refused to touch it because of the license.


What's wrong about LGPL?


Too bad the name is already used for a flash decompiler http://www.futurecandy.net/


Cool technology to pursue but considering how Flash content's CPU requirements are often a problem on C-based interpreters, this doesn't seem like a practical thing.


When you see a pig dance it is impolite to comment on the quality of the dance, but you can express amazement at that it dances at all ;)

Let's give them a bit and see how far they take it. With a bit of luck they get some help from a nifty jit for js and who knows what might happen.

The evil .swf might turn in to a standard component after all, if only via a somewhat roundabout way.

I really wonder how they're going to do audio though, and capture devices and such are probably out (I can see a route to do video via the canvas, it's going to be bloody slow though unless js gets sped up a lot compared to where it is today).


If the new HTML5 <device> element gets implemented they could use that for capture devices: http://www.whatwg.org/specs/web-apps/current-work/multipage/...


Yes, I can't wait. I've been waiting for that literally for years.

Many years long we used a crappy old little javascript that I wrote long ago, it basically loads jpegs under water in to an off screen buffer and then flips them over the previous one when they're.

Using some trickery I could get pretty good framerates if the connection is good but the bandwidth cost is just terrible.

Now we've switched to (yuck) flash and it works ok I guess but something more standardized would be much appreciated.


It's translating to SVG, so there's "just" the script translation overhead, not rendering overhead. I think it's quite practical if maybe not especially useful given Flash penetration.

I wrote a Flash player for the PS2 ~9 years ago now that was fast enough. I'd say that current PCs + jitted JS are faster than that platform.


> there's "just" the script translation overhead, not rendering overhead

Ah that makes a lot more sense, thanks for pointing that out.


This leaks memory like a sieve on Chromium, unfortunately. Be very interested to see where this goes eventually though.


SWF files on the iPhone.


But not useful SWF files on the iPhone. This doesn't magically give you anything you didn't already have in javascript.


It gives you the Flash (animation) authoring environment without plugin requirement for playback.


Yes, but that big Flash site you just finished with no budget for an iPhone version just got a lot cheaper to re-target.


not really, if you're writing flash apps, there's a huge chance that you're actually writing as3 code, which gets compiled into DoABC tags (actionscript bytecode) and I don't think DoABC tags will ever be supported unless they implement a stack-based virtual machine in javascript.

It gives the appearance that it got cheaper to re-target, but really it will be a ton more work when you realize what will never be supported. Even if they managed to implement a virtual machine in javascript, they'd still need to implement all the library code that normally doesn't ship with every swf file.


Unless you aren't starting from scratch, as you said ("legacy Flash code") in your other comment.


Great! now people will go back to blocking JS to avoid ads like the old days.

All that easy ride of blocking just the flash player left the web all screwed up with that JS for content running loose.

Good ridance, ajax.




Applications are open for YC Summer 2019

Guidelines | FAQ | Support | API | Security | Lists | Bookmarklet | Legal | Apply to YC | Contact

Search: