Hacker News new | ask | show | jobs
by amitt 3256 days ago
End of an era.

We built the FarmVille-engine using AS3 and I still think it's one of the best programming languages I've ever used. Static typing, access modifiers, and performant. Low friction for new users (most people had the plugin, we could stream the main binary and assets)

0% chance we could have built the game using any other client-side tech stack available at the time.

13 comments

Well, I used AS3 and Flex while it occupied a useful niche and at the time it was SO much better than the web platform.

BUT, AS3 was not a great language. The VM was pretty slow (that GC! I'm sure you game devs optimized the hell out of it with object pools and all, but still, modern JS VMs could run circles around Flash's), the static typing was extremely limited: you could only type "Function", not the actual arg and return value types; type inference was non existant, Vector was invariant, etc. Let's face it, Adobe wasn't the best at language design. Typescript is today so much better than AS3 ever was.

God Typescript is glorious after dealing with JS for so long.

Just needed to say that.

When Typescript came, I was like. Yay! Someone made JS become AS3 like. That's when I seriously got into javascript. Flash could do some amazing things back in the day, They had GPU accelerated graphics, microphone, image manipulation, video, and a whole host of other things that HTML didn't have. I think Flash inspired browsers to do better.

Now it can die happily.

You should look at C# in .NET core as well. C# was designed by the same guy as Typescript and Delphi, the famous language designer Anders Hejlsberg.

His languages are the most logical and elegant I have used, all truly pleasant to work with. Building a decent language that compiles down so cleanly to Javascript is a minor miracle.

exactly, loving the typing of AS3, typescript is what made me switch over to reimplementing everything in javascript.
I tried TypeScript yesterday and while I really love the language, the tooling was wayyyy too complicated and confusing. All I wanted was to make a dead simple hello-world node app that let me write it in VS Code, and recompile the TS to JS every time I saved. Suddenly I had to learn about tsconfig.json, had to install nodemon and have a process running in the background that I'm sure to forget to kill later, and I have no idea how either tsc or ts-node plays into any of this... in the end I just decided to go with ES2016 and be done with it. Too bad, because I really like having type information available, especially for catching bugs. I enabled VS's "pretend JS is TS" setting so it catches some errors, but it's pretty hacky and not thorough, and I don't get to specify types in my program. Really wish I could get a dead simple TS app figured out.
1) tsc --init # creates a tsconfig.json, no need to edit it

2) tsc --watch # rebuilds every .ts file on save

There is no step 3.

Hey this is pretty great, thanks! Dunno why I didn't consider it to be that simple. But it really is working. Well, along with `npm install @types/node --save` which I found somewhere else, so it quits complaining about 'require' not being found.
Glad it worked! I think it's a failure by the TypeScript team to not make this flow more front and center.

You are right, I forgot about installing typings. Instead of require you should use ES6 "import" (which TS compiles to require anyway) to get more type checking. But when you do that you'll see more of my missed step, which is `npm install @types/XYZ` for each XYZ package you use.

As soon as you start introducing a separate build tool (like gulp or whatever) things get super messy super fast but not for any interesting reason. Using `tsc --watch` also means it does caching across builds so it's faster than using gulp unless you're careful to configure it.

> 1) tsc --init # creates a tsconfig.json, no need to edit it

hm... i reckon that if one doesn't need to edit a 'default' config file, perhaps the file doesn't really need to exist.

Will this be fixed when a "canonical" docker container comes out for it? Or perhaps two containers - 1 for dev & dev dependencies and 1 for "prod"?
You could always just opt for a typed language.
Which typed language do you prefer to run in browsers?
The comment I was replying to was referring to Node, so based on the context I wasn't discussing the browser.
On that note, I wonder if we'll ever see type="text/typescript" in the browser due to how much traction it's gaining so quickly, and considering it's basically always ESNext but with types.
i have the same feeling about clojurescript. sanity in your browser, at last.
> the static typing was extremely limited: you could only type "Function", not the actual arg and return value types

You can type args and returns. One of the biggest things I relied on when I coded AS3

I meant for higher order functions, callbacks, etc.

e.g, see the signature of Array.map:

map(callback:Function, thisObject:* = null):Array

To say nothing of their ridiculous security sandbox design... I remember trying to make banner ads with dynamic price data and between all the various detached hosting abstractions and ActionScript's security requirements (in a time before this kind of setup was common) it was a hell of a project.
I'm glad that someone else said that. I really hated AS3 as a language and was really happy that the ECMAScript spec didn't take their ideas. Typescript does everything that AS3 could do, but does it in a way that is much more friendly to the JavaScript way.
I just have to throw in my 2 cents here. Actionscript outclasses any other language I've used for building custom UI components or just plain experimentation (I'm looking at you in particular, C#). My favorite experience with the language - building a dynamic GIS mapping engine using item renderers. It pains me to no end to watch this designer-friendly* language fade away into oblivion. Thanks Adobe. *at least for me
Loved AS3. We managed to make lots of great work with it that didn't hog the CPU and performed beautifully. But the Flash runtime was the big problem. I'd love to have AS3 now as a language of useful programming. Still, big ups to everyone who worked on Flash, past and present. Thanks, y'all.
> "I'd love to have AS3 now as a language of useful programming."

Haxe is probably something you'll be interested in:

https://haxe.org/

You're welcome! (though I only worked on a small part of it - vector/SIMD instruction support, for gaming usecases)

I think a lot of the stuff that screwed the language was that it was initially supposed to be "an evolution of javascript" (ecmascript 4? I forget), so it took a on lot of the undesirable features of JavaScript, it was never a complete break from it.

Also, Adobe made a big-ish mistake in that it didn't keep the runtime separated from the VM - a lot of the VM abstractions (like pointer tagging) leaked into the runtime, and this is why a lot of things were harder to optimize in the VM than they should've been. Fortunately, the browser vendors didn't have this problem, that's why their GC could "run circles around Flash".

Hey, hello! I know there were features that AS3 couldn't access, but other languages like Haxe could. Would you be able to elaborate more on the VM/runtime issues?
Well, see e.g. https://blog.semantiscope.com/2009/10/29/getting-pointers-fr... ; the Flash runtime relied in various places on how pointers are represented for various "smart tricks"/optimizations. While this may have had the local effect of being faster, it also had the side effect of making global optimizations in the VM harder, since the VM was limited in the ways it could change. With the flash runtime codebase being pretty large, and the team being fairly paranoid about backwards compatibility ("you don't want to be the one who breaks the internet!"), this slowed down change quite a bit. Sure, it was easy to add new features - but it was pretty hard to improve how the old ones were working.
> "I'd love to have AS3 now as a language of useful programming."

You still have Adobe AIR to target desktop and mobile GUI apps.

And you have a also the open source project Redtamarin

https://github.com/Corsaair/redtamarin

for shell scripts, command-line tools, server-side, etc. in 32bit/64bit for Windows, macOS and Linux

Hot damn, an actual Farmville developer. My big plan fresh out of college was to make a Farmville-esque game with some action elements. Got WAY further along than I rightly should have, and I have AS3 to thank for that.

It's a shame it's going away. Glad the pros from that time feel the same way I do about it.

Did you actually end up developing a game like that? Otherwise, Stardew Valley might be something you're interested in.
Stardew Valley is the kind of game where you can go "hrm, I'll play for a couple minutes before work" and then go "hey, where did the sun go?!"

Of course, so is Factorio...

I can no longer play Factorio. It is completely impossible for me to play without getting sucked in and wasting hours.

The worst part is that I feel productive while playing it. It's so close to the satisfaction I get from actually building something that it's just too dangerous for me to play these days :)

The peak satisfaction: eventually converting your base to 20+k logistic bot storms operating the entirety of your base and cranking out 10k+ blue circuits an hour.

Peaker satistfaction: Using mods to up the complexity and difficulty, and using all of AAI + all of Bob's + all of Angel's. New ores, vastly more complex refining, and you don't start with shit (literally makes like 2-3 hours to catch up to where you normally start tech wise on vanilla).

I used to working with AS3 and was always confused about the amount of hate that was thrown it's way. I found most things about the development flow very nice and it was a brilliant abstraction that HTML and JS just didn't provide.

I was involved in developing a really simple video editor in the browser that would have been impossible (or at least incredibly difficult) to accomplish without AS3 and the graphical abilities that it allowed.

But... it really did used to suck power from laptop batteries like nothing else.

I'll miss you flash. Thanks for shaping what we do and use now.

It was good for the time. So were java applets... but, as they say, to everything there is a season, and the sun is season is changing in the web media space..
> It was good for the time. So were java applets…

It's really not comparable. Flash + AS was a RAD environment, many a game developer got their start (and even built full-fledged games[0]) through it. I'd argue that its biggest contributions were not web-bound[1], and I don't know of any other environment which is both as easy to get started with and as flexible.

[0] it's famously the primary expressive environment of Edmund McMillen: Gish, Aether and Binding of Isaac are all Flash though the later got rewritten natively in Rebirth, Super Meat Boy is the native successor to the Flash Meat Boy, The End is Nigh may well be his first game which did not start in Flash (and even that's unclear as it grew from a 2-weeks game jam)

[1] except insofar as they were being embedded/distributed through it e.g. newsgrounds or armorgames

The web has become less interactive, and less animated. It's all about static pages now (literally, not as .html)
I wish we could take the best of AS3, ESNext, and TypeScript, and make it into one WebAssembled language...

Well okay. That's insane. But there's a part of me that wants to know how far it would go.

That's basically Haxe, if/when it adds a WebAssembly target. It already supports regular JS.

www.haxe.org

We're basically waiting for the spec for GC to come together and early betas to hit the repo. Support for the WebAssembly target will come soon after. https://github.com/WebAssembly/gc/blob/master/proposals/gc/O...

Follow haxe.io for news, etc. : https://haxe.io/

I like Haxe but had my qualms with it too. To be honest, I would have to try again, but last I tried I remember at least having some issues with the type system, and the module system was OK but I definitely miss my ES modules.
Maybe not all that insane, but TypeScript is already essentially what you're describing.
TypeScript is typechecked only at translation time, as is reasonable for any language you would compile to JS. (I guess Elm breaks this mold, but at some great costs.) A side-effect is that you don't have any type information at runtime, for example.
This isn't as bad as it sounds in practice. I'm usually glad it eliminates reflection which I've rarely seen used honorably... I do miss it occasionally.

Some popular typed languages, notably Java, do type erasure on objects as well. Extending that to value types feels right in a strange way, more consistent at least.

One thing I'll mention to make The a better experience... The compiler, even on the strictest options, will still let you do a lot of hacky old school JS crap. I HIGHLY recommend integrating TSLint with almost all rules turned on and Microsoft's contrib extension. It makes Typescript code almost bulletproof.

Use the Typescript language service and experimental plugin for VSCode to show both Typescript errors and TsLint errors live with intellisense. It's a pain to set all this up at first but the experience is slick.

On that note I wish tslint would stop trying to do code formatting rules. prettier nowadays does code formatting far better than tslint ever did.
I thought Prettier didn't support TypeScript, as the TS AST is completely different to the JS AST.
:-) same here. Those are the few rules I shut off. TsLint really shines in static analysis.
Check out flow-runtime [0] [1]. I've only poked around with it, but it seemed solid.

It supports pragmas so you can turn off assertions in production everywhere except in critical files.

[0] https://github.com/codemix/flow-runtime

[1] https://codemix.github.io/flow-runtime/

Isnt JS/ES approaching this? + the native stuff
More or less yeah. But I worry it will take a pretty big change in direction before we can get something as crazy as types in the browser. To be fair, I would have never guessed browsers would be able to implement the current standards to the degree that they have.
It's probably worth remembering that AS3 was essentially based on the draft (later abandoned) ES4; there's still a vague agreement that most of those features should come back.
Yes back than even AS2 was good. But now you have a lot of great tools available for HTML5 and Unity. You can build anything you would have in Flash.

I wouldn't say AS3 is the best programming language, but that's just my point of view. I, for one, don't have a favorite language because i think that each language has it's pros and cons and each language excels in a certain area.

HTML5 toolset is too fragmented and developer-oriented. Unity is humongous and WebGL builds are too big. There's no replacement for Flash.
What's your opinion on Haxe?
It may be ok for developers but the Flash scene was full of non-developers who used mostly the visual Flash editor and copy-pasted some scripts if necessary.
I played way to much farmville around 2009 running a schools front desk! Thanks for that!

Out of curiosity what is your language of choice now days?

Mobile games/vr/ar - Unity or Unreal

Web Backend - Elixir/Phoenix (we used PHP for FV), Python in some cases

Web Frontend / Native Mobile Apps - React & React Native

JS has effectively caught up to what AS3 offered back then minus type safety (which TypeScript offers).

> 0% chance we could have built the game using any other client-side tech stack available at the time.

Would that have been a major loss for humanity as a whole ? Farmville improved the life of how many people ? how many hours wasted, people made miserable and money lifted from cash cows ?

AS3 was like learning Java, but with the lifecycle gotchas of JavaScript. Ten years ago it offered everything that JS did, except it required static compilation. The development speed of JS+CSS was vastly better than with pure AS.

I'll slightly mourne the passing of Flash.

AS3 is still one of my favourite languages I've worked with, loved the class system they had in place for it.
Haxe!