News on BananaBread

November 19, 2012

Recently I had the honour to talk to Alon Zakai, the creator of Emscripten, a C/C++ to JavaScript Compiler. Yes, you read that right – a C/C++ to Javascript compiler. Actually it is even more. Why this makes sense, and what this has to do with web or 3D or web3d is what this post is about.

Alon Zakai is a researcher at Mozilla, the company that brings us not only Firefox but also a lot of open source projects like BrowserQuest (I wrote about it here) and of course BananaBread from the man himself.

https://i2.wp.com/content.screencast.com/users/dirkk1/folders/Jing/media/03e26fc7-f045-423e-b4e8-c4160c1823ac/00000053.png

He left a comment here stating:

I’d love to work with people that want to make a more virtual worlds thing with this technology – basically doing as you said, starting with Cube 2 or Sandbox, using the BananaBread HTML 5 on that, and adding virtual worlds features. There is a lot of potential in that approach, if people want to work on it.

I read about Emscripten before, at first in the highly recommended DailyJS blog. It sounded like a swiss army knife to turn, like, everything! to the web – way too good, to be true. They wrote a H264 video decoder in JS? Yeah, right.

But to learn that it works (read: really works) and that it could be a real game changer (pun intended) was awesome. Here are the key issued we were talking about in a nutshell and compiled from memory.

The bad news!

No bad news. Now – on to the good news.

How hard was it to turn the Cube2 engine into a browser game?

Not too hard. The time consuming part was to get the webgl context into Emscripten, because it wasn’t implemented yet.

Is it possible to turn BananaBread into a multiplayer game like Cube2?

Yes.

All the multiplayer code is still in, because the engine works with a local server. The only thing that needs to be implemented is some sort of TCP/UDP socket implementation. So if anyone with either websockets or WebRTC know-how steps in, we are good to go.

You mean ….?

Yes, Alon plans to get this implemented in 2013. This. Is. Awesome.

Why does Mozilla support Emscripten?

Now, this is important. The reason is: Mozilla believes in the openness of the Internet. Contrary to popular believe Mozilla is not competing with Google (or any other browser developer for that matter) because there is a competition between Firefox and Chrome.  The real problem are walled garden like Apples store, tempting developers into creating something as an app when it could be web app. Emscripten helps to bring ‘real’ programs into the browser, with no or small changes and with very reasonable performance. There is already a huge variety of applications available from games to text-to-speech synthesizers to full programming languages (python, ruby, lua etc.)

Next steps?

Note to self: get Emscripten to run on Amazon EC2 and get BananaBread going. More about that on this channel.