Performance Problems

Hi,

Every now and then my app has performance problems.  It’s quite rare on my new galaxy mini, but I presume it would happen more often on older devices.

It seems to be quite random, so I doubt it’s in my code, it’s probably just a matter of the phone busy doing something.  Or maybe it’s java doing some garbage collection?

My app is a cricket game, so when it happens, the ball doesn’t travel smoothly, it gets jerky, going fast/slow/fast, etc, I’m sure you know what I mean.

I’ve read the article and tutorial about delta time and changing frame rates:

http://www.coronalabs.com/blog/2013/06/18/guest-tutorial-delta-time-in-corona/

But I don’t think it’s going to solve my problem.  In cricket, when the ball is bowled down the pitch, if the ball hits the batter then he can be given out LBW.  But there are certain rules, for instance if the ball bounces on one side of the batter, then he can’t be out LBW even if the ball was going to hit the stumps.  The key point is, I need to know the exact x,y co-ordinates of where the ball bounces.  In my game there’s a ball and a shadow travelling down the pitch, and where they meet is the point where the ball bounces.   If the game starts getting jerky near this point, then adjusting the ball/shadow movement for a changing frame rate might mean we skip over the ball bouncing. 

Any suggestions for overcoming a problem like this?  Does it sound like I just need to put up with the game being a bit jerky if the phone is busy?  Do other apps put up with this and is it noticeable in any popular apps?  Any thoughts much appreciated.

thanks

There’s a lot of ways to deal with various performance issues, including frame rate / stutter of course.

Although there’s a ton of things you might be able to do for your particular sequence, such as pre-loading everything before the pitch, not changing size, scale, position of other things while the critical animation is occurring, etc… But even that doesn’t guarantee the frame of the bounce would be shown…

There is one strategic thing you can do to force the bounce to display though (or show other critical points in the sequence)…

Instead of your sequence being two transitions (ball and shadow transition from start to end), it is 4 transitions / sequences ( Ball and shadow transitions to bounce point, followed by ball and shadow transition to end point).

This will cause your transition complete code to be hit at the instant of the bounce (between onscreen frames), and you can show whatever you want / insert a one frame delay (to ensure the bounce is visible).

I hope that makes sense. Best wishes.

There’s a lot of ways to deal with various performance issues, including frame rate / stutter of course.

Although there’s a ton of things you might be able to do for your particular sequence, such as pre-loading everything before the pitch, not changing size, scale, position of other things while the critical animation is occurring, etc… But even that doesn’t guarantee the frame of the bounce would be shown…

There is one strategic thing you can do to force the bounce to display though (or show other critical points in the sequence)…

Instead of your sequence being two transitions (ball and shadow transition from start to end), it is 4 transitions / sequences ( Ball and shadow transitions to bounce point, followed by ball and shadow transition to end point).

This will cause your transition complete code to be hit at the instant of the bounce (between onscreen frames), and you can show whatever you want / insert a one frame delay (to ensure the bounce is visible).

I hope that makes sense. Best wishes.