TheRealDannyyy's Forum Posts

  • The part about custom builds is a bit iffy, for the same reasons they don't want to promote Electron.

    I mean it's not really my/our problem to deal with to be honest. It's always been possible to export and create desktop games as a free user.

    Either way for cases like that there is the law, specifically the licensing agreement that we all have to agree with.

  • Updated the Roundup with the following change(s):

    • How To: Workaround Steam Overlay Not Appearing
    • How To: Use The Built-in NW.js FPS Counter
    • Some minor changes to make it look less like giant wall of text

    Thanks for your suggestions, keep'em coming!

  • Maybe the lessons / workarounds listed here could be put into a tutorial and linked from the front page...?

    ...

    That's kinda missing out on the point of this, I wanted to sum things up with this and make it easy and understandable while doing so.

    Thanks for your kind feedback.

    I think that those who don't have anything to do with NWjs are not following this thread and those who do would appreciate to be up to date ASAP, so I would vote for updating it whenever there is a new info.

    Noted.

  • Thanks to you both, I think I will add this one to the roundup as well.

    If there are more quirks like these please keep PM'ing/posting them, I would like to update (+push) this topic once for a bunch of changes instead of doing it multiple times and annoy people that don't have anything to do with NWjs.

  • Not at all. Making them invisible will stop rendering them. So will having them out of the boundaries of your current screen. ...

    I find this whole process a bit confusing to be honest.

    So what I get from the "Image memory" part is that everything on the current layout is loaded into memory,

    meaning that even if you would destroy or set X invisible to stop it from rendering, it's still consuming memory right?

    I'm used to systems were you could load parts of the gameworld into memory while releasing others.

    Not meaning to say that those kind of systems were perfect, they were mostly coming with micro stuttering on

    low end devices but still, I think that 2D games like mine with a lot of high-res sprites would profit from using a method like that.

    Anyway, HERE is a plugin to do the thing mentioned in this request. Plugin made by one of our JS magicians that goes by the name of

    (C0 and everybody can feel free to use the code in one of their own plugins if they like to.)

  • Yeah, I think it would be better if we could make families more usable so that you can say "Family is in layer -> Destroy" and have it do more or less the same thing. This way seems better since you can extend it to any conditions or actions, not just a special-case "destroy on layer" feature. But as with pretty much any feature suggestion at this point, it probably won't happen before C3.

    Thanks for the lightning speed response.

    I just thought this this would be one of the "easier" features to implement compared to fully reworking plugins and so on, since the code for destroying and detecting objects on a layer should already be there (e.g. layer effects apply to all objects on a layer) but if you consider reworking whole engine side mechanics that's fine too.

    It's just that recently a discussion about "unloading" certain things came up again and destroying objects is kinda C2's only way to stop rendering objects AFAIK.

    Alrighty then, we're looking forward towards improvements that could make a process like this easier inside C3.

  • You both made your fairly "negative" points towards this request and that's alright but I don't want to get into any further arguments.

    I would really appreciate a more "official" approval or denial of this feature request, I'm sure you guys do understand.

  • The Feature Request:

    I would like to request a system action with the purpose of destroying all objects on a selected layer.

    Practical Example Of Use:

    This action could make it possible to unload/destroy all objects on a certain layer by simply using one action.

    Developers could for example destroy certain parts of their layer-segmented "gameworld",

    without having to create many individual event-loops to destroy each type of object or object type family.

    Minor Technical Details:

    Plugin: System

    Type: Action

    Name: Destroy All Objects On Layer

    Category: Layers & Layout

    Basic Programming Logic: Get all objects on *layername* > Destroy all detected objects (including all instances)

    Additional Requirements: Requires a window with textbox-input for the user to add the name of the layer.

    @Ashley I would very much appreciate this feature or a short statement about this feature request.

    I could also provide more information or practical examples of use if required. Thanks for your time!

    Update:

    HERE is a plugin to do the thing mentioned in this request. Plugin made by one of our JS magicians that goes by the name of

    (C0 and everybody can feel free to use the code in one of their own plugins if they like to.)

  • Updated the Roundup with the following change(s):

    • How To: Test Your Game On Higher Frame Rates Than 60FPS

    Thanks for your suggestions, keep'em coming!

  • Hello lucid it's me again and I think I've found a bug.

    To give you some background on what I would like to achieve.

    I would like to manipulate the angle of a single bone, this would make it possible for me to set the angle of a weapon accordingly to the mouse pointer position.

    I've done some smaller tests as you can see in the image below and I couldn't get it to work.

    I did use your example capx and tried to set the angle of the pistol but it didn't work at all.

    I'm not sure if this is an issue related to the new self-drawing method but the "Override ..." doesn't seem to work with the old method.

    This issue is pretty critical in terms of game development and currently slows down our progress.

    lucid I hope that you're able to fix or provide a workaround for this issue, thanks in advance!

    My test to override the pistol animation and set the angle to mouse pointer position.

    Edit: I'm using the latest version and ignored the error messages since the older version is returning a JS error while previewing.

  • Problem Description

    Using the mouse plugin condition Cursor is over... with a family selected as the object.

    There is a noticeable strange behavior where sometimes multiple sprites from the family get picked,

    even though none of them are currently hovered over. (Screenshot | The pink marker is my mouse pointer)

    Attach a Capx

    Download the capx there.

    Description of Capx

    Includes both, the "expected behavior" where all conditions are split up and

    the "bugged behavior" where the detection using a family is acting weird.

    Steps to Reproduce Bug

    • Open the capx and enter the preview with any browser
    • Slowly hover from left to right and stop over a sprite (might take some tries )
    • Notice that multiple sprites are picked

    Observed Result

    Multiple sprites are registered even though the mouse is currently not hovering over those.

    Expected Result

    Using the "Cursor is over..." condition with a family should pick the correct sprites just

    like the "expected behavior" method does.

    Affected Browsers

    • All Browsers are affected

    Operating System and Service Pack

    Windows 7 with latest updates and up to date drivers.

    Construct 2 Version ID

    Newest release r240 Steam release. [Personal Edition]

  • Thanks a lot Kyatric!

  • Updated the Roundup with the following change(s):

    • Easy Way To Modify "Chromium-Args"
    • How To: Set Your Own Application Icon
    • How To: Fix Unusual NW.js MacOSX Exporting Size

    Thanks for your suggestions, keep'em coming!

    Someone should change the topic of this post: I suggest Construct 3- no news at all.

    Great, that salt will go well with the french fries that I've just ordered.

    Seriously though, one look at page #1 will give you all the news you need to know right now.

    At this point you just have to be like I am about my order, excited but patient.

  • Try Construct 3

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

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

    • Topic Overview

      Table Of Contents

      Getting Started

      • Installing & Updating
      • The Use Of Custom Builds

      Main Structure

      • Important Files & File Paths
      • How To: Modify The Package Manifest Files
      • How To: Add Chromium-Args In The Package Manifest Files

      Bugfixes & Workarounds

      • How To: Workaround Steam Overlay Not Refreshing
      • How To: Workaround Steam Overlay Not Appearing
      • How To: Workaround Steam Overlay Rendering Above Window Title Bar
      • How To: Workaround Steam Overlay Issues With Letterbox Scaling
      • How To: Workaround incorrect window size
      • How To: Workaround Game Canvas Not Rendering At All
      • How To: Workaround Media Keys Affecting Music Playback

      Custom Features & Debugging Tools

      • How To: Speed Up The Startup Time Of Your Game
      • How To: Set Your Own Application Icon
      • How To: Hide/Prevent Chrome Devtools For The End-User
      • How To: Test Your Game On Higher Framerates Than 60FPS
      • How To: Use The Built-in NW.js FPS Counter
      • How To: Modify/Remove Right-Click Context Menus
      • How To: Fetch & Make Use Of Command-line Arguments
      • How To: Force GC To Instantly Unload Audio From Memory

      References

      • Helpful Links
      • External Bugreports
    • NW.js - Basics

      Getting Started

      Installing & Updating

      All NWjs related files can be downloaded from THIS website. The installer will do the job for you and install all the necessary files and runtime components you need.

      The Use Of Custom Builds

      If you don't want to wait for the latest stable NWjs installer or would like to test out the latest experimental builds of NWjs, you also have the option to visit THIS website and do everything on your own.

      Main Structure

      Important Files & File Paths

      • NWjsForC2 Source Folder (C:\Program Files\NWjsForC2):

      Here you can find all the base files that C2 uses for the export. This is also the path where you have to paste in any custom builds if you decided to use them.

      • C2 Folder For NWjs Files (...\Construct2\Construct2-Win...\exporters\html5\nwjs):

      This path holds important ".json" files and usually 2 folders "win32" and "win64" with images inside.

      • "package.json" & "package-win.json" (...\Construct2\Construct2-Win...\exporters\html5\nwjs):

      These json files contain important commands that the exported version of NWjs can make use of. It's recommened not to add any debugging related "Chromium-Args" in those files.

      • "package-preview.json" (...\Construct2\Construct2-Win...\exporters\html5\nwjs):

      This json manifest for NWjs is only being used while previewing your games inside Construct 2. It's recommended to add all the debugging related "Chromium-Args" in this file only.

      How To: Modify The Package Manifest Files

      A common misconception is that you're required to edit the package manifest files for each export but that's not the case! Since Construct 2 is just copying the package.json files, it's easier to directly edit the source files.

      How To: Add Chromium-Args In The Package Manifest Files

      The majority of features or bugfixes found in this topic will require chromium-args (command-line arguments) to be added to the package manifest files.

      Steps To Add Chromium-Args To Package.json File(s):

      1. Open the "package.json" file(s)
      2. Find the "chromium-args" property
      3. Add a Chromium-Arg with 1 empty space in between other args (Example ➚)
    • NW.js - Workarounds

      Bugfixes & Workarounds

      How To: Workaround Steam Overlay Not Refreshing

      The Steam Overlay feels unresponsive, fails to refresh displayed content correctly.

      Steps To Add/Fix/Workaround:

      1. Add a small 2x2 sprite into one of your layouts (e.g. loader layout)
      2. Add a movement behavior like rotate
      3. Set the sprite opacity to 0% and make it global

      How To: Workaround Steam Overlay Not Appearing

      The Steam Overlay doesn't appear at all or certain features aren't working.

      Steps To Add/Fix/Workaround:

      1. Open the "package.json" file(s)
      2. Add --in-process-gpu to the "chromium-args" properties

      How To: Workaround Steam Overlay Rendering Above Window Title Bar

      The Steam Overlay renders above the window title bar on Windows 10.

      Steps To Add/Fix/Workaround:

      1. Open the "package.json" file(s)
      2. Add --disable-windows10-custom-titlebar to the "chromium-args" properties

      How To: Workaround Steam Overlay Issues With Letterbox Scaling

      The Steam Overlay doesn't scale correctly on games with letterbox scaling enabled. Black bars around the game canvas glitch out, still display the Overlay.

      Steps To Add/Fix/Workaround:

      1. Download and install THIS plugin
      2. Use action "Activate constant redraw" once (e.g. inside the loader layout)

      How To: Workaround incorrect window size

      NWjs doesn't start with the correct window size, often resulting in unexpected letterboxing.

      Steps To Add/Fix/Workaround:

      1. Add the browser plugin to your project
      2. Select an event which only triggers once (e.g. inside the loader layout)
      3. Add the browser action execute javascript
      4. Execute the following code:

      Construct 2:

      "if (!(this.runtime.firstInFullscreen || window['innerWidth'] === this.runtime.original_width && window['innerHeight'] === this.runtime.original_height))
      {
       var dh = Math.floor(this.runtime.original_height - window['innerHeight']);
       var dw = Math.floor(this.runtime.original_width - window['innerWidth']);
      
       window['resizeBy'](dw, dh);
       console.log('Resized window by w: ' + dw + ', h: ' + dh);
      }
      else
      {
       console.log('No window resize was required!');
      }"

      Construct 3:

      "var cm = this._runtime._canvasManager;
      var rt = this._runtime;
      if (!(cm.IsDocumentFullscreen() || cm._windowInnerWidth === rt._originalViewportWidth && cm._windowInnerHeight === rt._originalViewportHeight))
      {
       var dh = Math.floor(rt._originalViewportHeight - window['innerHeight']);
       var dw = Math.floor(rt._originalViewportWidth - window['innerWidth']);
      
       window['resizeBy'](dw, dh);
       console.log('Resized window by w: ' + dw + ', h: ' + dh);
      }
      else
      {
       console.log('No window resize was required!');
      }"

      (Code provided by Colludium.)

      How To: Workaround Game Canvas Not Rendering At All

      The game starts and runs fine but the canvas is black.

      Steps To Add/Fix/Workaround:

      1. Open the "package.json" file(s)
      2. Add --disable-direct-composition to the "chromium-args" properties

      How To: Workaround Media Keys Affecting Music Playback

      Some keyboards have media keys (e.g. play/pause), that can affect music playback.

      Steps To Add/Fix/Workaround:

      1. Open the "package.json" file(s)
      2. Add --disable-features=HardwareMediaKeyHandling to the "chromium-args" properties
    • NW.js - Features

      Custom Features & Debugging Tools

      How To: Speed Up The Startup Time Of Your Game

      The game takes a long time to start up. The "package.nw" file is very large and contains a lot of assets.

      Steps To Add/Fix/Workaround:

      1. Go to your exported Win32/Win64 folder(s)
      2. Rename "package.nw" to "package.zip" and unzip it
      3. Rename the unzipped folder to "package.nw" and remove all the old files

      How To: Set Your Own Application Icon

      The game is using the default NWjs icon as the app icon.

      Steps To Add/Fix/Workaround:

      Windows only:

      1. Convert PNG to ICO using an Online Converter [16-128px; 32bits]
      2. Start ResHack
      3. Open the nw.exe file(s)
      4. Right-click on "Icon Group" and "Replace Icon"
      5. Select and replace the application icon(s)
      6. Save and remove any backup/original files if needed

      MacOSX only:

      1. Convert PNG to ICNS using an Online Converter [128px]
      2. Paste your new icon into *.app/Contents/Resources

      How To: Hide/Prevent Chrome Devtools For The End-User

      Dev-tools can be accessed by pressing "F12". Users can also access dev-tools in right click menu's or similar.

      Steps To Add/Fix/Workaround:

      Prevent most ways to access dev-tools:

      • Add --disable-devtools to the "chromium-args" properties

      Completly remove dev-tools access:

      • Install the custom "Normal" build from the NWjs downloads website

      How To: Test Your Game On Higher Framerates Than 60FPS

      The game runs at a higher framerate than 60fps. The user's monitor runs at more than 60hz. Noticeable bugs for certain behaviors or game mechanics without dt (delta-time) in use.

      Steps To Add/Fix/Workaround:

      Bugfix for game eventing:

      Testing on higher framerates:

      1. Open the "package.json" file(s)
      2. Add --disable-gpu-vsync --disable-frame-rate-limit to the "chromium-args" properties

      Limiting the framerate (might not work with NWjs v0.33.0+):

      1. Open the "package.json" file(s)
      2. Add --limit-fps=X to the "chromium-args" properties (e.g. --limit-fps=144)

      How To: Use The Built-in NW.js FPS Counter

      Too lazy to add a simple FPS counter to the game.

      Steps To Add/Fix/Workaround:

      1. Open the "package.json" file(s)
      2. Add --show-fps-counter to the "chromium-args" properties

      How To: Modify/Remove Right-Click Context Menus

      Customized textboxes show a right-click menu, ruining the immersion of the game.

      Steps To Add/Fix/Workaround:

      Completly remove right-click menus:

      1. Add the browser plugin to your project
      2. Select an event which only triggers once (e.g. inside the loader layout)
      3. Add the browser action execute javascript
      4. Execute the following code:
      "document.addEventListener('contextmenu', function(e){e.preventDefault();}, false);"

      Leave "Cut", "Copy", "Paste" in right-click menus:

      1. Add the browser plugin to your project
      2. Select an event which only triggers once (e.g. inside the loader layout)
      3. Add the browser action execute javascript
      4. Execute the following code:
      "var gui=require('nw.gui'),menu=new gui.Menu;menu.append(new gui.MenuItem({label:'Cut',click:function(){document.execCommand('cut')}})),menu.append(new gui.MenuItem({label:'Copy',click:function(){document.execCommand('copy')}})),menu.append(new gui.MenuItem({label:'Paste',click:function(){document.execCommand('paste')}})),document.addEventListener('contextmenu',function(a){a.preventDefault(),(a.target instanceof HTMLInputElement||a.target instanceof HTMLTextAreaElement||a.target.isContentEditable)&&menu.popup(a.x,a.y)});"

      (Code provided by Colludium.)

      How To: Fetch & Make Use Of Command-line Arguments

      The NWjs plugin can't fetch and make use of any command-line arguments.

      Steps To Add/Fix/Workaround:

      1. DOWNLOAD the example project
      2. Define the command-line argument (use the global variable)

      (Example provided by armaldio.)

      How To: Force GC To Instantly Unload Audio From Memory

      Garbage Collector is not doing the job and bloats memory usage.

      Steps To Add/Fix/Workaround:

      1. Open the "package.json" file(s)
      2. Add --js-flags=--expose-gc to the "chromium-args" properties
      3. Execute the following JS code using the browser plugin:
      "global.gc();"
    • NW.js - Archive

      References

      Useful Links

      External Bugreports

      • NW.js [v0.14.0rc1 - v0.19.0]: Critical Screen Flickering Bug (Open Link ➚)
      • NW.js [v0.17.5 - v0.43.0]: Window Size Bug (Open Link ➚)
      • NW.js [v0.18.1 - v0.18.4]: Gamepad API not working on Windows 10 (Open Link ➚)
      • NW.js [v0.19.0 - v0.28.0]: Mouse Pointer Problem When Right-Clicking (Open Link ➚)
      • NW.js [v0.22.0 - v0.26.0]: "--in-process-gpu" Causes Severe Problems With Application Instancing (Open Link ➚)
      • NW.js [v0.27.0 - v0.27.1]: Regression in 0.27 user agent handling breaks Construct 2 content (Open Link ➚)
      • NW.js [v0.29.0 - v0.32.0]: Custom cursor CSS not preserved in window (Open Link ➚)
      • NW.js [v0.29.0 - Before C2 r256]: passing --disable-software-rasterizer appears to disable hardware acceleration (Open Link ➚)
      • NW.js [v0.30.0 - v0.31.5]: Video Media Playback Causes Apphang/Appcrash (Open Link ➚)
      • NW.js [v0.33.0]: Gamepad API stopped working as of NW.js 0.33 (Open Link ➚)
      • NW.js [v0.41.0 - v0.42.0]: Slow Startup Performance Regression (Open Link ➚)
      • NW.js [v0.42.4 - v0.43.1]: --disable-devtools Chromium-Arg Stopped Working (Open Link ➚)
      • NW.js [v0.43.1 - v0.43.3]: [NW2] Regression in window sizing (Open Link ➚)
      • NW.js [v0.43.1 - v0.43.3]: NW2: Users can manually zoom using ALT/CTRL + Mousewheel (Open Link ➚)
      • NW.js [v0.44.0 - v0.46.0]: Window bar app icon is low quality again (Open Link ➚)
      • NW.js [v0.46.0 - ?]: Non-resizable windows don't fullscreen properly (Open Link ➚)
      • NW.js [v0.47.2 - ?]: Windows chromium-args 260 character limit (Open Link ➚)
      • NW.js [v0.50.0 - ?]: win.requestAttention() doesn't work (Open Link ➚)
      • NW.js [v0.50.0 - ?]: nwsaveas input does not trigger oncancel (Open Link ➚)