Towards open game engines in the browser

January 6, 2013

I started a series of experiments towards a game engine in the browser. This is part of a bigger plan that I hopefully get sorted out soon and write down eventually*.

To me, there are two paths to follow towards games** in the browser and I will follow both of them.

The ‘Bananabread’ way

Taking a full fledged game engine like Cube2 is the way that Alon Zakai is following – his Emscripten process is compiling it to pure Javascript and ports Bananabread to the browser. At this very time of writing he is adding the last missing piece to it – network support.

Bildschirmfoto 2013-01-06 um 11.52.00

I cannot stress enough how incredibely cool this is.

The JavaScript library way

A ‘game engine’ comprises usually a couple of different components and it turns out that you find open source JavaScript libraries for nearly (?) every purpose of such an engine – sometimes even more than one.

This list is by far not complete (more complete lists here and here) and I am probably missing some bullets and some libraries which even underlines my point: everything seems to be there.

To get a grip on it myself, I took a 3D engine, a physics engine and the first person controls and build a little demo, sporting an (albeit unsophisticated) Blender model and some dynamic objects:

Bildschirmfoto 2013-01-06 um 11.52.24

Why is this important?

There is absolutely nothing wrong with proprietary concepts like the Unity Engine, not even with Flash.

I still think it’s important to be able to create something right in your Browser – both Mozilla and Google are working towards turning their browsers into multimedia engines and add the parts missing in a spectacular speed.

Most of the components needed are already there, so why not use them?

But even more important: all of these libraries are open source. This means we can not only use them for free, but we can learn from them, combine them and maybe enhance them to something that the original authors may have never thought of.

So – what keeps you from building?

* Rob Hawkes (former Mozilla) has written an excellent post which includes some aspects of the bigger plan.

*Disclaimer: when I say games I mean the good definition of games like in  “cutting edge real-time database network application with multimedia frontend for entertainment” and not the awkward german definition of  “it’s fun so it can’t be serious”.  And no, I won’t grow up.

[EDIT] The source code to the demo is on Github.

[EDIT2]

Blender view

Advertisements

Minecraft Game Server Launcher released

December 11, 2012

As I stated in my previous post I am going to open source the Minecraft Game Server Launcher (MGSL).

And I just did.

Stella Haystacks world on EC2

The MGSL is a python script that can be used to launch a Minecraft server in Amazons EC2 cloud on an Ubuntu server.

The MGSL is dead simply to use: you run ‘python mgsl.py’ once and the server starts and loads the your Minecraft world. You run it again, and your world gets stored in a safe place and the server is terminated.

That’s it

Get it  here:

https://github.com/dirkk0/MGSL

Tell my if it works for you and what I can do to improve it in the comments.


MGSL (the Minecraft Game Server Launcher)

December 6, 2012

I decided to open source a project that I was working on in my spare time.

The idea behind this concept that I call MGSL (Minecraft Game Server Launcher, in lack of a better name :-) ) is that people don’t need a minecraft server 24/7. What they do need is a very simple mechanism to start and stop a server on Amazon EC2  *plus* an automatic save/load routine.

Under the hood it’s a two applications: the web interface that manages a database (based on web2py) and a python/boto script doing the hard work.
More infos soon.

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.


‘The future of web gaming’ – Talk by Colt McAnlis

October 25, 2012

Colt McAnlis’ (guy, blog) very interesting take on the future of web gaming. He addresses the existing possibilities of HTML5 and JavaScript areas and stretches out to native client code ‘NaCL’ and even multi-device development. About 40 minutes, and very worth the time!


Minecraft de facto standard of virtual worlds?

September 22, 2012

Yesterday Linden Lab announced the upcoming launch of their new online platform ‘Patterns‘.  I may have written this too often lately in my post but here I go again: ‘does this look familiar?’

According to New World Note‘s Wagner James Au, Notch approves.

To me this is the prove that even Linden Lab feels that Minecraft’s approach of ‘crafting’ things from simple patterns (pun intended) is superior to their uber-complicated client which they never really were able to boil down to the few elements you need to build virtual worlds.

Granted, SL and MC don’t really compare if you look at the details and the overall purpose is different. But in the end of the day it is way easier to simply experience and build in Minecraft.

Also, you can roll your own server which is largely detailed in the Minecraft Wiki. For my own experiments, I wrote a script that starts an Amazon EC2 instance, installs all components required for Minecraft, pulls the latest backup of our favorite world from my Dropbox, and starts – all of this unattended, in one line. I can even start it from a train (I just did). When we don’t need it anymore, we backup the world, save it to the DropBox and terminate the instance. Total cost – a couple of cents. If we only craft at home we can deploy the same thing to our kitchen server at no cost.

So to me Minecraft delivers most aspects that I missed from SL and then some. The few things that I miss in Minecraft to be a virtual world platform are slowly but surely added by Mojang and especially by the community one plugin after another, due to the openness of the server code base.

I really wonder if LindenLab with their current claim (‘Makers of Shared Creative Spaces’) will be achieving the same ease of use at such a competitive pricing plan with Patterns. Since they also ripped the ‘buy beta for less’ business model that Notch established, I’d say there is reason to hope LindenLab will be doing it right this time. Looking at the decline of Second Life – they better be.


BananaBread – Cube 2 engine in the browser

September 9, 2012

After BrowserQuest (I described the merits and the installation over here) the Mozilla Foundation didn’t stop by bringing top-down 2D multiplayer to the web. A couple of days ago they released Bananabread. From the description:

BananaBread is a 3D first person shooter that runs on the web. It takes the Cube 2: Sauerbraten engine, which is written in C++ and OpenGL, and compiles it using Emscripten into JavaScript and WebGL so that it can run in modern browsers using standards-based web APIs and without the need for plugins.

This is important in a couple of ways.

  1. This is a full-fledged first person shooter running completely in the browser  in JavaScript and WebGL – smoothly.
  2. The described development way – compilation of a C/C++ with Emscripten – could be one way to go to develop games or virtual world environments in the browser (as opposed to written in JS directly).
  3. I learned in the Google Creative Sandbox in Berlin that Google sees the Chrome browser more and more as a multimedia engine to run creative applications – like games. That’s why they are incorporating things like WebGL and the Mouse Lock API. Obviously Mozilla/Firefox agrees.
  4. Sauerbraten.

I’ll go into more detail for this last bullet.

The Sauerbraten engine – luckely renamed Cube afterwards – was written by Wouter van Oortmerssen back in 2002 with Cube 2 following two years later as a re-design. The major features that makes Cube 2 stand out from the rest of the pack are:

  1. It is lightening fast on current hardware and runs great even on older hardware because it uses a cube based, oct-tree approach to render the world.
  2. It’s a multiplayer game with real-time editing abilities.
  3. It’s open source.

Now let’s look at the first issue: the cube based approach. If that sounds familiar – that’s right. That’s the same approach that Mojangs Minecraft uses. Also the second bullet – multiplayer editing – is a feature of Minecraft: in fact the multiplayer editing feature is what makes most of the fun (according to personal observations and some relatives ;-) ).

I am not stressing this to tell somebody ripped the concept of somebody else, rather the opposite: we can learn from both concepts to create better virtual worlds.

To me, Minecraft today seems to be as close to virtual world immersion as it gets, with its incredibly easy user interface and the fantastic crafting notion. Sauerbraten, on the other hand, features more realistic graphics, although using the same blocky approach. Also it’s open source. Both have clients for Windows, Mac OSX and Linux  using a completely different approach (Java vs. C++).

With virtual worlds being at an all time low (see the Gartner Hype Cycle 2012 discussed in Wagner James Aus NWN ) we need to learn from these concepts to do it better next time – and there will be a next time.

With the WebGL translation of Sauerbraten, I can’t help but stress there are ways to create a multi-plattform, multi-device approach for games and virtual worlds – even within the browser.

If I had too much time and/or money on my hands, I’d propably start with the Cube 2 engine, de-militarizing it (a bit) and slowly but surely adding features like external user authentification, multi-screening abilities, DropBox integration – maybe even crafting features. The Sandbox Game Makers did a Cube 2 conversion towards a somewhat more peaceful, educational game play:

There’s tons of ressources and mods out there. I’d like to point out the excellent (albeit german) ressources at Natenoms Blog with a very friendly user community, explaining important more advanced features like mumble integration (i.e. VoIP support in Cube 2).