05-17-2011 02:22 PM
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
05-18-2011 01:04 PM - edited 05-18-2011 01:04 PM
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.
05-18-2011 01:06 PM
05-18-2011 02:32 PM - edited 05-19-2011 03:57 AM
No, that will not help. Even JPEG have to be encoded to Bitmap before they can be shown on the display. Filesize != Memory footprint.
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_Progr
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