Per-pixel Destructible Terrain
Posted: Sun Jun 09, 2013 3:17 pm
I've been working on a project for a little over a month now, it's got a per-pixel destructible environment similar to Worms. I've reached a point where I could use some help trying to solve an issue I'm faced with though.
My method of "destroying" the environment is to simply take circle-shaped chunks of varying size out of it whenever an explosion or other destructible event occurs. I do this by drawing to the environment's image data using Bresenham's Circle filling algorithm. That's working fine but I'm not too sure on what to do with any stray pixels that could result, and end up cluttering up the game; preventing the player from moving when there's only perhaps a single pixel or two of floating impassable terrain left in some area.
I've thought of trying to come up with a modification to the circle filling algorithm to somehow check around the circle for potential stray pixels that would result and if any are found, just increase the radius of the circle a bit to "absorb" the strays. That seems mathematically difficult though. Anyone have any ideas?
My method of "destroying" the environment is to simply take circle-shaped chunks of varying size out of it whenever an explosion or other destructible event occurs. I do this by drawing to the environment's image data using Bresenham's Circle filling algorithm. That's working fine but I'm not too sure on what to do with any stray pixels that could result, and end up cluttering up the game; preventing the player from moving when there's only perhaps a single pixel or two of floating impassable terrain left in some area.
I've thought of trying to come up with a modification to the circle filling algorithm to somehow check around the circle for potential stray pixels that would result and if any are found, just increase the radius of the circle a bit to "absorb" the strays. That seems mathematically difficult though. Anyone have any ideas?