Eek - slowdown!

Bugs will be moved here once resolved.

Post » Sun Nov 27, 2011 11:35 am

http://www.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?
B
16
S
5
G
1
Posts: 43
Reputation: 1,595

Post » Sun Nov 27, 2011 12:57 pm

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.
If your vision so exceeds your ability, then look to something closer.
Moderator
B
120
S
28
G
68
Posts: 4,840
Reputation: 48,281

Post » Sun Nov 27, 2011 10:32 pm

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: http://www.scirra.com/forum/plugin-data-structures-in-associative-lists_topic44044.html jumprock2011-11-27 22:33:56
B
16
S
5
G
1
Posts: 43
Reputation: 1,595

Post » Mon Nov 28, 2011 6:16 am

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
B
79
S
24
G
52
Posts: 4,725
Reputation: 39,713

Post » Mon Nov 28, 2011 7:18 am

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.
B
16
S
5
G
1
Posts: 43
Reputation: 1,595


Return to Closed bugs

Who is online

Users browsing this forum: Johncw87 and 1 guest