Optimization and memory leaks

0 favourites
  • 10 posts
From the Asset Store
Memory game, with 10 levels for you to have fun. Made in Construct3, template available for purchase.
  • Sorry for the many posts, especially questions..! But I need some guidance here. I'll try my best to contribute back to the community soon with some scirra exclusive graphics tutorials, but for now heres my question..

    My game works fine, quite fast on my computers at first, but in a matter of minutes (10-20mins) the game starts lagging quite badly and this happens even without touching the game.

    So I'm thinking its to do with some of my looping/timed events are causing memory leaks.

    All I can think of is if I'm creating objects and not clearing it but this shouldn't be the case as I've looked through it.. Are there any other good practices I should be following to ensure this doesn't happen?

    You can try my game HERE and tell me if it happens to you too.

    Thank you in advance!

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • The manual articles : Best practices and performance tips as well as this blog article about optimisation should be worth reading. (I recommend to actually read the whole manual at least once for anything C2 related)

    To help you though, it would be better if you would post the capx of your project, so we can check the code directly.

    Hard to say anything otherwise.

    Possibly as you say, loops creating objects when it shouldn't, but no code, no way to tell for sure.

    As far as memory leak goes it is unlikely, I've tried your project, and when I shut it down, I got back the same amount of RAM I had before launching it.

  • Thanks for ruining my computer


    Biggest Looping can cause memory leaks, also Physic can consume CPU a lot. I tried it game, i found no lag points.

    If you see the creating object with every ticks it can generate multiple objects in perfect position, make sure to use "trigger once" condition.

  • Hmm, but does it start lagging for you after awhile?

    I've uploaded the capx HERE :)

    Thanks for the offer :) would be awesome if you could help!

  • Joannesalfa Woah, thanks for that, I didn't even know the existance of that condition.. I've been using booleans to check if its been triggered before! haha!

    Also, I've just turned off pixel rounding, and though it has noticeable differences, it just sped up the game a lot!

  • The link you posted is not correct apparently.

  • I get progressively slower level to level, not really noticeable until level 6, then level 7 it starts to show little stutters in the fired sprite every second or so. At level 9 it was getting too slow to be fun. (which it is up until then.) I just read some of Ashley's post on Garbage collection yesterday, which I now wonder if I should have read more. because it seems like garbage collection could be a factor.

    found it: scirra.com/blog/76/how-to-write-low-garbage-real-time-javascript

  • The link you posted is not correct apparently.

    Opps! my bad, here it is


  • There should be nothing in the engine that could degrade performance over time, unless you are doing something like continually creating objects and not destroying them. That's then a problem with your events rather than any issue with the Construct 2 runtime.

    Try putting a text object on-screen with the object count and keep an eye on it - make sure it's not increasing constantly throughout the game.

  • Speaking of counts...

    Is it possible to introduce (or maybe it already exists) a statistics view in Construct 2 projects ? Like how many events/actions, instances (in layout), object declarations, etc, etc, in order to have a global vision I mean :)

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