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

Regular Contributor
Posts: 63
Registered: ‎01-25-2011
My Device: Not Specified

scrolling through big picture => bad performance?

i made a jump an run game for pc, so never really bothered about performance.

now that i ported it to playbook, its really slow.


i got 3000x600 pictures for the background.

if my player reaches 70% to the right of the screen, the background starts scrolling towards him. as soon as i stop and move without moving the background, it runs smooth.


im working with 30FPS and the background position gets updated every frame.


i read other people work with 60fps. is that neccessary? doesnt it slow the game down a lot?


and please give me your thoughts on my performance problem

Posts: 28
Registered: ‎02-18-2011
My Device: Not Specified

Re: scrolling through big picture => bad performance?

[ Edited ]

It sounds like you're scrolling the background image by adjusting the x value to move the whole thing back and forth?


That's a textbook example of a technique which will only work well with the brute force of a desktop processor behind it.


Can you break up the background image into a few small elements (e.g. clouds or trees) and animate them separately to give the impression of a scrolling background? That would be much less intensive than scrolling a 3000x600 image.


Or you could try a different approach to render the whole scene. e.g. blitting? (google 'actionscript blitting'). But that will take a lot more effort.

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

Re: scrolling through big picture => bad performance?

If it is JPEG, try decreasing the quality (if it is a background). This will decrease the filesize and memory needed for the image which might help performance.
Posts: 45
Registered: ‎03-07-2011
My Device: Not Specified

Re: scrolling through big picture => bad performance?

[ Edited ]

No, that will not help. Even JPEG have to be encoded to Bitmap before they can be shown on the display. Filesize != Memory footprint.


@ thread

Keep at mind that at a certain image resolution the image can not be processed by the gpu at once. So you would basically loose GPU acceleration. if you move your large image by setting x,y your entire view needs to be redrawn (slow).


You could try two things:


Adobe's suggestion: use scroll(): http://help.adobe.com/en_US/ActionScript/3.0_ProgrammingAS3/WS5b3ccc516d4fbf351e63e3d118a9b90204-7d6...


Many Flash Game developers use tile based (for very large levels) backgrounds. You can look here for a class that will automatically create the tiles for you. http://www.bit-101.com/blog/?p=1199


[EDIT] Found another great sample (source code available) http://www.senocular.com/flash/source/?entry=695


good luck