# Applied Mathematics (video game design problem)

Printable View

• Nov 25th 2010, 04:51 AM
gamedev
Applied Mathematics (video game design problem)
Hello,

I'll start off with a little introduction for some context to my problem. I am a video game designer working on a game set on a fortress island being attacked by enemy warships. The players (it's a multiplayer game) must provide some input to aim a cannon which then fires an explosive shell.

An important note: none of the game physics are realistic. They are deliberately unrealistic for reasons of gameplay.

The problem I am trying to figure out is an equation for the explosion radius. The two variables which affect it are the range, and the weight of gunpowder in the shell.

The range should have linear, decreasing effect on the explosion radius. I.E. at a greater range, the shell will make a smaller explosion. Again, this is for gameplay reasons and has nothing to do with reality.

radius = constant - range
http://www4d.wolframalpha.com/Calcul...59&w=324&h=120

The weight has a curved, decelerating effect on the explosion radius. I.E. with a heavier weight the shell will make a bigger explosion radius, but everytime the weight is increased, the radius increase is smaller.

radius = sqrt(weight)
http://www4d.wolframalpha.com/Calcul...35&w=320&h=141

The square root curve is not exactly what I need, it should taper off more towards the end.

Now, the question is, how do I combine these two equations into one, in the form 'radius = ...' so that I can program the effect?

any and all help is appreciated,
gamedev
• Nov 25th 2010, 07:15 AM
dwsmith
I guess you could add them together and solve for the radius. I am not sure if that is what you need or want.

Let R=radius, C=constant, r=range, and w=weight

$\displaystyle \displaystyle R+R=C-r+\sqrt{w}\rightarrow 2R=C-r+\sqrt{w}\rightarrow R=\frac{C-r\sqrt{w}}{2}$
• Nov 26th 2010, 03:11 AM
gamedev
I managed to make it work with some crazy magic numbers. It's still not perfect though, heh.