Eek - slowdown!

0 favourites
  • 5 posts
  • codeandvisual.com/test/construct_tnc/tnc.capx

    The game starts off at a nice 60fps but leave it for a few minutes and it heads down to 30fps and even further south. It seems to be accentuated when you go and collect some kittens.

    Can anyone point me to where the leak may be occuring?

  • I can't open your .capx as it's using a plugin (datastructs) that I don't know or have.

    One thing you could try is adding debug messages as in this thread which showed that a particular value was being written thousands of times, hence slowing everything down over time.

  • Thanks Zenox, I've tried to make sure I am destroying all unused objects. I've traced the total objects value as that post suggested and it's not showing any unwanted build up, total objects remains at 104 at it's highest value and that is consistant with what it should be (these objects are mostly array types with no information besides 5 or 6 text/number variables).

    Maybe it's something to do with the plug in I'm using: scirra.com/forum/plugin-data-structures-in-associative-lists_topic44044.html

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • The cause:

    The slowdown is due to the creating and destroying of Array objects. I was able to reproduce it in a simple capx that did just that and the fps degraded over time.

    The reason:

    I don't know really, maybe it's caused by object recycling, but that would be odd since that works flawlessly with sprites.

    A solution:

    You can redesign the algorithm you're using so that you don't have to create and destroy any objects at all.

    Here's my attempt at it using one DataStructures object. Only the heros movement is recorded and the allys are positioned at distances down the path.

    http://dl.dropbox.com/u/5426011/examples%208/jumprock.capx

    cheers

  • That's brilliant R0J0hound.

    It makes a lot of sense just to maintain the hero position. I was rebuilding my approach from Flash which was object oriented so made sense for each character to keep it's own lists. Even in Flash this would have had benefits though in that there would only be a single data source.

    Cheers, I was going to put Construct to the side for a while and see what developed but with the slow down issue solved for now I'll keep going with the port.

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