Introduction
Recently, NASA published their press release which mentions the unique possibility to drive around on Mars. I couldn't help myself and right away clicked on the link that lead to an amusing interactive experience where I was able to drive the rover around, watch video streaming from its cameras in real-time and even find out the specs of the vehicle. However, what shocked me the most was that this has all been done using the Blend4Web engine - and not Unity.
Why was I so surprised? Even two yeas ago (or more) there were publications about NASA creating a similar demo using Unity. However, it didn't get passed the beta stage, and it looks like the space agency had moved on from Unity. It is interesting that the programmers of such a large organization chose to discontinue the time-invested project and begin from scratch. It took a little time but I was able to find the above-mentioned Mars rover app made in Unity. Honestly, it looks like an unfinished game. The scene loads slowly (especially the terrain), functionality is primitive – you can only drive, the overall picture is of horrible quality.
We all know wonderful games can be made with Unity and its portfolio is full of hundreds of quality projects. So, what's the deal?
What's the Deal
The reason is that Unity is seriously lagging behind when it comes to their WebGL exporter. The first alarm rang when Google Chrome developers declared NPAPI deprecated. This browser's global market share is too significant for any web developer to just ignore. You can find a lot of “advice” on using a magic option, chrome://flags/#enable-npapi, online. However, in September 2015 this loophole will disappear.
Creating games and web visualizations is an enterprise and nobody likes losing customers. Earlier, downloading the Unity plug-in was not as big of deal as it was with Flash – but now the situation has become completely different. The web plug-in can not be used anymore, while Unity's WebGL exporter is still in its infancy.
Developers of all kinds caused uproar, requiring the Unity team to proactively respond. Finally, Unity 5 has been released with WebGL support but only as a preview. Half a year has passed and the situation is not any better. They even came up with an “ingenious” method to check the user's browser and then recommend using Unity in another browser. Unfortunately, and for obvious reasons, it is not always reasonable.
And still, what's happening with Unity WebGL? Why is there still no stable version available? What are the prospects? These questions are of much interest to many developers. I'm not a techie, so it's difficult for me to understand Unity's issues in this area, but what I've found online is making me sad.
WebGL Roadmap
The official Unity forum has a thread called “WebGL Roadmap”. A team representative explains the future of WebGL in Unity. I have looked through this text thoroughly and it convinced me that the bright future Unity keeps promising is still in the far removed distance.
WebGL should work in all browsers on all platforms including mobile ones by default. It's not there. If you happen to successfully compile your game for WebGL, strike out mobile devices from the list. The reasons are clear: Unity's WebGL has catastrophically large memory consumption and bad performance. Yes, a top-of-the-line device can still manage to run the game at decent speed, but a cheaper one will run it as slow as a turtle.
And forget about hoping your project will work on desktops with ease. Browsers are the programs which eat all of a computer's free memory, and the half-finished Unity WebGL build often causes crashes and closes browser tabs (especially in Chrome).
There are some problems with audio. I personally tried to export a simple game for WebGL, and got croaking noise as the main character moved. The sound literally jammed and I could not fix it. The reason is poor performance, but other engines still work somehow...
Forget about in-game video. MovieTexture class is simply not supported for WebGL. As an alternative, the devs are suggesting to use HTML5 capabilities directly.
Network problems. System.IO.Sockets and UnityEngine.Network classes do not work for WebGL and will never work due to security issues.
I haven't enumerated all issues, but this doesn't answer the question – when will it start working? Alas, Unity devs' comments are unclear, obscure and don't include a specific timeline. Although I did find something:
“We are not committing to specific release dates for any of these features, and we may decide not to go ahead with some of these at all.”
They're Waiting
They are waiting for WebGL 2.0, which will be based on OpenGL ES 3.0. The future version, Unity 5.2, is planned to have an export option for the new API. However, I'm not sure that browsers will work with it – now WebGL 2.0 is available only as an experimental option.
They are waiting for WebAssembly, which is very promising but has just started being discussed. Nobody can even guess the date when it will be implemented.
I'm sorry, but if the problem can only be fixed, as they say, by upcoming third-party technologies, then maybe the problem lies in Unity WebGL itself?
Unity is a convenient, popular and cross-platform engine, an awesome tool for making games and I love it a lot. Still, this is a tool which can no longer be used for the web. The most annoying fact is that the future holds too much uncertainty.
You may say, “you are a pessimist!”. No, I'm just a realist, just like the NASA guys. This is the answer to the title of this article: “Why NASA Switched from Unity to Blend4Web”.
It's simple: Unity's WebGL is not ready... and will it ever be?
“We are not committing to specific release dates...”
So what about Blend4Web? I can only congratulate the developers with such a conclusive win in the field of WebGL – NASA's app has been showcased at the opening of the WebGL section on SIGGRAPH 2015 – which means competitors have no intention of waiting.
Background
This post is a translation of the original article (in Russian) by Andrei Prakhov aka Prand, who is the author of three books about Blender and a Unity developer with several indie games released.