Skip/Laggy performance instead of slow/steady?

0 favourites
  • 9 posts
From the Asset Store
Firebase: Analytics, Dynamic Links, Remote Config, Performance, Crashlytics on Android, iOS & Web Browser
  • My game can fluctuate from 45-60fps during play on an ipad2 using CJS. When the fps does fluctuate, it doesn't just smoothly slow down the game, it kind of skips/lags a bit. A lot of my game is determined by bullet speed on several objects coming at the player, along with backgrounds.

    I'm trying to figure if there is a way to "smooth" out that slowness. In old arcade and NES games, when the screen got loaded with bad guys, the game would kind of slow down for a bit, is that possible in C2? Or do I just need to live with the jitterness or try to get the game running at 60fps consistently?

    I feel like I missing an obvious optimization step.

    My game is an infinite runner. Everything is moving towards the player. Backgrounds, boxes, tires, etc. If there is something I can look for, that would be great. I know I am not giving much to go off. Just imagine it as a bunch of different sized bullets constantly spawning off screen and heading towards the player .

  • That's just how C2 handles bad performance...it skips frames instead of slowing down which, unfortunately, can cause some major problems. I also would rather have slow down..it's what people expect.

    Maybe you can code it yourself using time scale?

  • Hmm, maybe checking if fps drops below, set time scale, etc. I could, but I also have a slow motion power up I would need to configure. Might be worth it, I guess I could try.

    Just not sure it will actually fix the issue.

  • ArcadEd

    Do you create / destroy object often ?

    I wonder if it's the garbage collector kicks in and causing the stutter because of that.

    If you did, I'd have a set number of objects and keep reusing it, instead of create / destroy.

    For example once the bullet go off screen, move the same bullet in the new position instead of destroying & spawning new bullet.

  • Hmm, that's in interesting idea. Yeah, they do destroy and create often, but it's all random, how many are on screen.

    I'll play around with some ideas, thanks.

  • Sometime ago I read some articles about smoothing dt to handle performance spikes.

    I made this test with two jumping objects and discovered that the one using smooth dt had a much more precise jump height than the one using normal dt.

    Here's the results:

    Normal Scenario

    Extreme Scenario

    • The orange object uses normal dt and the blue smooth dt.
    • The orange and blue lines at the top are the maximum height of the last jump.
    • The semi-transparent boxes around the lines indicate how much the jump height has drifted in the last jumps.

    Notice that the jump height of the object with smooth dt barely drift compared with the one using normal dt.

    What happens is that it creates some micro slow-downs or speed-ups on the object the more dt oscillates, that results in a more constant position increment.

    Maybe it can help solve your problem.

    I used a pretty naive smoothing, but there's better methods that take more frames into consideration and may give better results. The way I implemented doesn't work with behaviors, but I think it's possible to set the global timescale to (smoothDt/dt) and it will work with everything. Maybe you should give it a try.

    Here's the capx:

    [attachment=0:ym3jqwvc][/attachment:ym3jqwvc]

    *It uses the Canvas plugin.

    **For some reason it's not rendering the dt graph correctly in Firefox, but it works in Chrome.

  • Thanks for the info. I'll look over it.

    The problem does not happen on a samsung tablet, but I believe this tablet has more memory(RAM) and the fps never drops below 60.

    My game is using a lot of memory, debug shows it around 130mb during game time. Could be a factor.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I'm having a similar problem; the FPS fluctuates and when it gets bad some of my important events aren't triggered!

  • Animmaniac

    How would you use smoothDt/dt to control global time scale exactly? I've tried both 'Set time scale to 6 * (smoothDt/dt)', and just 'Set to smoothDt/dt'. All I get is a white screen

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