Wednesday, June 27, 2007

shot assistance

Remember that mortar-assistance thing in Tribes, where a friend could laser-spot a target, and you'd get a hud indicator of where to shoot your mortar (two possible heights) to hit the target?

Here's a landscape. The view is looking up this little hill. (Click for fullsizes).

Here's a landscape warped to show what your mortar would hit - you can see over to the far side of the hill.

Here's the same shot with a lower barrel velocity - the terrain lifts up sooner, because the mortars fall shorter. If you look upwards at 45 degrees (which maximizes your range), the middle of the screen is on the further spot you could hit. The terrain warping is a parabola of how much your shot will fall at each distance.

If you tilt the camera up further, the terrain starts stretching back down - your mortars lob so high they land closer to you than they would at 45 degrees. Look at the grey pattern on the terrain to see what I'm talking about.

I think to get the effect technically correct, I should render the terrain twice, with two different warpings. Just like how tribes would show two points on the hud, we'd want to draw a point in the world at two points in viewspace. I can't figure out what the other warping is. If you look straight up, you should see yourself upside down above you, and the whole world should be mirrored vertically around the circle (at 45 degrees) that defines your maximum range.

A neat side effect is any mortars enroute to hit you will render as fixed in viewspace (unless they're travelling at a different barrel velocity than yours). If you had a game of mortars vs. lasers, there would be cases where visibility only goes one-way in each direction betwee(eg. the mortar dude you can't see can see you over the hill, but he can't see you when you're under an overhang, hitting him with your laser). A straight-line laser would render as curving upwards to the mortar player.

Rendermonkey :D

No comments: