Make exe for impactJS games

I finally found a way to publish my impactJS game after googling for a while. Following methods are applicable for windows.

As mentioned in the previous post, your impactJS file structure should appear as follows:

media/
lib/
lib/game/
lib/game/entities/
lib/game/levels/
lib/impact/
lib/weltmeister/
index.html
tools/

There is a bake.bat in your tools folder that should allow you to bake your files. Baking is simply puting all your source files into one big file. Execute the bake.bat, a cmd box will appear, wait for it to do its things, and press any key when prompted. You will now see a game.min.js generated at your root.

Since the source files are shrunk into a game.min.js, you need to change the source at your index.html. Open your index.html and delete the two script lines and add:

Then, move your index.html, game.min.js, and media folder to the desktop (so that we can do things easily). Make a package.json file containing:

Change the width and height accordingly. Zip your index.html, game.min.js, media folder and package.json together and name it app.nw (You can zip it as .zip first, then rename it to .nw or change the settings to zip it to .nw straightaway). Put the app.nw file to node webkit folder (node webkit.zip can be downloaded from here, unzip the files and put it into a newly made node webkit folder).

Open cmd and change directory to your node webkit folder, execute the following command:

An app.exe will appear in your node webkit folder. Next, download ‘Enigma Virtual Box’ from here and install. Open ‘Enigma Virtual Box’, at Enter Input File Name, browse your app.exe. Drag all the .dll and nw.pak from your node webkit folder to ‘Enigma Virtual Box’. If there is pop up, choose ‘%DEFAULT FOLDER’ and press OK. Press the process button. When the process is done, click close and exit. A new file named ‘app_boxed.exe’ should appear in your node webkit folder. You can rename and distribute this app_boxed.exe to your players, it should work on its own without needing any other software.

Below are the previews of my first impactJS game:

This is a simple shooting game. Press spacebar to change position of the player, and click to shoot canon. The source file is at https://github.com/shaunlgs/shipdefense.



Leave a Reply