TetroniMike's Forum Posts

  • Correct, I tested in both Firefox and Chrome, and this only happens in NWJS.

  • TLDR; in NWJS, when playing the same set of sounds over and over again over a period of time, used memory will increase (potentially infinitely) until it affects performance.

    The following pertains to EXE's exported with NWJS from Construct 2. C2 and NWJS are updated to the latest versions.

    When playing audio, it appears that some sounds get "stuck" in memory and stack up over time. After a long time in a complex game with lots of audio, this results in slowing down the framerate.

    I've tested with sound files that are (A) stored in the exe, and (B) stored externally. For external audio, you can use Audio - Unload All to bring memory and framerate back to normal, but using Audio - Unload by name for each sound file does not help.

    I've created a test capx with internal sound files and buttons which manually preload and unload external sound files. There are two buttons which toggle randomly playing these sounds extremely rapidly. One only plays internal sounds, the other only plays external sounds.

    In the following tests I took note of the Memory in MB via Windows Task Manager. There are inconsistencies sometimes when running these tests, but my findings in general are listed below:

    1) CONTROL - Run the EXE and do nothing for 5 minutes.

    Results: Memory starts at 75mb, after 5 minutes memory ends up at 73mb.

    2) Run the EXE, Preload external sounds, Play external sounds rapidly for 5 minutes.

    Results: Memory starts at 72mb, after 5 minutes memory ends up at 92mb.

    Addl notes: Unloading sounds manually (by name) does not decrease memory usage. Unloading ALL sounds DOES decrease memory usage.

    3) Run the EXE, Play internal sounds rapidly for 5 minutes.

    Results: Memory starts at 72mb, after 5 minutes memory ends up at 94mb.

    Addl notes: Unload Sounds (by name) and Unload All Sounds both have no effect on memory.

    Letting the test run longer than 5 minutes shows the memory increase further, I did not see a maximum in my testing.

    This seems minor when looking at this small test EXE, but with a big project with hundreds of sounds effects and music, this becomes a problem where memory can increase in the hundreds of megabytes over 10 minutes of play and negatively affect framerate. In my actual game, memory increased from 200mb to 2200mb over the course of 20 minutes of play, and framerate dropped to 30fps. Using Unload All Sounds fixes the problem temporarily, but I cannot use that during normal play for game audio quality reasons, and Unload Sounds (by name) has no beneficial effect to memory or framerate.

    Capx and audio files:

    drive.google.com/file/d/1iGf_hWjeu6EfqG3XIihX7dJycuROU71_/view

    Put the audio files in a folder titled "data" in the same folder as the exported EXE. Let me know if you have any questions, and thank you for your time.

    Edit: I did some additional testing. It appears that if you Preload external sounds, toggle them on for a few minutes until memory increases noticeably, then toggle the sounds OFF and wait a few seconds, then neither of the Unload commands do anything for the memory. So it appears that the Unload commands only affect currently playing sound files?

    Note: If you'd like to more quickly see results in your test, add "Repeat x times" to the code as shown in this linked image:

    drive.google.com/file/d/1wCN1RGmTJJ-wyAY9le1WU49ipEByRr5p/view

  • Not holding my breath for an answer, I know this is a really niche thing to need, but *bump*

  • There doesn't seem to be any "voices" available in an exported NWjs Linux application, therefore Text to Speech does not work. Any ideas?

    Note: I tested the exported application in Ubuntu 16.04.3.

  • Saw this in my F12 console while testing my game in NW.js... I have very little idea what this means, other than something in the Audio plugin will no longer be supported very soon. Is this something we need to worry about?

    [Deprecation] GainNode.gain.value setter smoothing is deprecated and will be removed in M64, around January 2018. Please use setTargetAtTime() instead if smoothing is needed. See https://www.chromestatus.com/features/5287995770929152 for more details.
    C2AudioInstance.play @ Audio_plugin.js:1689[/code:34mv4s0j]
  • Copied the Video plugin and modified it to be able to return width/height, I'll share it with the forums at some point

  • TLDR; I need to get the pixel width and height of video files.

    My game will have multiple video files of different sizes. I'd like to resize the Video object to match the pixel dimensions of the video that is playing, but it doesn't seem to have a way to get the loaded video file's width and height. Any way I can get this information?

    Thanks

  • NN81: If I did that I'd have to copy the code for each of the three families, instead of one single loop

    dop2000: That's not a bad idea! I think I might be able to use it as a starting point. Thank you!

  • Is there any way to loop through object types in a family? i.e. lets say I have a family, "Objects", with the following sprites: A, B, and C. I have 3 of A, 10 of B, and 1 of C.

    Objects

    A (x3)

    B (x10)

    C (x1)

    I'd like to run a loop on the Family "Objects" that for each object type, picks those instances and does something. If I run a normal For Each, it would loop 31 times. I'd like to find a way to loop 3 times, pick all of each object type - A, B, and C, one per loop - and does something to those objects.

    Possible?

  • Sorry to bring this back from the dead, but I am also hoping to have a selection of languages in our game and need more than the default TTS voice... is there any way to get additional TTS voices in NWJS?

  • Right, and both of what I mentioned above were file paths. One loaded a text file saved locally into a text object, the other loaded an image saved locally into a sprite. The former did not need the file:/ prefix, the latter did need it.

    I suppose there might be a better way to load in a local text file than using NWjs.ReadFile that I am not aware of?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Thanks Ashley, I did some tests in Ubuntu today and it looks like loading a text file via NWjs.ReadFile works fine without the "file:" prefix, but loading images into a Sprite via Load image from... requires prefix "file:/" (with just the single forward-slash). Will the next build make this consistent between the two objects, so I can just make a single "AppPath" text variable to use for all file loading?

  • Yeah file dropping is what I've settled on for now too, thanks

  • Sorry to bring this back from the dead, but Colludium, did you ever get this to work?

  • Silly question... where would I find the runtime.js for the Sprite and SpriteFont objects?