Jump to content

How to make a desktop game with Phaser?


toto88x
 Share

Recommended Posts

Hello!

 

I'd like to port one of my existing Phaser game into a desktop app that people can download and play offline. And before starting, I have a few questions:

 

- Node-webkit seems to be a good option to do this, but are there other interesting alternatives?

- Has anyone tried node-webkit? Is it working properly and easily with Phaser?

- Any resources or tutorials on how to make a desktop game with Phaser?

 

Thanks!

Link to comment
Share on other sites

I can confirm that node-webkit works brilliantly with Phaser, as I'm using it myself at the moment. You must remember to copy over a few required files for webGL to work on Windows however, but otherwise it's a joy to work with. If you follow the basic tutorials on getting NW set up and working, everything else works pretty much as it does in a web environment, and I don't really think it requires a separate tutorial.

Link to comment
Share on other sites

I just made a few tests, and it seems to work fine indeed. Thanks! :-)

 

Edit: I have 3 questions related to node-webkit

 

1) I just saw in the documentation that: "The end result will not be a single executable, you must also include some DLLs in your zip-file."

Is there any way to make the executable for the end user a single icon that he can double click to start? (Mac, Windows and Linux)

 

2) Can I create the executables for Windows and Linux on my Mac? Or do I need to use a Windows machin to create the Windows exe, and same thing for Linux?

 

3) Are there any ways to reduce the size of the file? Right now my super simple game is over 70MB (mac executable).

 

Thanks!

Link to comment
Share on other sites

1) You do still get the executable, but the DLL files must be packaged alongside it, just like most other apps.

 

2) I believe you need to create the executables on the relevant OSes, but I've not looked into this fully yet. I assume this is the case though.

 

3) Unfortunately node-webkit adds a lot of overhead, which is one of its only drawbacks. Beyond normal file compression, I don't think there's a lot you can do - the majority of the overhead is the WebKit and NodeJS binaries and their dependencies.

Link to comment
Share on other sites

Enigma Virtual Box, might be what you are looking for I haven't used this for a shipping product (yet) nor have I tried it with node-webkit.exe, however my experiments with it for bundling dll's and files into a single .exe works surprisingly well.  Their $$$ products are also very interesting sounding as well however online publishers usually have their own wrappers but for selling something yourself it might be good?

 

oops almost forgot the url ( http://enigmaprotector.com/en/aboutvb.html )

Link to comment
Share on other sites

Thanks, I'll look at it!

 

Do any of you know how to handle correctly full screen games with node-webkit?

 

If I just add "fullscreen": true to the package.json, the game is fullscreen but becomes impossible to quit.

Link to comment
Share on other sites

I did it programmatically like this:

var AppWindow;// loose check to see if require is available and if so, try to require nw.guiif (this.require) {    AppWindow = require('nw.gui').Window.get();}function create() {  game.input.keyboard.addKey(Phaser.Keyboard.F).onDown.add(function () {      if (AppWindow) {          // we are in node-webkit, so use the AppWindow.toggleFullscreen method          AppWindow.toggleFullscreen();      }      else {          // we are in a browser, use use Phaser's normal method          game.scale.startFullScreen(false);      }  }, this);}

If you're starting fullscreen, you'll need to create a button or key or some way for the user to call AppWindow.closeAllWindows() which will close the app and any windows spawned from it, rather than relying on them to press ALT+F4 or whatever their OS's shortcut is.

Link to comment
Share on other sites

  • 8 months later...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...