NW.js 13 Alpha 7 Stuttering and Vsync replaced with lagspike

0 favourites
  • 9 posts
From the Asset Store
Is a system for building scorecards and achievements online for use in games Using this system, you can create a scorebo
  • the new NW.js finally works with Klang, and oh boy does it work as advertised! Way smoother performance, and areas I felt needed optimizing now runs butter smooth. Don't seem to notice any lagspikes after prolonged play.

    HOWEVER... I keep getting the occational 100ms lagspike consistently. I can only guess this is due to the more aggressive garbage collection? I really love the fact that the game now won't turn into a slideshow after playing for too long, but these lagspikes will ruin the player's sense of rhythm. It's crucial that I find a way around this, or that the garbage collection becomes more flexible.

    I'm curious if anyone knows what's usually the biggest offenders with gathering garbage for construct games? Does continiously creating and destroying objects matter for instance? If I know what to look out for I can maybe work around it myself.

  • Don't think there's anything you can do about that yourself. I've got a new side project with little more than a player w/ platform behavior and some tilemaps and I'm still getting jank.

  • If the layout remains the same, it should not have occasional lagspikes. Basically the asset loaded will remain in memory until layout change.

    I've noticed upon layout change, ~5 to 10 seconds, gc kicks in, there's a small stutter as memory is cleaned of un-used assets.

    What I also do is have a function that calls regularly used explosions, sprites particles etc off the screen on start of layout, this acts as a "pre-load" mechanic by putting them into memory first, so when they are used and called, they won't cause loading stutter.

    Because this is the way gc works you have to design your game around it. Basically any big sprites should be called on start of layout (then destroyed if its not needed right then).

  • That's actually what I've been doin all this time. I would suffer from that issue from day one if I wasn't.

    Did some more testing. This time on my laptop. The results were interesting to say the least.

    The first thing is that I couldn't get the game to boot choosing the nVidia GPU (630m) even with the latest driver installed. This used to work before on NW 12.

    Running the game on the intergrated card worked fine though. However the loading times was greatly increased. in-game videos wouldn't play properly etc. I noticed lagspikes even where I'm 100% certain there ain't any new items loading in. When I played long enough though things started to change. When playing for long enough for the stutter to kick in on NW 12, I now experienced that everything ran smooth, way less lagspikes, and no loading issues. The videos that previously didn't play properly now worked as intended etc.

    I really hate not being in control or having any insight about what's going on behind the scenes while the game's running...

  • I think it may be due to the sound as well. This alpha does not preload audio if you set the project properties to preload. It also ignores the Audio event to preload.

    How I got around it in my game was made a trigger to call the sound fx I need, by playing them staggered after on start of layout, but at -50 or -100 decibels so you can't hear it, but it plays and loaded into memory. So the subsequent plays won't stutter for that layout.

  • Tinimations how are you measuring this 100ms lag? and when you say lag, do you really mean jank?

    do you think the jank has to do with suddenly turning groups to active? I have experienced this jank and it's usually when a new enemy appears in my game. I have the enemy AI in groups that are disabled and only enabled after I create the enemy during a random encounter. I always get a BIG jank right when they are created. All my player and enemy sprites are on the layout and destroyed OnStart Of Layout.. so I know they are in memory so it's not that. (However I know the object loading jank you speak of but this is not that).

    The fact that NW13.a7 doesn't preload sounds is a bit troubling... I assume it's still being worked on? are you deploying to Steam with NW13 a7? when the alpha become an actual version will you then update your game?

  • jobel

    It works so I've deployed it, got lots of beta players on it already no issues. I have no choice really because my game is too big for NW 0.12 and even 0.10.5 with their memory leak issues (a known bug with older Chromiums).

    Also, I haven't used the group disable/enable feature so I don't know if its the cause. I just know about the audio preload not working, which CAN and DOES cause stutter in my game unless its pre-loaded manually.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • jobel I don't measure it. It's a rough estimate. This is that kind of lagspike where everything stops, even the sound.

    That makes sense, though I do get spikes as well even when there's no new sound being loaded or played. Unless this loading is super delayed and slow, I don't think this really is the problem.

  • 100ms is an extraordinarily long jank, suggestive of some kind of fault rather than GC. Usually a GC pause means at most a dropped frame or two (16-32ms jank), and it should be especially unlikely to jank given Google's recent work on improving the GC so it only runs in the idle time at the end of a frame.

    Also, are you seeing the same result in the Chrome browser? Both alpha7 and Chrome stable are now on v47, so it's very useful to check that to identify if the problem is in the Chromium engine, or a result of some modification of NW.js.

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