
Mozilla and Unity Bring Unity Game Engine to WebGL - robin_reala
https://blog.mozilla.org/blog/2014/03/18/mozilla-and-unity-deliver-award-winning-game-engine-to-the-web/
======
mrspeaker
I do like Unity (especially the component/entity system) but recently I've
been enjoying making games in plain ol' JavaScript (2, and 2.5D - granted).
Everything is just so open: I don't obfuscate or hide anything, and it's all
available via "view source". With an inspector/console you can quickly see how
stuff works and start messing around with it.

Of course, 99.99% of people just want to play games - but the way I got
interested in coding was by hitting RUN/STOP on C64 Basic game, tweaking the
values, and seeing what happened.

Pushing proprietary file formats through asm.js is a neat trick and gives
amazing results with little effort. But the long-and-potentially-boring "learn
yourself webgl for real" route seems more "web". And if someone, someday, gets
into game or web dev by trying to cheat at my games (the same way I did, back
in the day) - that would be flippin' awesome!

~~~
null_ptr
You're a dying breed my friend. Most software developers, game developers
including, have no appreciation for the technical aspects of their field, and
no appreciation for the importance of thoroughly learning and understanding
the foundations on which their patchy work is standing - they're glorified
product managers and all they care about is the end product they can make a
quick buck off of until it's superseded by another, not how well-crafted it
is.

~~~
phn
Using unity or a similar game engine has absolutely nothing to do with how
"well crafted" your game is, nor does it tell if the developer wants to make a
"quick buck".

I'm all for learning how stuff works and for taking pride in doing things well
(showing appreciation for the craft, as you say), but how many people do you
see making their own web framework to develop a web app? Maybe it makes sense
in some cases, which is true for games as well. And it is even more true if
your purpose is to learn, or to make something in a different way from
established frameworks.

We stand on the shoulders of giants in lots and lots of ways, and we should
make the most of it to continue to build great stuff (games, or anything
else).

With that said, I stand by the opinion that knowing how the low-level stuff
works makes you, if nothing else, more capable of using the higher-level
stuff. We just need to choose the best way of doing what we want to do, with
the time, money and tools we have :)

------
GavinB
This is HUGE news if it performs as well as advertised. We have been creating
games in Unity for a couple years and eyeing HTML5 as a possibility that just
was never capable enough to trust with a major project.

Unity as a development platform is a joy to use, and now we won't have to have
the same "Unity plugin or messy HTML5 game?" conversation for every new
project.

~~~
endemic
Yeah, I stalled with my plain 'ol Javascript games after the Unreal Engine
demos, since I assumed it'd just be a matter of time before Unity got a
plugin-less web export.

------
neovive
Very exciting. This is a great way to get people playing your game without
worrying about plugins. It will be interesting to compare the weight of a
basic 2D game using Unity 4.3 2D engine to one written in a HTML5 framework
such as Impact. I'm sure the use case is more for 3D gaming on WebGL, but
using one toolkit for all development is definitely easier for the developer.

Regardless, this is great news and great trend. Corona SDK also announced
WebGL support is coming soon
[[http://coronalabs.com/blog/2014/03/07/coronacards-is-cool-
he...](http://coronalabs.com/blog/2014/03/07/coronacards-is-cool-heres-
something-even-cooler/)]. Lots of great new tools to play with.

------
papa_bear
Is there an straightforward way to solve the issue with crazy load times on
big WebGL games? If I remember correctly, I played one a while ago and it had
to download assets for ten minutes before I could play it and it was a huge
downer. If this becomes the norm I'm sure it wouldn't be too hard to get used
to, but I was coming at this game from the mindset of playing instant
gratification flash games.

It would be cool if the engine could figure out what assets to download on-
the-fly, but I have a feeling that's not the case so game makers would still
have to do a bit of work before making the games web-ready (instead of ideally
just hitting an "export to webgl" button).

~~~
valarauca1
You can read/write local files from within a webpage. So I guess its possible.
It would require looking into how WebGL loads assets and overriding this with
diskIO operations not difficult.

The next problem would be asset management, but this isn't an important issue.
A lot of game data is already stored locally with little to no protection.

I'd have to look at how javascript handles file I/O it might not be 'that'
difficult.

~~~
TazeTSchnitzel
There's localStorage and there's IndexedDB. The former is blocking and not
ideal, but I think you can store blobs in IndexedDB and it's async.

~~~
hayksaakian
You missed the Filesystem API

[https://developer.mozilla.org/en-
US/docs/WebGuide/API/File_S...](https://developer.mozilla.org/en-
US/docs/WebGuide/API/File_System/Introduction)

~~~
TazeTSchnitzel
That's a new one to me. Sounds awesome!

------
davexunit
Mozilla, please stop promoting nonfree software. It would be better to assist
in the creation of a free game engine for the web instead of Unity.

~~~
azakai
I am a FOSS advocate as well, but I disagree that this announcement is a bad
thing.

First, Mozilla has and does assist in the creation of FOSS game engines and
tools (Gladius, CubicVR, help to various web ports like JSMESS and various
open source game engines, etc.).

Second, even the LGPL shows that absolute avoidance is not always the best
thing to do regarding closed-source code. Reality is more complex. Sometimes
interoperability with closed-source code is good for everyone including free
software.

In particular, a big benefit for free software here is that Unity games can
now run on the web, an open platform. Before they required a proprietary
plugin that did not work on Linux or BSD, but as JS+WebGL they can run on
those platforms. (Yes, the games are proprietary, but visiting websites using
proprietary code is basically unavoidable, both on the client and server-side.
At least we can do it using FOSS tools now.) So this helps support free
software OSes.

A final point, while the Unity engine is a proprietary codebase, they also
have lots of code that is FOSS, see their github page. They are also working
with even more open source code for the WebGL port, as it uses emscripten.

~~~
devcpp
>First, Mozilla has and does assist in the creation of FOSS game engines and
tools

Parent comment didn't imply the contrary. "stop promoting nonfree software"
doesn't mean "stop only promoting nonfree software".

>even the LGPL shows that absolute avoidance is not always the best thing to
do regarding closed-source code

If you ask the FSF, the LGPL should really be used as a last resort. Unity is
not too common yet (and hopefully will never be as long as it remains
proprietary), so I don't see why we should push it forward by helping its
integration. Same goes for HTML5's EME. I'd rather have a purely open platform
with less features and popularity than a platform with an open base and
countless incompatible binary blobs sitting onto it. And even the abomination
that EME is would at least be an actual standard.

>Unity engine is a proprietary codebase, they also have lots of code that is
FOSS

If you can't build it, it's not worth integrating. The only thing this is good
for is making a FOSS alternative (although I guess they keep the important
bits secret). I'd be using Google Chrome if "99% open source" was good enough.
By using Firefox (though Chromium would be fine if it weren't for the user-
hostile features), I precisely want to keep a clean FOSS platform. Conversely,
I only use an Android ROM because there's no good alternative, which is not
the case for Unity. So I wish they'd keep it out for now.

~~~
azakai
I get where you're coming from, I think, but Unity is not related to standards
in any way, unlike EME. Unity is just another game engine that can now run on
the web. All we did here is help them along the way, just like we help other
game engines to port to the web. It is not going to become a standard or part
of the browser in any way.

Even with Unity (and Unreal and others) porting to the web, web browsers
remain open, while web content (what ported Unity is) was always non-open
(since practically all websites are not FOSS).

I agree with you on the other hand that EME would in fact be a danger to the
openness of the web.

~~~
devcpp
Thanks for your reply.

>Unity is not related to standards in any way

I know, I mentioned it. I believe a standard at least has some practical
positive impact, unlike the integration of a particular closed platform.

>web content was always non-open

It's true that obfuscated JavaScript makes, in a way, a closed platform, but
much less so, in my belief, than straight-up binary code (which Unity delivers
and EME enables).

I get your overall point, but it just seems a slippery slope...

------
beefydude
Is it just me, or it is a bit hypocritical for Mozilla to be talking about the
wonders of the Open Web and then embracing two _very proprietary_ developer
platforms to promote Asm.js

If they cared about the open web, and they cared about open source, they would
be helping open source game engines like Ogre3D and Torque3D.

Instead, for the sake of expedience, we see them promoting proprietary
components.

It was not too long ago that they were lecturing the world on the evils of
proprietary video and audio.

~~~
gcp
_Is it just me, or it is a bit hypocritical for Mozilla to be talking about
the wonders of the Open Web and then embracing two very proprietary developer
platforms to promote Asm.js_

There is no contradiction here, on the contrary (heh!). Mozilla doesn't
believe an Open Web precludes proprietary applications. In fact they've
strongly argued that the web should be properly standardized so that it's
possible for anyone, including commercial parties, to make clients for it, and
that just opening up source code (ala WebKit, PNaCl, etc) does _not_ do this
hence is a bad way to achieve an open web.

The point has also already been made that this makes it possible for Unity
games to run on open platforms without requiring closed source blobs.

 _they would be helping open source game engines_

Uh, emscripten and asm.js have been enhanced to properly port many open source
engines and game libraries long before this one was announced. I'm going to
guess Unity was possible because they provided engineering resources to port
their own engine.

~~~
devcpp
>Mozilla doesn't believe an Open Web precludes proprietary applications

By definition, it must. It's a slippery slope and it's the reason Mozilla is
vehemently against EME. The rest of that line sounds like nonsense to me in
that context.

>The point has also already been made that this makes it possible for Unity
games to run on open platforms without requiring closed source blobs.

Awesome, the joys of running proprietary software on Linux. Ah, why even have
a FOSS OS then? Ditch it and get Windows! /s

------
zenbowman
This is awesome. I worked in educational technology building virtual humans
([http://alelo.com/](http://alelo.com/)), and have experience with a variety
of game engines. Unity is far and away the most pleasant developer experience,
despite being 1/100th the cost of some of the other commercial engines.

Pre-Unity, game engines were truly stuck in the dark ages.

------
drawkbox
Great announcement. With plugins starting to go away due to browser changes
and as a delta to mobile, this was needed. The end of 2014 Chrome will disable
plugins that don't use PPAPI and all NPAPI plugins will no longer work (Unity,
Silverlight and some other popular ones won't work). So glad they updated it
and in the right direction to WebGL.

------
basicallydan
"This is a big day for evolving the Web as a platform for gaming and we are
very excited to see what experiences developers will bring to the Web using
this powerful technology."

Slightly off-topic: I wonder if we're going to see more games being written to
run in Web Browsers, or more games being written using web technologies like
JS + WebGL but for desktop/mobile devices using things like phonegap/node-
webkit [0] and then sold through various app stores such as Steam, iOS &
Android.

The infrastructure for monetising web games in the same way that Steam and the
App Stores has done isn't there yet, but maybe it will be soon?

[0]: Like A Wizard's Lizard
[http://steamcommunity.com/sharedfiles/filedetails/?id=205801...](http://steamcommunity.com/sharedfiles/filedetails/?id=205801629)

~~~
kayoone
As the game development pipelines from traditional engines are much more
mature i think the premier way will be to develop there and just export to
HTML. Resulting Apps are heavier though, so for small web only games or just
some enhancement effects, there is still room for lightweight WebGL engines
like three.js

But with Unity you can have one codebase and export to
Win/OSX/Linux/iOS/Android/HTML5 and even consoles while some HTML5 engines
offer an acceleration wrapper for iOS but thats basically it.

------
coldcode
What is the performance like for asm.js and WebGL compared to a native app for
PC or Mac? What do you lose?

~~~
azakai
WebGL is basically at native speed. The only issue might be if a GL extension
you need is not in WebGL yet, but that is moving along quickly.

asm.js can run close to native speed, depends on the JS engine of course, but
it's not far off. See for example

[https://github.com/joelgwebber/bench2d](https://github.com/joelgwebber/bench2d)

~~~
Joeri
To qualify, close to native speed means about two thirds of native speed in a
best case scenario. Fine for games that don't stress the hardware to its
limits, but not for top tier.

~~~
azakai
First of all performance is CPU+GPU, and the GPU side is basically at native
speed. Many games are mostly GPU bound, so for them they would run at full
native speed.

For games that are CPU bound, two thirds of speed is the current average on a
set of benchmarks on Firefox, yes. But it will vary on codebase, and is
constantly improving.

Regardless, you say that top tier games won't work. What is UE4 and the
higher-end stuff Unity demoed, if not top tier?

------
pekk
I find it annoyingly disingenuous for Mozilla to pride itself on a "plugin-
free web" when they are the ones making decisions that ensure languages other
than Javascript will NEVER run without plugins.

Please stop hurting all of us with this artificially imposed Javascript
monopoly

~~~
CmonDev
Yes, let's invent/promote a bunch of select technologies to the extent of
directly integrating them into _some_ browsers and then call-it a "plug-in-
free web". At least they came up with asm.js...

------
tomcam
Article does not address licensing terms; what's in it for Unity?

~~~
gisenberg
Each platform for Unity has another license associated with it (eg: $1500 for
Android Pro, another $1500 for iOS Pro). Another web target would be another
$1500 license for folks to buy annually, I imagine.

~~~
TazeTSchnitzel
Maybe they'll give it away in the free version like with Web Player authoring.
Well, I can hope :)

~~~
gisenberg
When they were doing the Flash version, it wasn't free. Still, one can hope!

~~~
ps4fanboy
That was imposed by adobe not unity.

------
wildpeaks
That seemed like the obvious next step for Unity after they dropped Flash and
with browsers increasingly dropping NPAPI plugins; always nice to see
predictions come true :)

------
kayoone
Wow, i have been waiting for this for years and wondered what took them so
long. I love Unity and while its not free, other HTML5 engines will now have a
hard time.

~~~
chii
i wouldn't say they'll have a hard time - unity is just another choice among
the hundreds of engines out there for web.

I would say that it benefits more people who aren't interested in programming.
Unity is the visual basics of game programming.

------
Cakez0r
I'm curious to know how networking behaves in a webgl build. Will my tcp
sockets just work straight out of the box? That would be seriously impressive!

~~~
RyanZAG
They won't, but changing your server to accept websocket instead shouldn't be
too bad.

~~~
TazeTSchnitzel
Don't even need to do that. There are a bunch of TCP-WebSocket bridges out
there.

------
tarun29061990
This is a really good news as I have developed some small games in unity and I
wished that I can create it using HTML5. So will there be a tool for creating
graphics also or we have to follow same old html and images for that. And will
there be an option to port games to android, iOS and blackberry??

------
wildpeaks
I'm curious if the generated JS files will have Source Maps to trace back
runtime issues to the C# code.

------
mixedbit
I wonder if and how C# scripts (a big part of the Unity framework) are
supported for the WebGL target.

~~~
drawkbox
C# scripts aren't used in the final output.

Unity is an engine where the scripting portion is Mono based, upon export it
is converted into C/C++/Obj-C/Java for Desktop/mobile/web platform of choice.
It will be similar for javascript, the exported asm.js supported javascript
will emit from the export to WebGL.

Unity runs in the native platform it is in but Mono is their 'scripting
engine' and part of their core engine much like UScript/UnrealScript is UDK's
scripting engine. Unity uses Mono a little deeper than that but the resulting
export is optimized for the platform it exports to. Since it is built on .NET
it is alot like LLVM/JVM languages in that the IL/CLR/DLR are used to export
all common languages used in scripting to a common output and this is also the
reason you can use C#/Javascript/Boo (Mono versions) as they export to the
same thing in the end native to the platform they are on.

I am sure there will be pluggable areas of the outputted javascript but for
the most part you'll develop it as usual in Unity and won't mess with the
output as much except to plugin third party toolkits etc.

~~~
bilbo0s
To clarify a bit here...

Unity didn't say that 100% of Unity features will be supported in WebGL. Some
scripts will, most likely, not be able to run in the WebGL builds initially.
Also... Things like GI, or the new PhysX... I wouldn't count on if you are
wondering how to prepare a game to be WebGL ready.

That said, I'm certain they will improve the WebGL build tech as time goes on,
and eventually MOST of what anyone would need will be available. It just won't
be available on day 1 of Unity 5.

------
jokoon
you say what you want, I doubt professional, experienced game devs choose to
release quality game with unity.

unity is great for young devs, prototyping and content creators, but it's not
that much open so I doubt many dev really like to use it.

still a great thing for mozilla though

~~~
jon-wood
Yup, little teams like Rovio with there obscure games about pigs trying to
steal eggs wouldn't dream of something like that. Or that game no one's heard
about where you launch aliens into space. couldn't possibly work in Unity.

~~~
jokoon
coolish indie games, not that much popular either

------
thetannedman
I'm seeing parallels between Unity and Flash (circa 2000). In a few years,
we'll have the "Unity is dead, use <insert some other shiny technology>
arguments popping up all over HN

~~~
jiggy2011
Is that a bad thing? If something better comes along then it deserves to
displace unity!

------
Hawkee
I followed this link looking for a live demo. I was sadly disappointed. This
is certainly something I need to experience before passing any judgement.

------
wildpeaks
I'm curious if they'll also add features such as In-app Purchases given that's
a recurring issue in threads about HTML5 games.

~~~
TillE
Amazon is one good option for IAPs with web games:

[https://developer.amazon.com/public/solutions/platforms/weba...](https://developer.amazon.com/public/solutions/platforms/webapps)

edit - Forgot to mention, they even have a Unity plugin:

[https://developer.amazon.com/public/solutions/platforms/cros...](https://developer.amazon.com/public/solutions/platforms/cross-
platform)

~~~
wildpeaks
Interesting option indeed, it even has an AIR version.

------
rando289
Immediately after a flash video is the quote "... strengthens support for
Mozilla’s vision of a high performance, plugin-free Web,"

...

------
dharma1
looking forward to a demo. This could be a nice way of getting Unity3d games
to platforms unity doesn't support yet (Firefox OS devices, Ubuntu Touch etc)
if the performance will be good enough.

------
SimHacker
Who would be interested in "Unityify", an adaptation of Browserify that
supports Unity3D's dialect of JavaScript? It would package npm modules so they
ran in Unity, and include some shims to wrap the native Unity3D classes in
node APIs.

------
higherpurpose
Too bad it's not WebGL 2.0.

------
Touche
When will Dead Trigger 2 be available for purchase on the web?

------
outworlder
So, that's why they've been doing, instead of fixing the 64 bit version and
improve multi-threading support.

Let's hope it works as advertised then.

~~~
aras_p
You do realize that exactly the same Unity 5 announcement also announced 64
bit editor and improved multi-threading?

