wolfwings: (Default)
[personal profile] wolfwings
If you've ever played a game called ShadowRun, specifically the third edition, there's an interesting set of rules regarding explosives. Specifically, they're relatively simple, X damage, -Y/m from explosion. But they DO count bounced damage off of one wall and rebounding as damage still.

So, I decided to try my hand at creating a system to visualize reflected damage radii per the ShadowRun rules. They have a nasty flaw, in that the damage ALWAYS bunches up, if you're more than X/Y meters in-game away from an explosion, there's no way it can hurt you.

But, this flaw can be exploited to calculate the damage of a set of blasts quite handilly. The trick, is to calculate things first as simple circles of 1-damage flat across the entire circle, and layer these circles to make the raising damage.

Then, reflect the circles against the walls, keeping track of accumulated distance as you go. There's a reason for this. Tracking from the explosion outwards causes aliasing errors from moire patterns from angle overlaps. Nasty.

So the trick here, is for any given 'blast circle' see which walls it 'touches' with a simple point-line distance calculation, then reflect them across the line. Then, go across the entire 'map' pixel by pixel, and check against each of the blast circles in turn. If one is 'over a line' then reflect back from there towards the original explosion point again instead, reflecting the lines back and forth as needed. In essence, ray-tracing to see which 'explosion radii' can be reached from each pixel, instead of the other way around.

Okay... now how many people did I just utterly confuse? >^.^< Should I post the source code I worked up, and see if anyone can see the anacronism that ended up in it, but that still seems to allow it to work right? :-)

(no subject)

Date: 2002-08-31 03:05 pm (UTC)
From: [identity profile] dour.livejournal.com
Well... if you're going to bounce shockwaves off of walls at all, then the fact is that your moire patterns are more accurate than a single-value raytrace. Consider a character standing in a narrow corridor; the shockwave will bounce back and forth along the walls, and he really will be slapped by waves from both walls.

The biggest flaw, actually, comes from not treating every object, including creatures, as a semipermeable wall which will absorb some damage potential, reflect some more, and only pass through what's left over. A character in a corner won't be hit as hard by waves from the walls behind him, because he blocks much of the shock from even reaching them.

Of course, that's much harder to model. Welcome to the wonderful world of chaos theory. ;)

Ouch!

Date: 2002-08-31 03:30 pm (UTC)
From: [identity profile] lionman.livejournal.com
My brain hurts!

But, it's good to see you post again. :-)

Style Credit