NHacker Next
  • new
  • past
  • show
  • ask
  • show
  • jobs
  • submit
Ruffle – A Flash Player emulator written in Rust (ruffle.rs)
sterlind 1240 days ago [-]
I spent today hacking on it! Trying to get all the Homestuck movies to work. The codebase seems pretty accessible so far. Fixed one bug where it couldn't render shapes with >65535 vertices. It's really rewarding watching movies light up as you fix things.
kibwen 1239 days ago [-]
Back when Shumway was under development I remember using the first big Homestuck walkaround flash (https://www.homestuck.com/story/1358?fl=1) to put it through its paces and found it to be unbearably slow to the point of unplayability. If Ruffle is capable of running those at any reasonable speed then that would demonstrate real progress over what Shumway achieved.
sterlind 1239 days ago [-]
Looking at the code, Shumway seems amazingly complete vs. Ruffle. Ruffle has only a tiny skeleton of AS3 support (only the VM opcodes and some of the MovieClip class), while Shumway seems to implement a huge chunk of the library classes.

Maybe using wasm Rust with WebGPU acceleration will make it faster than Shumway. Remarkable to me how much effort must have been put into Shumway, though..

kmeisthax 1239 days ago [-]
DisplayObjectContainer support just landed a few days ago, but yes, our AS3 support is basically nothing right now. Most of our effort has gone into finding and implementing the bottomless pit of strangeness that is AVM1 and it's execution model. Adding AS3 support also means making sure we can leverage the same object hierarchy without breaking any of those fixes. For example, after figuring out how DisplayObjectContainer IDs and timeline depths interact, Toad06 and I went through several rounds of regression testing with AVM1 content because of how foundational the changes were.

Shumway used to be a Mozilla project with corporate backing; that would explain why their implementation was so complete. (Ruffle is all people working spare-time currently) The performance ceiling with Rust is way higher than JavaScript, but we're nowhere near that yet, much yet at the point where we'd have to start writing JIT compilers for AS2 or AS3. We are using GPUs to render polygonalized shapes where available, though that has some accuracy issues with stroke scaling. Ideally, we'd like to have some kind of low-level Flash-like vector drawing implementation, but that would be a significant performance loss unless we could either parallelize it or somehow convince a GPU to do it.

Furthermore, a lot of that is going to have to come after all the compatibility and implementation work we still need to do. Off the top of my head...

1. Core AS3 display object support - I'm working on this with somewhat-slow progress

2. Core AS3 data types (String, Number, int, uint, Vector.<$>, Point, Transform, JSON, etc) - I'll do this as-needed for other AS3 work or specific games that depend on these methods

3. Video decoding - I have an h263 decoder written but still need to tie it into the stage, and it'll probably be super-inefficient on web unless I port decoding over to GPU shaders

4. Remaining AS2 classes - Someone PR'd BitmapData support but it's incomplete. There's also some security-related and custom socket classes which expose the movie's origin, which is validated by some domain locks.

5. XML - I have a custom DOM and AS2 integration for it, but we need to write our own custom parser and also tie it into both legacy XML and E4X XML on AS3

raphlinus 1239 days ago [-]
> or somehow convince a GPU to do it.

I'm about 90% sure this is possible using techniques broadly similar to piet-gpu. The problem is a lot less constrained if you have access to compute shaders (ie WebGPU), otherwise it looks a lot like RAVG (Nehab and Hoppe) and you have kinda nasty branching and memory access patterns in the fragment shader, plus still having to do coarse rasterization on CPU.

One of the operational challenges here is that the renderer would likely be a one-off, as the requirements are just so different than most other clients of a 2D rendering engine.

There's been a bit of discussion on #gpu on xi.zulipchat.com. I consider this an interesting problem but can't really justify spending time on Flash-specific features myself.

cpeterso 1239 days ago [-]
Shumway didn’t need to implement a full ActionScript virtual machine because it converted ActionScript bytecode to JavaScript and eval’ing it at runtime, leveraging both the JavaScript engine’s runtime and JIT.
MaxBarraclough 1238 days ago [-]
If it was able to map arbitrary ActionScript to JavaScript, doesn't that count as implementing a full ActionScript VM?
cpeterso 1238 days ago [-]
I think ActionScript has a lot of APIs not available in JavaScript that stop needed to be hand implemented. That said, Shumway was able to auto-generate API stubs at compile time from “player debugger” symbol files that Adobe distributes for ActionScript debuggers. :)
haunter 1239 days ago [-]
I really really wish Flash MX 2004 were made free to download by Adobe. That was one of the greatest piece of software they (well Macromedia) ever released. The format is dead, basically abandonware, they should make it available.

Adobe already released the universal activation keys cause they shutdown the servers but it's still not legal to use if you haven't bought an original copy https://helpx.adobe.com/x-productkb/policy-pricing/macromedi...

grishka 1239 days ago [-]
> but it's still not legal to use if you haven't bought an original copy

But they no longer sell it anyway? And they don't say any of that on that page. If they really wanted to make sure only those who bought it previously got those keys, they'd require logging in with an account you bought it with to see that page.

haunter 1239 days ago [-]
I'm not sure how does that work legally. For example you can still download the installer directly from them [0] and it's an universal one. If you don't have a key it works in trial mode, if you do have one you can unlock the full version.

http://download.macromedia.com/pub/flash/esd/flashmx2004_tri...

grishka 1239 days ago [-]
You can download the installer from an Adobe server, and Adobe also provides the key to activate it, with no payment or authentication required. Nowhere does it say you need to have paid for it back when they sold it. In my opinion, this means they're officially giving it away for free. FWIW you could also consider it abandonware because, again, it's not sold any more so you can't pay for it even if you wanted to.
daveFNbuck 1239 days ago [-]
What law would be violated if you download software from Adobe and use the activation key they've provided to activate it? That's normally how you get software legally.
artursapek 1239 days ago [-]
Are you really that worried that Adobe will come after you for illegally using 2004 era software that they've abandoned?
kbenson 1239 days ago [-]
Out of the companies I would be worri d would come after me for software, or even accidentally come after me for something like this busy just follow through because they have whole procedures and teams for this, Abode would be one of those companies. If nothing else, it would be used to justify the search if they went after you and used to claim you did something wrong and cover someone's ass at the company.

Adobe is the developer of one of the most pirated pieces of software on the planet. I wouldn't put it past them to be a little trigger happy. For personal use, I imagine you're pretty safe, but if it's a business, even a single person consultancy, who knows?

tombert 1239 days ago [-]
I think they wouldn’t do that since they might feel it’s competitive with their current Adobe Animate product.
raphlinus 1239 days ago [-]
I could research this myself, but will ask lazy HN instead. One of the big challenges in presenting Flash well is "conflation artifacts," which are the seams that appear when compositing antialiased vector shapes. The old software renderer in Flash had very clever techniques for avoiding these, but browser 2D renderers generally don't. (The actual story is a bit more complex, as Skia is careful to avoid conflation artifacts within a shape, but the compositing rules in the HTML5 spec almost seem to require them for compositing multiple shapes). Thus, Shumway and the other Flash emulators had artifacts which detracted from the visual quality.

A particularly good paper explaining the problem (and how the NV_path_rendering extension solves it) is "GPU-accelerated Path Rendering", Kilgard and Bolz, 2012.

Does Ruffle solve these? If so, how?

muizelaar 1239 days ago [-]
It doesn't solve them. See https://github.com/ruffle-rs/ruffle/issues/26

Here's a flash style solution to the problem: https://github.com/jrmuizel/full-scene-rasterizer

raphlinus 1239 days ago [-]
Thanks, good to know. I am interested in a fully GPU-accelerated solution, but it is not easy, and I make no promises if or when I will get there. I would be interested in discussing my ideas.
raphlinus 1239 days ago [-]
And a self-followup: I wrote https://github.com/linebender/piet-gpu/issues/49 to track this in piet-gpu.
apignotti 1239 days ago [-]
A FOSS Flash Player implementation has certainly value, and I hope to have contributed to the cause by starting the Lightspark project years ago. The sad reality is that the Flash runtime is massive and under-documented. The best approach for Flash preservation in the medium term is using _actual emulation_ to run the binary player itself.

Further reading:

https://medium.com/leaningtech/preserving-flash-content-with...

https://medium.com/leaningtech/running-flash-in-webassembly-...

https://medium.com/leaningtech/announcing-cheerpx-for-flash-...

https://medium.com/leaningtech/cheerpx-for-flash-now-general...

For questions: https://twitter.com/alexpignotti

q3k 1239 days ago [-]
So, to archive/preserve content that was lost because it relied on a proprietary closed-source technology we should be relying on _your_ proprietary closed-source technology?

Please. I understand you're trying to make a living here, but being able to use F/LOSS software is absolutely critical for the preservation movement.

“Not-for-profit, charitable and educational organisations can benefit from discounted rates.”. Yeah, no, thank you.

foldr 1239 days ago [-]
Hopefully charitable and educational organisations aren't just waiting for someone else to do the work for them for free. If they don't like this approach they can pay people to work on improving open source flash implementations.
grishka 1239 days ago [-]
I see you over and over again in Flash Player threads. Your approach isn't good because it requires someone else's, namely Adobe's, cooperation, and even then, you still end up with a black box inside another black box. Doesn't feel sustainable.
StavrosK 1239 days ago [-]
Why does it require Adobe's cooperation?
q3k 1239 days ago [-]
> To use CheerpX for Flash, a licence is required for both CheerpX itself, and for distributing the Adobe Flash Player. This is a requirement for both self-hosted and cloud-hosted installations. In many cases, we will be able to offer both licences under the same commercial agreement. In some cases, a separate licence will need to be procured from Harman. Leaning Technologies can make the right introductions and facilitate the conversation with Harman.

https://medium.com/leaningtech/cheerpx-for-flash-now-general...

grishka 1239 days ago [-]
It's even worse than I remember. So, a very b2b very proprietary product. I mean, their website even has pictures of random smiling people and a bunch of logos of random companies. Most everything leads to "contact us". Technical details are sparse. Can't get more b2b than this.

Can't see how this can even begin to approach content preservation we're talking about here.

untog 1239 days ago [-]
Seems especially silly as there’s a real business use case here, for people who made apps using Flex. Not sure how many companies actually still depend on that but it was definitely a thing for a while there. Surely much better to focus on that.
grishka 1239 days ago [-]
They could as well make use of that underlying x86 emulation technology to run ActiveX components and sell it to those companies that still rely on them in their internal systems — I'm sure there still are such companies.
1239 days ago [-]
1239 days ago [-]
grishka 1239 days ago [-]
Because he said so previously. There's some licensing stuff he's apparently very worried about.
whatever_dude 1239 days ago [-]
Wrapping a piece of proprietary technology with other piece of proprietary technology is not the way to go with this. I get that you keep saying it's easier than creating a new player from scratch, but it doesn't mean it's better.
SXX 1239 days ago [-]
I just curious couldn't someone just write down missing part of documentstion looking at something like Scaleform source code? So someone else can make clean room implementation using the doc.

Scaleform impplementation of Flash player always looked really decent to me.

atesti 1239 days ago [-]
You can find some flash player source in Doom3 BFG edition source code! Apparently some people at ID wrote their internal flash player just for the menus!

I don't know how good it is

q3k 1239 days ago [-]
For anyone who's curious to peep at the code: https://github.com/id-Software/DOOM-3-BFG/tree/master/neo/sw...

But it mostly seems like a simple, reverse-engineered, purpose-built player for their own use, so probably nothing that the open source community will have much use from.

SXX 1238 days ago [-]
Scaleform was just far more feature-complete and can run apps of almost any complexity. Still not 100% feature complete since you don't need many thing for game UI.
lxe 1240 days ago [-]
Those sample files.. bring back memories. I think we took a step backwards in serving vector art/animation on the web. When YouTube replaced Flash, we've probably wasted petabytes of bandwidth serving rasterized content when Flash or a similar format would have been much more effective.
mofosyne 1240 days ago [-]
A standard at least for encoding vector animation would be nice. Also needs to be not as bulky as having svg frame per frame, etc...
jazzyjackson 1239 days ago [-]
I have a similar problem in mind, it could be an SVG served in a web browser, and then instead of frames you would have an event series of updates, kind of like MIDI does for music: turns certain notes on and off at certain times. So I could have a timestamped list of updates to apply to the SVG (move to x / y coordinate, apply this filter, append these childNodes) -- just use CSS transition to interpolate the movement from one coordinate to the next. You could stream these updates from the server at very low bandwidth.
matt_kantor 1239 days ago [-]
I've never authored SVGs so this might be a dumb question, but couldn't you use CSS keyframe animations for this? You wouldn't get streaming, but what about the rest?
ghayes 1239 days ago [-]
Not sure if this went far enough (even before it was deprecated), but SMIL was a standard for vector animation: https://developer.mozilla.org/en-US/docs/Web/SVG/SVG_animati...
chrismorgan 1239 days ago [-]
Though as noted there, Chrome recanted on its 2015 attempt at killing SMIL—and it was only ever Chrome that were labelling SMIL as deprecated, no one else does so. Four years after that, I haven’t heard any more talk about killing it. Notwithstanding that, CSS is now able to cover a lot more of the SMIL use cases than it was then.
fulafel 1239 days ago [-]
SVG is much better at vector art use cases. Flash was horrible from user pov (constant os and browser compatibility problems, unending stream of weekly "ads can pwn your computer" level security holes, proprietary black box nature, ate your battery, hard to procedurally generate, didn't integrate with the web and dom, etc etc).
pbronez 1239 days ago [-]
All true, but there’s such a massive library of content for Flash that they must have done _something_ right. Maybe it was just luck, maybe timing, but it’s amazing to me that so many games and videos are caught in this particular technical dead end. My understanding is that HTML5 just never offered the same primitives for content creation, but I’m unsure why there was no economic incentive to create them.
kmeisthax 1239 days ago [-]
Adobe Flash/Animate provided a best-in-class animation and vector art package that still has little competition. Animate can actually export to HTML5, but they didn't bother using the SVG/SMIL animation model. Instead, they pre-render everything as a series of spritesheets and render them to a canvas.

I can see why they did this - the SVG and canvas vector rendering models are different enough to make blindly rendering SWF content to it cause rendering artifacts. (It's one of our biggest longstanding bugs in Ruffle - canvas masks just look weird.) However, Adobe could have ameliorated this either in the exporter, the authoring environment, or by pushing for Flash-style mask options in web standards that deal with vector rendering. Instead, they went with the far worse but quicker option of prerendering so they could say "hey we totally do HTML5 now".

rictic 1239 days ago [-]
The flash editor was high quality, and catered to animators.
untog 1239 days ago [-]
I’m not sure that’s true when factoring in performance. Every time I’ve tried to animate SVG it’s been an absolute CPU hog in a way Flash never was.

Not saying we should stick with Flash but I don’t think SVGs are a complete answer today either.

Wowfunhappy 1239 days ago [-]
Adobe Animate, which is basically just Adobe Flash with a different name, can export htm5 for the web. I haven’t used it extensively, but it seems to work well.
tony 1240 days ago [-]
What's Newgrounds affiliation with Ruffle? Did they create it?

To test it out: https://www.newgrounds.com/portal/view/113883

No flash player required. Works in HTML 5.

Loaded slow though.

There's a cool song in it: Splashdown - So Ha

Is Albino Blacksheep in on the ruffle.rs stuff? Remember them? They were always pioneering CSS stuff back in the 2000's.

ehsankia 1240 days ago [-]
I did noticed the slow load times, but honestly a small cost to pay. I wouldn't be surprised if most of it is related to loading and warming up webassembly.
dlbucci 1240 days ago [-]
I think Mike from Newgrounds is the lead developer on the project, or at least the guy who created it.
thisAintReal 1239 days ago [-]
Check ruffle githubpage for orginal creator. Mike is sponsoring this development, but not developing the project.
kmeisthax 1239 days ago [-]
Mike started the project - I know this because I'm one of the developers (others include CUB3D and Dinnerbone) and his commits go back to 2016.
shubhamjain 1239 days ago [-]
I have unfinished project to revive the Flash Games I played as a kid using Ruffle JS. Make them accessible through a simple website. Games like Eggs[1] used to be my favorite pastimes. Of course, we have moved on to better entertainment, but there's still value in these short games, something you can just play for five minutes to take a break from work.

I would love to play these games, not just for the nostalgia but being quick, small, and not too addictive. Hopefully, I am not alone.

I think, HTML5 would have done the same job, but the number of HTML5 games is surprisingly low in comparison and wesbites are generally ad-infested.

[1]: http://www.vagenisonline.com/flash/eggs.html

mwill 1240 days ago [-]
Its funny to me to see Newgrounds and New York Times listed as diamond sponsors to the same project but makes sense.
qzw 1240 days ago [-]
Man, I would love it if this could be integrated into Steam or GoG along with a curated collection of great flash games.
swinglock 1240 days ago [-]
At what point does a flash player emulator just become a flash player?
srgpqt 1239 days ago [-]
When they can be used as drop-in replacement to play actual flash content on websites.

Which may be possible to do as a browser extension..

ruffle does have a web version but it requires the website owner to explicitly include it.

throwaway189262 1239 days ago [-]
With Rust, you could re-implement 99% of flash player in WASM with some JS shims
1239 days ago [-]
bitwize 1240 days ago [-]
There was a little Strong Bad skit about Ruffle posted to @StrongBadActual twitter... gives me hope that Homestar Runner's content will be preserved as is.
waxpancake 1239 days ago [-]
The Brothers Chaps will probably end up switching from Flash to Ruffle on their own site eventually, but until then, the Internet Archive has almost all the Strong Bad Emails archived here playable with Ruffle. https://archive.org/details/softwarelibrary_flash_strongbad
LASR 1240 days ago [-]
Flash player emulator written in Rust...compiled to WebAssembly and running in the browser?

I like how things like this come out so frequently these days like it’s no big deal.

ivanceras 1240 days ago [-]
Ruffle is also used in archived.org to play old swf files.
gitgud 1239 days ago [-]
Anyone know of any animation editing software similar to the original Flash MX?
Wowfunhappy 1239 days ago [-]
Is Adobe Animate insufficient?
gitgud 1239 days ago [-]
Yeah that looks cool, hadn't heard of that one.

I just found an open-source alternative too: https://www.synfig.org/

Wowfunhappy 1238 days ago [-]
I mentioned Adobe Animate because it’s actually a rebranded Adobe Flash.
michaelchisari 1240 days ago [-]
Tried Super Mario Crossover and unfortunately it freezes at the first screen, but it gives me hope that some day I can play it again on a modern browser.
Wowfunhappy 1239 days ago [-]
If you just want to play the game, consider using Flash Projector, a standalone Adobe program (separate from the browser) which will open and play swf files.
mnahkies 1239 days ago [-]
This is great for preserving all the old content. It'd be cool to see a follow up project for an ide to author new stuff - as a kid the timeline system made producing 2d games accessible in a way that I haven't seen with JavaScript engines on the modern web. Being able to just draw and animate then slap some scripts on it was a really interactive way to learn
IceWreck 1239 days ago [-]
https://www.coolmathgames.com is also using this, nice !
irrational 1240 days ago [-]
Should have called it Rash.
shmerl 1240 days ago [-]
Rush would be nicer.
sitkack 1240 days ago [-]
Flush
mirekrusin 1239 days ago [-]
Or flash. Flash player. Drop "simulator".
captkos 1238 days ago [-]
or Trash Player. Drop "simulator".
saagarjha 1240 days ago [-]
Or Flust…
zem 1239 days ago [-]
rofl
appstorelottery 1239 days ago [-]
Wow. Might be enterprise opportunities for all those Flex based apps buried the the hell of past broken promises from Adobe :-) I developed an ERP with a flex client back when Adobe and Apple went to war... I’ve been warning the client for years that flash will sunset...
zo1 1239 days ago [-]
You're not the only one, there are some really big companies out there that rely on Flash and Flex.

https://mybroadband.co.za/news/internet/221408-sars-efiling-...

smerik 1239 days ago [-]
I see Ruffle a lot, but I hardly see a mention of AwayFL on here: https://news.ycombinator.com/item?id=25243958
mdaniel 1239 days ago [-]
I don't follow what that self post is promoting; only by searching for that term did the GitHub org show up -- a very odd thing to omit from a HN post: https://github.com/awayfl
_Microft 1239 days ago [-]
If you need a Flash file to try this with, here you go. At least on Windows, you can paste the URL directly into the file name field of the "Open local file" on the demo page.

https://github.com/claus/as3swf/blob/master/examples/dumps/A...

mdaniel 1239 days ago [-]
If you haven't seen it, GH has a non-querystring URL that will likely work in places that are not tolerant of either querystrings or special characters in "filenames":

https://github.com/claus/as3swf/raw/master/examples/dumps/AY...

_Microft 1238 days ago [-]
Good idea, thanks!
1239 days ago [-]
k__ 1239 days ago [-]
Half-OT: Does anyone have an idea how the WASM interface types proposal is coming along in terms of actual implementation?
joshlk 1239 days ago [-]
How is this achieved? Is the flash API/architecture open knowledge?
grishka 1239 days ago [-]
As with any sufficiently popular proprietary file format, gonna bet it was reverse engineered a dozen times by different people independently. But maybe there are official specs, I'm not sure.

edit: there is an official spec and it's 243 pages https://www.adobe.com/devnet/swf.html

anthk 1239 days ago [-]
THis is not an emulator, this is another Flash interpreter.
ruffle 1240 days ago [-]
Neat
Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact
Rendered at 20:32:04 GMT+0000 (Coordinated Universal Time) with Vercel.