Deploying with node-webkit

What is node-webkit?

node-webkit (also known as NW.js) is an app runtime based on chromium and node.js that enables you to create desktop apps written in HTML, CSS and JavaScript and deploy as a native app. For game developers, that means you can deploy your HTML5 games to desktop quite easily.

You can download node-webkit from Github, run-times are available for Windows, Mac and Linux.

Testing with Booty5

After running test / run from the Booty5 editor you can enter the projects html sub-folder and view the HTML, CSS and JavaScript that was generated for your project. You will need to create a file in this sub folder called package.json which contains the following:

To run your exported Booty5 game under NW.js:
* Run a command prompt and change to your games export html folder, for example if your project is located in c:\booty5\games\my_game:

* From the command prompt run path_to_nwjs/nw.exe . (note the dot), for example if you have nsjs inmstalled to c:\nwjs:

Note that when you run your game under node-webkit you will notice that it is ran in a browser window, giving you access to the JavaScript console etc.. for debugging. However you can modify this behaviour to give you the full client area to play with by adjusting your package.json, e.g.:

This turns the windows toolbar off and puts the window into full screen.

If instead you want to show a windowed window then you can instead pass a desired with and height of the window, e.g.:

There are various other options that can be passed into the package.json, for a full list see here

For packaging and distributing your node-webkit based native games see here for details.

3,801 total views, 1 views today