Performance Tips

Hi,

I need to increase the performance of the game I’m currently working on. I’ve searched this forum and read the performance tips session (http://developer.anscamobile.com/content/performance-and-optimization). But, I’m still in the dark.

My first question: Is there any profiler tool available?
Second: I’m using lots of transitions and timers - it’s a game! :slight_smile: - and saw some people recommending to avoid such features as they may decrease the game performance.

What’s the overhead of using a timer or transition compared to “rewriting the wheel” and implement these features in the enterFrame function?

I’m sure a lot of people had and have performance problems. What were the bottlenecks? Does someone have any tip on where to start? What are the most intensive tasks?

Thanks in advance! [import]uid: 96891 topic_id: 17423 reply_id: 317423[/import]

One tip from what I’ve discovered… The first time your app runs, save high overhead config and calculation data that does not change to a file and reference it on reuse.

Also calculations with a lot of overhead or recalculated over and again, the results can be saved to a variable for reuse. An example of this is calculating screen coordinates an inter-model values like offsets that are frequently referenced in formulas.

Love to hear other ideas as well beyond what is in the performance link above.

-David [import]uid: 96411 topic_id: 17423 reply_id: 66046[/import]

Hello Pedro,

We have made a profiler tool that is exactly what you are looking for! Please visit our website for a demonstration.
http://www.mydevelopersgames.com/site/
Essentially profiler allows you to see visually where performance bottlenecks are (down to the exact line of code.) If you would like to send us a sample of your code we would be glad to send you a profiler report as a sample.

Thanks,
M.Y. Developers [import]uid: 55057 topic_id: 17423 reply_id: 89130[/import]

timers are not as effective as frame based calculations. For best results always go with frames, though I know that transitions are times based, I think this is for easier easing calculations as a start and end time is needed???

My approach is to use frame based animation with my own classes and use delta time technique to smooth out any frame rate changes. e.g. I work out the time between the last frame and new one with this time I add into the calculation of the updates of my x and y points. This addition will keep all movement in ratio to where the object should be in time, if using a timer and frames slow down the object doesn’t move to where it should be it just moves slowly .

I think the above is right.

rough idea:

[code]
function moveObjects(event)

local tDelta = event.time - tPrevious
tPrevious = event.time

h = balloon:move(tDelta)
end

–balloon object

local newSpeed = speed * tDelta
originX = originX + (cosIt(angle) * newSpeed) – update x pos in relation to angle
originY = originY + (sinIt(angle) * newSpeed) – update y pos in relation to angle
[/code] [import]uid: 118379 topic_id: 17423 reply_id: 89133[/import]

Hi,

I started this thread and bought the Profiler mentioned above.
I’ve implemented critical optimizations and strongly recommend this tool. [import]uid: 96891 topic_id: 17423 reply_id: 89138[/import]

yeah, profiler is not bad. It crashes on my bigger projects sometimes. [import]uid: 118379 topic_id: 17423 reply_id: 89147[/import]

Hello Beloudest,

It would help us a lot if you could give us a sample project where you have this problem. That way we can fix the issue for everyone.
Please send us a zip with your project at
mydevelopergames@gmail.com

Thanks,
M.Y. Developers
[import]uid: 55057 topic_id: 17423 reply_id: 89180[/import]

Be happy to, its mid development so theres a good chance its my code yet it seems mode 1 works fine but all others struggle , especially 4 which has never worked for me. I still use mode 1 all the time, its does work well and i still recommend.

As a suggestion it would be great if there was documentation on what to look out for, and examples of where improvements had been made using performance tips.

Will send you an example to check out. [import]uid: 118379 topic_id: 17423 reply_id: 89284[/import]