News for hackers. Stuff that matters.
Re:WebAssembly Browser Preview by jim-greer on Monday October 31, 2016 @02:57PM (#12839830)
I really wish Adobe would write a Flash runtime in WebAssembly. There are tens of thousands of great Flash games that are unplayable in modern browsers... Sure, you could rewrite them in js, but no one is going to.
Re:WebAssembly Browser Preview by IvanK_net on Monday October 31, 2016 @03:32PM (#12840122)
Three years ago, I had an idea to write my own Flash Player in Javascript, but I was too lazy to start working on it.

Today, we have PDF.js, emulators of gaming consoles, or even emulators of a whole x86 computer, which can run Windows OS. I believe that "SWF interpreter" in Javascript can run pretty fast. The specification is free available online.

The only problem I see is, that in Flash, you can create TCP / UDP sockets, which is not possible in a web environment.

Re:WebAssembly Browser Preview by catshirt on Monday October 31, 2016 @04:52PM (#12840818)
Re:WebAssembly Browser Preview by Sophistifunk on Monday October 31, 2016 @07:47PM (#12842024)
JavaScript also lacks (and apparently will always lack) a weak reference type, which Flash supports at the very core, for example weak event handlers.
Re:WebAssembly Browser Preview by spyder on Tuesday November 01, 2016 @11:04AM (#12846220)
Re:WebAssembly Browser Preview by bzbarsky on Tuesday November 01, 2016 @12:59PM (#12847759)
WeakMap holds a weak reference to the _key_, not the _value_. That's not enough to do weak event handlers, for example...
Re:WebAssembly Browser Preview by Sophistifunk on Wednesday November 02, 2016 @04:52PM (#12859164)
It can't be used because they refuse to allow iteration.
Re:WebAssembly Browser Preview by merb on Monday October 31, 2016 @04:37PM (#12840722)
> The only problem I see is, that in Flash, you can create TCP / UDP sockets, which is not possible in a web environment.

You can send it to a backend via WebSocket, tough TCP/UDP proxy.

Re:WebAssembly Browser Preview by Ph0X on Monday October 31, 2016 @08:54PM (#12842489)
who's running these proxies? The idea is to have a replacable flash player that works out of the box with all the flash content on the web.
Re:WebAssembly Browser Preview by imtringued on Tuesday November 01, 2016 @09:27AM (#12845488)
You can do it yourself.
Re:WebAssembly Browser Preview by jim-greer on Monday October 31, 2016 @05:53PM (#12841290)
There are some other things you can't do from the browser in addition to sockets. Full screen, camera, and microphone. But most games don't use that stuff.
Re:WebAssembly Browser Preview by od14 on Monday October 31, 2016 @06:23PM (#12841510)
This is not true, all of the things you mentioned are possible in modern browsers and are being standardized. However some of them require permission from the user.

(1) Full screen: https://developer.mozilla.org/en-US/docs/Web/API/Fullscreen_...

(2) Camera + Microphone: https://developer.mozilla.org/en-US/docs/Web/API/MediaDevice...

Re:WebAssembly Browser Preview by tuxracer on Monday October 31, 2016 @10:40PM (#12842948)
Those things are all possible in the latest versions of every major browser. Web standards have come a long way!
Re:WebAssembly Browser Preview by altstar on Tuesday November 01, 2016 @12:12AM (#12843374)
You can try flexjs.
Re:WebAssembly Browser Preview by white-flame on Monday October 31, 2016 @06:25PM (#12841522)
As long as it does the antialiasing correctly, then yeah! But I've seen .swf->.js stuff which has the telltale garish seams between adjacent vector objects, showing it's just deferring to the broken AA use of the immediate-mode canvas renderer.

Does anybody know how much of the Flash plugin AA runs on CPU vs GPU? Obviously the older versions were CPU-only, though I'm not sure how much of actual Flash object rendering has moved to the GPU in recent years, especially as a ton of it is bezier based. If it is still fully CPU-based, with GPU just doing blits & blends, then wasm should allow fast enough use of a proper .swf AA renderer without going through canvas's forgetful AA.

Re:WebAssembly Browser Preview by joeyjojo on Monday October 31, 2016 @07:24PM (#12841885)
Most of new games built with Flash are using Stage3D which runs on the GPU. These games however don't really rely much on the vector capabilities and animation timeline, which still uses the CPU. Adobe could probably make a vector renderer run on the GPU though. Some people have made vector animation renderers as a proof of concept.

https://www.youtube.com/watch?v=NmgRiMhP4q4

Re:WebAssembly Browser Preview by white-flame on Wednesday November 02, 2016 @04:26PM (#12858906)
Right, the polished Stage3D stuff would just go through to WebGL. It's the vector stuff I'm concerned about. There's a lot of great, fun little Newgrounds-style animations & games made with that level of graphics.
Re:WebAssembly Browser Preview by qwertyuiop924 on Monday October 31, 2016 @03:25PM (#12840065)
Why would it have to be Adobe? Plenty of people could do that kind of work.
Re:WebAssembly Browser Preview by jim-greer on Monday October 31, 2016 @03:45PM (#12840227)
That's true. Would be nice if Adobe at least threw some resources at it though.

It's a huge undertaking. There are just a ton of library calls to support. Here's the list of AS3.0 classes: http://help.adobe.com/en_US/FlashPlatform/reference/actionsc...

And a whole lot of games are still in AS2 - game developers never really embraced AS3.

It really isn't going to happen, I'm afraid.

EDIT - Maybe it's possible to compile the C++ sources for the Flash Player to WebAssembly? Then you wouldn't have to re-implement the libraries.

I don't know the state of these compilers, but there was a Mozilla post about it a while back: https://hacks.mozilla.org/2015/12/compiling-to-webassembly-i....

Adobe hasn't open sourced the Flash Player, so it would have to be them.

Re:WebAssembly Browser Preview by IvanK_net on Monday October 31, 2016 @09:19PM (#12842594)
These classes / libraries are not built inside a Flash Player. They are part of the SWF file after compilation.

SWF specification is here http://wwwimages.adobe.com/content/dam/Adobe/en/devnet/swf/p... It is definitely shorter and simpler, than e.g. PDF file format.

Re:WebAssembly Browser Preview by 0xcde4c3db on Tuesday November 01, 2016 @12:12AM (#12843376)
There's still a pretty big gap between parsing and actually rendering. I don't think that spec contains anywhere near enough information to play animations the same way that Flash Player does.
Re:WebAssembly Browser Preview by joeyjojo on Monday October 31, 2016 @07:33PM (#12841937)
Adobe should do it because lots of people still use Adobe Air and Animate CC (previously called Flash Professional) to build games. If they could make the vector animation capabilities fast with WebAssembly it would bring back a set of extremely fast and flexible workflows for building games. There presently seem to be a lack of viable workflows for building games with vector animations, which is where Flash's strengths have always been.
Re:WebAssembly Browser Preview by qwertyuiop924 on Tuesday November 01, 2016 @07:00AM (#12844644)
But Adobe's too busy trying to shoehorn flash into places it doesn't fit.
Re:WebAssembly Browser Preview by moron4hire on Monday October 31, 2016 @03:14PM (#12839978)
What happened to Mozilla Shumway? Looks like there haven't been any commits in over half a year.
Re:WebAssembly Browser Preview by steveklabnik on Monday October 31, 2016 @03:22PM (#12840041)
Re:WebAssembly Browser Preview by IvanK_net on Tuesday November 01, 2016 @10:49AM (#12846070)
I have made several Flash games in the past, and I really wanted them to run in a web environment (i.e. without a dependancy on any plugin).

That is why I made IvanK.js http://lib.ivank.net . It is a library for doing graphics (including rewritable text fields), mouse and keyboard events in a "Flash way". I was able to rewrite my flash games to JS in a couple of hours, it was just a "mechanic" rewriting of ActionScript 3 to Javascript. If you want to port your flash projects to the web, it may be extremely useful to you :)