Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Adobe AIR Development

Reply
Contributor
Posts: 15
Registered: ‎02-05-2012
My Device: Playbook
My Carrier: Fido

Simple Game - Poor Performance

I am creating a very simple memory match game.

 

I am using flash builder 4.6, air 3.1, tweenlite, and vector graphics imported as swc files.

 

i have all of the logic in place, however i find the animation runs very slow.

 

I have coded a scrollable view port that runs extremely choppy on the device. in addition, simple animations that move the x/y coordinate perform very slowly as well.

 

the app is set to CPU mode since i am using vector graphics.

 

please advise on how i may improve performance. thank you.

Contributor
Posts: 15
Registered: ‎02-05-2012
My Device: Playbook
My Carrier: Fido

Re: Simple Game - Poor Performance

i have already tried optimizing my app by doing the following:

 

- reducing filters

- optimizing code / functions 

- switching to vectors instead of arrays

- testing gpu vs cpu (cpu performs better for me)

- profiled the app and ensured low memory usage (under 5mb) .. trying cache as bitmap pushed memory usage to over 30mb so i removed that option.

 

any tips please?

Developer
Posts: 6,541
Registered: ‎10-27-2010
My Device: HTC One, PlayBook, LE Z10, DE Q10
My Carrier: Verizon

Re: Simple Game - Poor Performance

Too many tweens can make it slow as well. You can do updates based on the app frame events and move resources that way.
Contributor
Posts: 15
Registered: ‎02-05-2012
My Device: Playbook
My Carrier: Fido

Re: Simple Game - Poor Performance

" updates based on the app frame events and move resources"

 

Are you referring to the Enter_FRAME event?

 

I do not have many tweens, just a lot of vector graphics (100ish ) on screen at once.


Developer
Posts: 6,541
Registered: ‎10-27-2010
My Device: HTC One, PlayBook, LE Z10, DE Q10
My Carrier: Verizon

Re: Simple Game - Poor Performance

Can the graphics be PNG or do they have to be vector? That could be a lot of drawing? Are the items in their own Sprite or are you drawing everything in one sprite?

Yes, ENTER_FRAME.
Contributor
Posts: 15
Registered: ‎02-05-2012
My Device: Playbook
My Carrier: Fido

Re: Simple Game - Poor Performance

Thanks for the reply.

 

Each item is contained in its own sprite. They are vectors, but do not have to be.

 

Would you recommend I convert every sprite to bitmap using the bitmap data class?

 

Should i use cache as bitmap on everythign that does not have an animation?

 

 

Developer
Posts: 6,541
Registered: ‎10-27-2010
My Device: HTC One, PlayBook, LE Z10, DE Q10
My Carrier: Verizon

Re: Simple Game - Poor Performance

I would see what might be causing the bottleneck. Try replacing the sprites with just a rectangle to see if performance is better. If it is not, then looking at replacing the tweening. Bitmaps are better, but may not be the issue. Have you tried profiling the code?
Contributor
Posts: 15
Registered: ‎02-05-2012
My Device: Playbook
My Carrier: Fido

Re: Simple Game - Poor Performance

I have profiled teh code and what I was previously doing was on the fly converting vectors to bitmap data and adding that bitmapdata to the display list. this method proved to be very memory intensive. it took up approximately 2000% more memory than using plain vectors.

 

i will try your rectangle idea and let you know what I uncover. thanks for the tip.