A Flash Developer Resource Site

Results 1 to 4 of 4

Thread: [RESOLVED] [HELP] Optimising scrolling

  1. #1
    Trainee coder Viza's Avatar
    Join Date
    Sep 2006
    Location
    Melbourne, Down under
    Posts
    513

    resolved [RESOLVED] [HELP] Optimising scrolling

    For those of you that have checked out the Alpha version of my current project, Christmas Cannon, you may have noticed that in levels ‘Fire Hoops 2’, and ‘Brickwall’, there is some noticeable slowdown. I’m dropping 5 frames just from scrolling the level!

    I’ve done some testing on the matter, and I’ve come to the following conclusions:
    • Levels containing more than 10 mc’s with moderately detailed vector art cause the slowdown (no frame drop with non-detailed mc’s)
    • Things such as checking for collisions and all other functions are NOT causing the slowdown. I came o this conclusion by running the game with no scrolling, and it didn’t drop a frame.


    The code that I have in place to scroll the level is pretty simple (not CPU intensive at all). Basically, I have every on-screen item that needs to be scrolled in an mc on the root named ‘world’. To create levels, I’m simply attaching the individual mc’s into this container clip, and scrolling the world itself (not individual items one at a time).
    I cannot cacheAsBitmap this main container clip and use scrollRect, because the game includes scaling.

    I hope I’ve described the situation well enough for you guys to understand me clearly. If you can suggest a better way to scroll the world, or can give me some advice to optimise code I’d love to hear from you.

    Cheers,
    Viza.

  2. #2
    Student
    Join Date
    Apr 2001
    Location
    -
    Posts
    4,756
    use bitmaps for the vector intense instances instead- should fix it I think.

  3. #3
    crossconscious
    Join Date
    Sep 2005
    Location
    Belgium
    Posts
    1,188
    Or only attach objects when they are on screen, and remove them once they move off the screen. Check out strille's supertile method for a neat way to do this. I always use a variation of this, combined with copypixel stuff, and it works great.

  4. #4
    Trainee coder Viza's Avatar
    Join Date
    Sep 2006
    Location
    Melbourne, Down under
    Posts
    513
    HAHA!

    .. Thanks guys for your feedback, but I feel really stupid now. I was getting so worried about having to make drastic changes to the code and how things were being rendered onto the screen (such as how Fall suggested), that I completely forgot to try just converting the graphics to bitmaps.

    I'm not losing any frames using render's suggestion. I don't know how I could've overlooked such a simple thing; my mind must've been somewhere else.

    Thanks again!

    Viza.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center