Channelling an explosion along a narrow passage

Posted by finnw on Game Development See other posts from Game Development or by finnw
Published on 2011-06-25T21:07:37Z Indexed on 2011/06/26 0:31 UTC
Read the original article Hit count: 246

Filed under:

I am simulating explosions in a 2D maze game.

If an explosion occurs in an open area, it covers a circular region (this is the easy bit.)

However if an explosion occurs in a narrow passage (i.e narrower than the blast range) then it should be "compressed", so that it goes further and also it should go around corners.

Ultimately, unless it is completely boxed-in, then it should cover a constant number of pixels, spreading in whatever direction is necessary to reach this total area.

I have tried using a shortest-path algorithm to pick the nearest N pixels to the origin avoiding walls, but the effect is exaggerated - the blast travels around corners too easily, making U-turns even when there is a clear path in another direction. I don't know whether this is realistic or not but it is counter-intuitive to players who assume that they can hide around a corner and the blast will take the path of least resistance in a different direction.

Is there a well-known (and fast) algorithm for this?

© Game Development or respective owner

Related posts about 2d-physics