Desktop nw.js export - self updating game?

0 favourites
  • 8 posts
From the Asset Store
Basic template for a front fight with self defense points.
  • Hey all.

    I don't know how feasible this is, but, I'm wondering if it is possible to make a desktop game with nw.js that is able to download its own updates. I'm building a game that I think I would like to update a lot in the future, and I don't want to put it on Steam or anything.

    After much Googling the most helpful thing I could find was a forum thread from a few years back in which Ashley essentially said "you'll have to come up with something yourself."

    Is that still the case? Where would you even begin with that, if that was something you had a mind to do? Ideally I'd like it to work on PC and Mac, too.

    I'd really like to do this, but I haven't got the faintest idea where to start. Anybody got any thoughts to set me on the right path?

  • You would have to set it up so that you deliver the updated game files via a server and would also need to bundle in an installer that you have made to delete the old files and replace them with the new ones.

    You could then call the installer program from within the nw.js game via the run file action.

    Don't see why it wouldn't be possible. Getting the download file path etc. could be a bit tricky but not sure

  • Yeah, it sounds simple, but when you start picking at the idea...

    First of all, won't the game have to essentially delete itself to replace its own files with the updates? Will that affect the user experience (eg. the app suddenly just auto-closes and must be rebooted ??).

    I figured for a nw.js thing you might be able to just download some pieces of it (eg. just the new JS files and some new PNG assets, etc). But that might be tricky on Mac, where all of the project bits are "inside" the application itself. So I don't know if that would work.

    Maybe it would be better to make a launcher program that checks for updates and then runs the game?

    Or maybe the simplest thing is (despite saying I didn't want to be on Steam or whatever) to find a distribution platform after all that would handle updates for me. I hate using Steam's publishing interface but I guess from the user's point of view that might be the most seamless way to receive app updates. 🤔

    Anyway, the game in question won't be done for a while yet so I have some time to mull it over. Still very much open to ideas and suggestions!

  • You would need to replace a few things but the UX you would just build in to the game's update process.

    The UX would be something like:

    User starts game

    gets notified of update

    clicks to download update

    update downloads

    update prompts you to install (with notification that game will close and restart)

    and on that click the installer would run, it would do whatever you hade made it do, the game would close after the call to run the installer, then installer would run the game again after it finished updating the files.

    I don't know of many programs that can update themselves without closing and restarting, it's not an issue.

    EDIT: Completely agree that Steam's Dev UX is trash for small developers

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Hi!

    "package.nw" file contains the game (in mac app.nw i think), the other files just the NW.js browser

    If you can update "package.nw" file you can update the game.

    If you want update the NW.js itself you need update all other files.

    You can create an updater with NW.js (Ajax + NWjs plugin). Game download the updater in a temp folder and updater update the game

  • Thanks for the thoughts guys. Really appreciate it. I'll definitely look into this more. nyuszi008 I think you are right that I really only need to update package.nw / app.nw for my purposes.

    Also I wonder if I could make the game app so that it is basically a nw.js wrapper that loads the game via an online upload? Like if I just hosted it at mysite.com and the .exe really just runs a window that visits mysite.com. (There are a couple of reasons why I wouldn't want to do that I guess - for one it would be slow, for two it would presumably be accessible to anyone who just visited mysite.com... hmmm. Just kicking ideas around)

    There's a few ways I could approach this so I will need to have a think about balancing my ease of publishing each update on the dev end, and the ease of receiving updates on the player end 🤔

    Thanks again everyone.

  • NW.js is just a chromium browser. You can navigate to any page you like in there.

  • And we have iframe plugin. So you can use as a normal browser. But Construct html5 export can install as an app in chrome browser. (Thanks for service worker)

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)