Per-Pixel-Collision-Detection icon indicating copy to clipboard operation
Per-Pixel-Collision-Detection copied to clipboard

Memory Usage

Open superprat opened this issue 10 years ago • 1 comments

Hi, I'm facing a memory usage issue with the plugin, In excess of 300mb of memory is being used. Is there any way to drop the memory usage? Perhaps by sacrificing accuracy of the hit detection?

superprat avatar Sep 12 '14 11:09 superprat

@superprat -

This plugin was never mean to scale; indeed, it was more of a proof-of-concept, than a game-ready plugin. You can try two things going forward:

One, you could rewrite the plugin so that it doesn't cache the alpha values separately; instead, you could parse the ig.Image.data array directly and look at every 4th value for the alpha.

Two, you could use the Box2d plugin or another physics library to give you non-square bounding boxes. It wouldn't be as accurate as pixel-based collision detection, but it's a good intermediary step that would be much faster.

Best.

quidmonkey avatar Sep 21 '14 13:09 quidmonkey