I’m trying to use draw commands to create flexible backgrounds for a minimalist game I’m making. The draws work fine on Flash but on Windows my framerate quickly begins to drop. What I’m currently doing is making a circular outline ripple out from a point (using “lineStyle” and “drawCircle”,) adding a new one every five seconds or so. Once I get up to about five ripples on screen, framerate starts to drop. These are all being drawn to the same “graphics” object on a Sprite, though they are cleared at the beginning of each frame for redrawing.
Is there a different method I should be using? Or is this just not feasible?
Is there any way you could .draw
to a BitmapData
, and scale that?
Every shape.graphics
becomes a software render process, which can add up if you have a lot
Scaling probably isn’t the right choice. That would increase the thickness of the circle’s outline which wouldn’t look clean.
To be clear, this is happening with only around five/six draw calls per frame. It starts to dip a little at that point and then quickly falls as I add more beyond that.
If using static images is what’s performance-friendly though, I may just have to go that route. It just seems odd and unusually inefficient that the cpp-target is caving under so few draw commands. I might be doing something weird, but as mentioned it works fine on the Flash target.
sprite.graphics
uses Cairo, which is a software renderer. Flash is a software renderer as well, but is heavily optimized. We use OpenGL for rendering, but not for vectors
Right, I only mentioned Flash because it seems to lend credence to the fact that its draw-related, as opposed to something else that might affect both platforms.
Anyway, I think I have a different idea that I’m going to try out that relies more on pre-constructed displays than frame-by-frame drawing. Thanks for the insight.