
Angry Bots Demo - tilt
http://webassembly.org/demo/
======
k_
Kill flash, they said..

Flash version, [at least] 5 years ago:
[http://tsuyobi.heteml.jp/unity/flash/AngryBots/](http://tsuyobi.heteml.jp/unity/flash/AngryBots/)

It's great to see WASM coming at last, but I must admit I'm a little
disappointed (for now, anyway). Huge download, and though it runs smoothly
(firefox 50) I'm not really impressed given what was possible with the flash
version.

~~~
koonsolo
Old-timers as myself already saw this coming.

The main idea of killing Flash was because some _websites_ completely ran on
it, which is bad. But games never was an issue, and never will be.

Battery life, system resources, downloading assets, ..., it's all the same if
you use either Flash or JavaScript.

Newsflash: Apple didn't block Flash because it is "bad", they blocked it
because they wanted you to go through their app store

Newsflash: Games written for Flash (in ActionScript3) also run on Android and
iOS. It even became "Best Mobile Application Development product" of 2014 and
2015.

They say Flash advertisement banners were annoying, so what do you think about
those JavaScript popup banners that pop in the middle of the page you are
reading, saying "Please subscribe to our mailing list"?

I you develop a game for Flash, it runs consistently in the Flash plugin. If
you develop a game in JavaScript, you need to test it in all browsers you want
to support. And yes, they are all different. And still gives troubles so many
years later. Surprising? Not for old farts like myself.

But no worries. I looked at my google analytics for the past few years. Most
visitors moved to Chrome. Flash plugin installed percentage: remained the
same.

~~~
mamadrood
Flash also has huge security flaws and memory leaks. Pretty much like Java
applets.

At least with JS, if it leaks or has security breach, the browser's developer
can fix it without waiting for a 3rd party, or I can use a different browser.

~~~
koonsolo
The more complex software is, the more potential security flaws and memory
leaks. All software is subjected to this. Bringing HTML5 to browsers adds to
this, and don't assume browsers are immune because they are not developed by
Adobe.

Same arguments can be made for Flash: Plugin's developer can fix it without
waiting for browser. Disable the plugin and use the same browser.

Conclusion: makes no difference conceptually.

~~~
phaser
The difference is that Flash, being proprietary, Adobe is the only party
allowed to fix a memory leak. HTML5, a standard, can have many proposals,
discussions and implementations on how to fix issues.

~~~
BatFastard
Seriously? Have you ever seen something fixed faster by a committee then by a
vendor who has a large financial incentive to protect?

I want to live in your world!

------
kawsper
It reminds of Alien Swarm[0], a free game by Valve, it is well worth it if you
can find 3 friends to play with.

[0]
[http://store.steampowered.com/app/630/](http://store.steampowered.com/app/630/)

------
moolcool
This feels like history repeating itself. The Flash version still runs better
for me than the WebAssembly version, and the Flash version worked well on
people's systems 5 years ago! It seems like half of the things I see on
HackerNews is JavaScript poorly doing that other solutions did better a decade
or more ago

~~~
bigato
webassembly is not javascript

~~~
moolcool
My point is that all of these things are running slower than flash did on much
older hardware. The technical sophistication of what the average user does
with computers hasn't changed much in the past 10 years (for the most part),
but these bloated web stacks have made real world performance actually go down
as raw hardware performance has gone up.

------
mobiuscog
Seems to work nicely in Firefox 50 release (no nightly required) once the
config is set.

Really happy about the way this is progressing.

~~~
Retr0spectrum
For me, the WASM version was noticeably slower, with an especially noticeable
JIT warmup. It might have been because the asm.js version was running at a
lower resolution, so it's not a very fair comparison.

~~~
sp332
If your browser natively supports WASM, there is no JIT and no warmup time.

~~~
Retr0spectrum
Ah, I didn't realise there was no JIT. In that case, I'm not sure what caused
it, but there was definitely a lower framerate at the start.

------
bhouston
What is the total download size? For program? For data? How does this compare
to the previous emscripten output?

~~~
runejuhl
From the network tab of Chrome developer tools:

    
    
      AngryBots11.wasm	GET	200	webassembly.org	xhr	UnityLoader.js:187	11.9 MB	54.38 s	GitHub.com	
      AngryBots.mem	GET	404	webassembly.org	xhr	UnityLoader.js:72	5.6 KB	172 ms	GitHub.com	
      AngryBots.memgz	GET	200	webassembly.org	xhr	UnityLoader.js:47	314 KB	1.30 s	GitHub.com	
      AngryBots.wasm.mappedGlobals	GET	200	webassembly.org	xhr	AngryBots.js:279	3.1 KB	250 ms	GitHub.com	
      AngryBots.datagz	GET	200	webassembly.org	xhr	UnityLoader.js:47	36.3 MB	2.9 min	GitHub.com	
      HWStats.cgi	POST	200	stats.unity3d.com	xhr	AngryBots.js:6595	149 B	3.80 s	Apache/2	
    

Just shy of 50 MB all in all.

~~~
corysama
Keep in mind this is built in Unity. It's difficult to make even trivial
native apps in Unity in less than 25 megs.

~~~
onion2k
The Unity WebGL engine is about 5MB gzipped. You won't get a web export
smaller than that, but you shouldn't need 20MB of assets on top of it for a
small game either.

~~~
bhouston
For a point of reference, Three.JS's source code hovers around 100KB gzipped,
sometimes more, sometimes less. That is a factor of 50x difference.

~~~
greggman
three.js doesn't have 1/50th the features of unity. three.js is great and ive
contributed to it but a game engine is a lot more than just a renderer.

------
imaginenore
Your stuff is broken

UnityLoader.js:72 GET
[http://webassembly.org/demo/AngryBots/Release/AngryBots.mem](http://webassembly.org/demo/AngryBots/Release/AngryBots.mem)
404 (Not Found)

------
k__
Now they need to add on-demand loading for parts of these applications and
things could really get nice.

------
amelius
What I'd prefer to see in a demo is running compiled code of other languages
(e.g. Haskell, C++, Python, Rust, Go) in WASM, and comparing performance.

Also interesting would be to run other virtual machines (JVM) inside WASM, and
see what the performance is.

Also interesting: compiling Firefox into WASM, and running it on Chrome (or
the other way around) :)

Further, I'd like to see a good test of multithreaded/shared memory
performance.

~~~
golergka
You can transpile this demo to C++ with IL2CPP. It's built into Unity for
iOS/Android platforms, never tried to do it on desktop, but I think it must be
possible.

------
egeozcan
Chrome (Version 57.0.2935.3 canary (64-bit)) on Windows 10 crashed the tab
when I tried to reload the page to play again.

~~~
s3th
Would appreciate a bug report if you have a repo:
[https://bugs.chromium.org/p/v8/issues/entry?template=WASM%20...](https://bugs.chromium.org/p/v8/issues/entry?template=WASM%20issue)

------
reitzensteinm
The Web Assembly version seems to be faster (not just warmup), but it would be
nice to get a 1:1 comparison there.

~~~
thedaemon
The Web Assembly version also looks to be using much lower texture resolutions
as well. It's cheating to get better speed it seems.

------
alexellisuk
I tried this with ASM.js - looked impressive to think this was all built with
WebAssembly. Haven't seen the flash version, but still this looks awesome for
50mb.

------
exabrial
I'm curious, why not use JVM bytecodes for web assembly... or actually any of
the legitimate, mature, optimized, hardened runtimes out there? I feel like
we're reinventing the wheel, again.

~~~
ndesaulniers
This has been answered 900 times already. See the design docs on GH.

~~~
Shoop
The design docs have a rationale for why not llvm bitcode [1], but I can't
find anything comparing wasm to other bytecodes or interpreters. Could you
point me to the right place?

[1]
[https://github.com/WebAssembly/design/blob/master/FAQ.md#why...](https://github.com/WebAssembly/design/blob/master/FAQ.md#why-
not-just-use-llvm-bitcode-as-a-binary-format)

------
bigato
I look forward to the day I'll be allowed to use ttk (tcl/tk) compiled to WASM
instead of html/css to build interfaces.

------
zimpenfish
Why Oh Why Oh Why would you use isometric WASD for this instead of
Forward/Backward/Strafing?

~~~
skocznymroczny
Because the camera doesn't rotate, so when you are facing south, forward would
move you backwards on the screen, and strafe-left would move you right on the
screen.

