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.
Mozilla (makers of Firefox) created this project for several reasons. First, to serve as a testcase for running a demanding 3D game in browsers: Having a working testcase lets us try out new browser features and to profile performance in order to make browsers faster. Another goal is to prove that games of this nature can run in JavaScript and WebGL, which many people are skeptical about. Finally, all the code in this project is open (and practically all the art assets), so others can learn from this effort and use this code to create their own browser games.
To learn more about how BananaBread was done, see these blogposts:
- Move with WASD, jump with space, look around with the mouse.
- Shoot with the mouse, change weapons with 1-5.
- You can change some settings using the main menu (press 0 or
`
). For example, add another bot with "add bot", or change the resolution with options->res. - 'e' toggles edit mode, which lets you fly around the map and actually modify it.
- Press 9 to toggle thirdperson mode (to see your own character)
BananaBread Repo: https://github.com/kripken/BananaBread/
Emscripten Repo: https://github.com/kripken/emscripten
Please note that up to date versions of modern browers are needed to run this demo, and it will not launch if it detects crucial features are missing.
- The demo works properly in the stable releases of Firefox (since August 2012) and Chrome (since September 2012).
- The demo should also work in any browser that supports the necessary web standards: Pointer lock, WebGL, compressed textures, fullscreen, and typed arrays.
- If you have trouble with WebGL, get help here.
See the project FAQ (specifically the technical part) for solutions to common problems.
Known issues:
- Internet Explorer can't run the demo because it does not support WebGL yet. Please ask Microsoft to support it.
- Older versions of Safari lack Float64Array and cannot run the compiled code.
- Sound has some glitches in Chrome.
- Mesa on Firefox 15 on Linux does not support compressed textures, but it works in Firefox 16.