The expanses of WolfWings' land
scratched on the wall for all to see

August 31st, 2002
August 31st, 2002
August 31st, 2002
August 31st, 2002
August 31st, 2002

[User Picture]02:22 am - Okay, math-heads, listen up!
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? :-)4 commentsLeave a comment

Log in

No account? Create an account