Skip to content
vkbsb edited this page Mar 19, 2015 · 1 revision

##Exporting for HTML5 (using asm.js)

Exporting for HTML5 requires use to compile the godot engine to javascript from c++ using Emscripten.


###Downaload and Install Emscipten Portable SDK

Download the portable version of Emscripten SDK form the official website. Follow the steps provided there to ensure that you have the sdk installed on your machine. Once you have finished installing, you will have to create an environment variable named EMSCRIPTEN_ROOT for the godot build system to detect that your system is capable of building for "javascript" (HTML5) platform.

export EMSCRIPTEN_ROOT="PATH_TO_SDK/emscripten/1.29.0"

Now when you run scons, it will show you "javascript" as one of the platforms you and build for. Now run

scons -j4 p=javascript

Note: you should run this only after you have built godot for any other platform, this is because the shaders are not compiled when you directly build for javacript.


##Creating the Export Template

Once you have compiled the engine, if the compilation was successful, you will see the following files in the bin directory.

godot.javascript.debug.html godot.javascript.debug.js godot.javascript.debug.html.mem

Then Follow these steps:

  • Rename godot.javascript.debug.html as godot.html
  • Rename godot.javascript.debug.js as godot.js
  • Open godot.html in your favourite text editor and replace the "godot.javascript.debug.js" with "godot.js"
  • Copy filesystem.js file from tools/html_fs to the bin directory.
  • Now archive these files godot.html, godot.js, godot.javascript.debug.html.mem and filesystem.js

That's it you have the template archive for exporting HTML5 games from Godot.

This exporter still doesn't support the newer 2D features like sprite shaders, so avoid them if you want to export for browser.

Clone this wiki locally