Is blitting right for my game?
I have a game whereby a player character walks around a 2d isometric map. The maps are roughly 30x30 cells in size. Each cell is likely to have it's own floor tile, perhaps a wall tile and sometimes other objects such as rocks, plants etc (some of which are animations). At the moment, each element is loaded from an external .swf and added to the display list in a certain order. The problem I'm having is if a lot of elements (3/400+) are on the screen, my game lags horribly. (It's better with cacheAsBitmap = true, but I want to allow zooming in and out - which then becomes very very slow)
I believe the reason for this is that my display list can have several thousand items in the display list. (With my current design, each externally loaded .swf is nested inside a Sprite)
I am therefore wondering if blitting would help performance and if it would be feasible, considering a few things:
- Is it ok to work out which bitmaps are currently visible, copy the bitmap data and draw everything on each frame. i.e. in an Event.ENTER_FRAME listener? Or can you only really afford to do this for animations
- I would like to be able to click on certain irregularly shaped elements by adding MouseClick listeners. I'm guessing I can get the coordinates of the mouse click and use the bitmapData I have to calculate hit tests?
- what about sprites with filters i.e. GlowFilter
