Originally posted by Thantos
Here is a challange for ya since I've seen very few games that do it well.
Accurately move a bullet in a normal flight path. And of course optionally include the bullet spread.
Mathematically, that's not horribly difficult (anyone with a bit of physics should be able to describe the motion using parabolics). However, computationally, it's a lot more intensive than straight line bullets, and would likely just confuse the player. Anyway, perhaps it would be possible (read: feasible) to approximate realistic motion through the use of lookup tables or something. But, as you probably know since you were in the army, there are a number of ways of sighting in a weapon. You can sight it so that it will hit consistently at a certain distance - at shorter distances it will be high and longer distances, low. You could also have the sights completely parallel to the barrel (not for real world use), so that the bullet begins dropping as soon as it leaves the barrel (no initial vertical velocity). Anyway, look at the difference in computations:
Code:
"simple"
y=(initial vertical velocity)*t + initial_height
"realistic"
y=initial_vertical_velocity*t + (1/2)(-gravity)t^2 + initial_height
The difference between "simple" and "realistic" is the term (1/2)(-gravity)t^2, which can be simplified to (k)t^2 where t represents (1/2)(-gravity) (constant, can be precalculated and #defined unless you deal with variable gravity) However, that's still three multiplications PER bullet, PER frame. That can get expensive, and the player probably either wouldn't notice or would think the aiming system was off. Especially since most FPS rely on fairly short distance shots, meaning there would be a short flight duration and hence only a slight bullet drop. Conclusion: not hard to do, but why?
think of something that hasn't been done. I was thinking about realistic speed in a game, because that was one of the problems I've had trouble with, and with instantaneous velocity we could get into some calculus with derivatives, that'd be kind of neat.
We could do that. I'm not 100% positive what you mean (it would require clarification) but it sounds workable. We could also throw in momentum, and perhaps rotational momentum (hmmm... does anyone have a use for rotational momentum in a game?)
Oh, and for emphasis since we haven't gotten an answer...
has anybody actually read it yet?