Jump to content

Is it ok to have a lot of BitmapData?


threedollarbill
 Share

Recommended Posts

The client I am working for wants to be able to change how elements inside the game are colored just by just changing a variable in the code (for example "#FF0000" for red, or "#00FF00" green).

So basically, what I plan to do is to just tint the sprites to whatever color on runtime, and then draw them to a BitmapData then save it in the cache so I can reuse them over and over without making it too expensive for the CPU (I've read that tinted sprites are heavy when on Phaser.CANVAS).

My question is, is creating a lot of BitmapData bad? Apart from the memory that they will take up, is there anything I should be concerned about? I've read that each BitmapData is actually a new canvas. If so, does that mean a lot of BMD = a lot of new canvases = slower performance?

Haha I hope I'm making sense.

Link to comment
Share on other sites

To me the only criteria you should be worried about is how good the game actually is. If you have 60 FPS with a thousand bitmapData, what's the issue? However like you said, it's very likely to quickly be laggy, as those are expensive. But it all comes down to what game you're doing. If it's a simple color-the-things game, it should be okay. 

Also be sure to deeply test the tinting, as I think it does not work very well in canvas mode, especially on devices.

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...