Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

How To Turn Your Twine Games Into Windows Executables

How To Turn Your Twine Games Into Windows Executables
Some people are unhappy with the current .html format of Twine games. This tutorial is meant to show you how to turn .html Twine games into .exe Windows files.
Requirements
You will need:
NW.JS: https://github.com/nwjs/nw.js
Your Twine game's .HTML file

Extract NW.JS with a ZIP extractor.
Now, let's continue!

Configuring package.json
We will need a proper package.json to do this.
Download the attached.json, open it in Notepad,
and change "gameName" and "gameAuthor" to the name of the game, and your name respectively.
Rename your HTML to index.html
For "license", put any 3 or 4 letter license, like GPL, MIT, LGPL and other licenses.
Save the file as 'package.json' in the directory where the HTML file is.
Compiling The Executable
Make sure you extract the NW.JS archive.
Now, in the directory the HTML file is in, put all the required files for your game, and then put everything in that directory
into a zip file.
Rename the zip file to blablabla.nw
MAKE SURE THE EXTENSION IS .NW
If you cannot see the extension, press Windows+R and type 'cmd', then hit enter.
Then, in CMD: type:
cd "*directory where HTML file is*"
After that:
ren *name_of_ZIP*.zip *name_of_ZIP*.nw
Take the .nw file and put it in the same directory you extracted the NW.JS in.
It's the right directory if there is a 'nw.exe' file.
Now, go back to CMD and type this in:
cd "*NW.JS directory*"
After that:
copy /b nw.exe+*nameofnw*.nw *nameofgame*.exe
And you are done!
DO NOT DELETE THESE FILES: *nameofgame*.exe, nw.pak, libGLESv2.dll, libEGL.dll, icudtl.dat, ffmpegsumo.dll, d3dcompiler_47.dll
Delete all the other files.
Finally, put your game's license in.
And that's it.

Comments

  • I've made a thing for automating this process, though it's still not so much for the faint of heart. It should work on Windows or Mac and generates Windows, Mac, and Linux apps.
  • edited September 2015
    Can I just ask whether it matters whether I use the 32 or 64 bit version of nw.js? If I compile it using the 64 bit version and then someone downloads the compiled program on a 32 bit version of Windows, will it still work? Unfortunately I don't have a computer running a 32 bit version of Windows to test it on.

    Thanks for the tutorial btw :)
  • 32 bit computers are unable to read anything compiled in a 64 bit environment. It'd be a bit like opening an instruction manual and everything's in Japanese, with no pictures. You will cry. On the flipside, 64 bit processors these days typically have 32 bit backwards compatability, so... you could say they're bilingual.

    Generally what the accepted method for ensuring operability for all is to make 2 versions, one compiled for 32 bit and one for 64 bit. From there you can have the user pick a version or have a script detect the user environment and supply the correct installer.

    There MAY be options to Compile a 32 bit executable in a 64 bit environment, but you'd have to check the compiler's documentation.
  • Is there anything like this for turning Twine games into XML or direct input into Xcode?
  • 1nKy wrote: »
    32 bit computers are unable to read anything compiled in a 64 bit environment. It'd be a bit like opening an instruction manual and everything's in Japanese, with no pictures. You will cry. On the flipside, 64 bit processors these days typically have 32 bit backwards compatability, so... you could say they're bilingual.

    Generally what the accepted method for ensuring operability for all is to make 2 versions, one compiled for 32 bit and one for 64 bit. From there you can have the user pick a version or have a script detect the user environment and supply the correct installer.

    There MAY be options to Compile a 32 bit executable in a 64 bit environment, but you'd have to check the compiler's documentation.

    The way I imagine 32- vs 64-bit architectures is like this. Imagine that you have two rooms, and one is one story tall (a 32-bit architecture) and one is two stories tall (a 64-bit architecture).

    Now you have a two-story-tall lamp (bear with me) and a one-story one. Your two-story one lights things up better, since it's higher up, but you can't fit it into a 1-story room because there's a ceiling in the way. You could, however, fit a 1-story lamp into a 2-story room, but it's not optimal, since you can just get the 2-story one and it lights better, provided it fits in the room.

    However, if you have a lamp that you know is going to be switching around from a one-story to a two-story room, you would get the one-story, because non-optimal beats impossible. Following the analogy, you'd get a 32-bit compilation (if that's the word) if you knew that you'd have it running on 32- and 64-bit machines. Best is providing download options for both, though.
  • edited October 2015
    I've discovered something on GitHub called Web2Executable which allows exporting to Mac and Linux as well as Windows. I can't testify how well it works for Mac and Linux as I haven't tested it yet on those platforms (if anyone has a Mac let me know and I'll compile something if you fancy testing it :) ). You can find it at https://github.com/jyapayne/Web2Executable . It outputs almost exactly the same as the above method (using Node Webkit), but it does have the added advantage of a GUI.

    Oh and when you open it, remember to click File and then Open Project to import your stuff. It's not immediately obvious and you can sit wondering why the boxes are all greyed out.
Sign In or Register to comment.