Engine usage increases over time in the debugger, potential causes?

0 favourites
  • 9 posts
From the Asset Store
An educational game for Times Table. An easy to use template for developers to build larger games
  • Hello, I've been going through my game optimizing a bunch of stuff and I've realized that if the game is left open for several hours, its engine usage ramps up drastically despite no change in the number of sprites on screen, effects, etc. I know that certain problems with code can affect the engine use but I'm unaware of what the vast majority of these are.

    Any tips or things to look out for? I'm at a loss as to what I need to do to fix this.

    Tagged:

  • It's also worth mentioning that this occurs even when the timescale is set to zero.

  • If the engine usage increases over time you’re doing something that does more over time. It would be a shot in the dark to guess what.

  • I was looking through potential causes and I noticed that a certain event sheet also used more CPU over time alongside the engine. I eventually managed to isolate it to this group:

    (As for why this causes an increase over time, I have no clue as neither arrays change in size. Disabling the audio actions is enough to fix it, so it isn't the conditions at least.)

    Yet even with this disabled, the engine cpu usage still increases over time. Reloading the layout resets the increase in engine cpu usage (as well as the increase caused by the event sheet).

    Also, the engine increase still occurs even when timescale is set to zero.

    Any ideas on fixing either the event sheet increase or engine increase would be much appreciated!

  • Is it in a loop? You’re using loopindex.

    Is the text you’re using token at with getting longer over time?

    I’m at a loss otherwise. I have only a passive interest in construct lately

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • No worries, you've been doing this for quite a while after all.

    Yes, it is in a loop but the loop does not increase in size. The text I'm using tokenat on is not increasing in length either.

    It is what it is, I'm sure I'll find a fix sooner or later.

    At the moment I'm trying to see if setting the volume of a tag with analyzer effects on it could be the cause, as the analyzing is engine stuff probably, and the volume change action could be getting harder and harder as the audio repeats itself maybe? I got no clue tbh.

  • Looking into it more and I think I have found more information about the causes.

    The event sheet increase ONLY occurs for positioned audio, using not positioned audio causes no increase over time. This might have to do with my custom audio system, I need to test stuff more.

    The engine increase occurs when I play an audio file that isn't looped but then play a file with a similar file name afterwards that IS looped, again I need to test more.

    If this rings anyone's bells about similar issues people have had in the past please let me know.

  • Amazing. Apparently unloading the previously played audio file was enough to fix it. No clue why or how but it does. Engine increase is fixed, now all that's left is the wacky audio event sheet stuff.

  • Now that I have fixed the issue I'll just explain what I think happened in case some random person down the line is still using this old and deprecated engine and magically ends up doing the same thing I did.

    There were three causes to an increase in CPU usage over time, all of which were unrelated to increasing object counts, array size, text size, larger loops, etc.

    1. Looping audio will cause an increase in CPU usage over time if there has previously been a non-looping audio played on that tag. This can be fixed by unloading the audio file for the non-looping audio.

    This will be put under the "Engine" category in the debugger.

    2. Setting the volume of an audio tag under the same conditions as the previous cause will also cause an increase in CPU usage over time.

    This will be put in the "Events" category in the debugger.

    3. The "Magicam" plugin will cause an increase in CPU usage each time it is told to follow an object it is already following. This is barely noticeable, but telling it to follow something every tick will build this up over time. This buildup is reset on a layout change, at least in the case of local cameras.

    This will be put under the "Engine" category in the debugger.

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