[r228] Jadder/Stuttering/frame drops with platform behavior

0 favourites
From the Asset Store
Selection frame like in RTS games, works both on mobile and desktop devices.
  • Problem Description

    No metter how few instances and objects are on scene, if there is at least one with active platform behavior, engine makes so many drawcalls, that force CPU to drop some FPS'es

    Attach a Capx

    https://drive.google.com/file/d/0B57pu5 ... ZqY2s/view

    Description of Capx

    .capx has as few as possible objects, and only thing you should do is to switch on and off platform behavior and look at the profiler to see what is going on.

    Steps to Reproduce Bug

    • Run project with debug mode and switch view to profiler
    • With spacebar You can disable and enable platform behavior of pink block

    Observed Result

    In my case, switching pink block's platform behavior on makes much more drawcalls - and it's a small project. In my final game, drawcalls cause like my CPU run at 75%, where drawcalls are +50%

    Expected Result

    no such FPS drops

    Affected Browsers

    • Chrome: (YES)
    • FireFox: (YES)
    • Internet Explorer: (YES)

    Operating System and Service Pack

    • Windows 8.1
    • Windows 10

    Construct 2 Version ID

    R228

  • This is interesting - I can reproduce this, although I don't get the same dramatic cpu numbers you describe. According to the profiler, I get:

    With platform Disabled:

    • Engine 0.5%
    • Draw 0.1%

    With platform Enabled:

    • Engine 1.3% (increase seems reasonable....)
    • Draw 2.1% (20 x the draw call demanded above...?...)
  • Colludium Probably those things (usage caused by engine and drawcalls) are related some way. Frame drops are not so dramatic in example above, but in final project, where platform behavior in use with many objects, this problem is kind of "deal braker".

    In my case, according to the profiler, in this example I get:

    With platform Disabled:

    • Engine 0.9%
    • Draw 0.2%

    With platform Enabled:

    • Engine 2.3%
    • Draw 4.1% ( also 20x )

    First I thought it could be my PC fault. I made some tests on other machines with different configurations- example was reproduced.

    After short investigation, I discovered that platform behavior file is in bad condition- many comments and some unnecessary code- maybe there's problem.

    I tried to get some info about this:

    with no effect.

  • Affected Browsers

    Edge (YES)

    engine 1.4-2.6%

    draw 2 - 6%

    System: W10-64, i3-5010U

  • With Chrome, Windows 7 64Bit, C2 R221:

    0.1% engine

    0.1% draw

    no difference between enabled or disabled.

  • Re-created the CapX in C2 R192 (original crashed upon downgrade):

    -Google Chrome on Windows 10 64bit

    -Enabled: 0.7% to 1.5% engine, and 1.7% to 2.9% draw calls

    -Disabled: 0.5% engine, and 0.1% draw calls

    Capx for R192: https://dl.dropboxusercontent.com/u/471 ... st192.capx

  • Try Construct 3

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

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

    I can confirm that with FireFox

    -Disabled: 0.4% - 0.5% engine, and 0.1% to 0.2% draw calls; CPU-Utilization 0%

    -Enabled: 1,6% - 1.7% engine , and 2,6% - 2.7% draw calls;CPU-Utilization 4%-5%

    with chrome the profile in the debug-inspector seems not to work correctly it doesn't update. The CPU-Utilization seems to be correct and this is still 0.1%-0.2%

  • The draw calls increasing when the platform behavior is enabled is expected. Basically if nothing visual (position, animation, angle...etc) is changed then C2 doesn't redraw the canvas, so the draw calls will be lower.

  • R0J0hound but what if the object is not changing? They are testing with a static object with platform that can be disabled or enabled with spacebar, and is immobile while measuring where the CPU usage is.

    I would expect that there be no draw calls if the platform object is not moving even if platform is enabled. This is not the case.

    There could be a legitimate reason, I understand, but currently the only variable here while testing is whether or not the platform behavior is enabled or disabled, and that's where the confusion is, I think.

  • Yes, cpu usage increasing when the platform behavior is enabled is truly expected and undeniably. My point is close to DatapawWolf opinion- what about idle? In my opinion, this situation is more about this behavior runtime file, but for now I couldn't find any other reason, so that is my only clue. I already tried to disable different configuration of modules in my final project, and after many includes enabled and disabled, I have found that something is wrong with this particular behavior.

    I tried to compare exported c2runtime.js files from R192 and R228 - differences are big from end of 2014 and now. Thanks to WinMerge program, I found difference with old and new platform code, but it is not very spectacular- current version include this code inside of cr.behaviors.Platform function:

    behinstProto.onWindowBlur = function ()

    {

    this.leftkey = false;

    this.rightkey = false;

    this.jumpkey = false;

    };

    With my luck, it's probably not related to the problem..

  • DatapawWolf

    In general any movement behavior that isn't disabled will set a Boolean in the runtime to tell it to redraw. I doubt the platform behavior is checking to see if the position has changed first. Even so that's a pointless optimization since if the behavior is enabled things should be moving.

    stachir

    You could replace the platform behavior with any other movement behavior and get similar results with the draw calls. Also that bit of code just makes those buttons not pressed when the game loses focus.

    Maybe look instead at the collision checks in the debugger with the platform behavior. As I recall there has been discussions about the number of them the behavior uses. Whether that's the cause of the cpu usage in your project I don't know, but if the highest usage is draw calls then it's more likely visual stuff like the number of things being drawn on screen, number of layers, effects,...etc.

  • With platform disabled: collision checks per sec = 0 (of course)

    With platform enabled and player does not move: collision checks per sec = 100-110 (sure)

    With platform enabled and player moves: collision checks per sec = 400-500 (yea, why not)

    R0J0hound

    Ok, I get that all things metter- layers, number of objects and instances, effects and so on, I understand that. And maybe that is not direct impact of C2. I just would like to know, why my laptop makes frame drops running project with one layer, four objects and no effects.

    With that simple project I got 60fps with disabled and 55fps with enabled platform bahavior and player stand still. Nothing much? Really? It's so simple, that such situation should hove no place at all.

  • In the debugger, check to see if your laptop is rendering using webgl or canvas2d. If the latter then your graphics driver is not supported.

  • Colludium - it's webgl

    I also checked template projects (like platformer temlate), and there I also noticed frame drops. Also I found that, every 1-3 seconds, there is something like 'freezing' - objects that moving stops for a microsecond and appear/'jump' in next frame in another place. I start to believe that something can be wrong with my computer, so I checked on other machine, and there is the same situation.

  • I have only 2 responses left - either:

    ! or

    !

    Seriously, though, if you're not using Chrome, nw.js or Edge then you need to upgrade... Turn off all other programs on your computer - if you're running Unity, Blender or have 30 tabs of GIMP open then that could be the cause of your trouble. If not, try pressing f12 in Chrome and record some timeline to see what might be causing your frame drops. If none of that works, you could post a capx of your test for others to try...

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