In the game ArmA 2 they try to simulate ballistics and have some kind of drag model. I would like to try to find out how it works.

I collected the following data from a bullet fired from a rifle in the game.

Initial Velocity: 900 m/s Time of flight: 0.000 sec

100m Velocity: 819 m/s Time of flight: 0.114 sec
200m Velocity: 746 m/s Time of flight: 0.226 sec
400m Velocity: 618 m/s Time of flight: 0.543 sec
600m Velocity: 512 m/s Time of flight: 0.913 sec
1000m Velocity: 352 m/s Time of flight: 1.835 sec

The only given value given relating to the drag was "airFriction = -0.0009324".

This is a negative value and I'm not sure how to calculate it using that formula.

I would like to know how I can derive some kind of equation that will give the final velocity of a projectile launched at 900 m/s matching that of the projectile above, or at least more clues on how they decided to program their in-game ballistic physics.

Ok, this does not look like a homework question (unless you have a pretty cool teacher), so I suppose one can answer it.

The actual force due to friction will depend on the velocity of your bullet. What you want is the instantaneous acceleration which will slow your bullet down.

As you already said, you have airFriction = accel / speed^2.

That means you will get accel=airFriction*speed^2. This will actually be a negative value. It should be as it slows the bullet down. Now, I suppose in a computer game they perform a piecewise linear approximation of the velocity.

So beginning with a velocity v0 at some time t0, when checking at some time t1, the new velocity v1 will be reduced as:
v1=v0-accel1*(t1-t0).

Now you can continue calculating a new acceleration due to the new speed
v2=v1-accel2*(t2-t1)
and so on.

Obviously the acceleration will instantly change as the velocity changes, but this is a video game. I do not think they can sacrifice that much processor cycles to get things perfect, so piecewise approximation should be fine.

Using this simple model and plugging in the numbers you gave, I also roughly get the velocities you presented.

Thank you for you help. I spent a while on this and it was frustrating to begin with until the answer finally clicked. Apparently this has puzzled more than a few people since this game series has a large "modding" community who like to understand how things work, for example to make a script to direct artillery shells or a sniper's bullet.

The part you mentioned about the acceleration always changing was bothering me, since that would require a massive amount of calculations, not a simple formula, but that turned out to be the missing piece of the puzzle.

I solved it by calculating a new acceleration value each 10 meters until 100 m- the answer I got corresponded to the 819 m/s velocity, so I made an Excel spreadsheet with these formulas and all the values match up exactly, at every range.

I tested the in-game speed of the bullet at 1400 meters (an extremely long distance for this game), and it matched the value on my spreadsheet exactly.

Interestingly, if I change the spreadsheet to calculate a new acceleration every 5 meters (instead of every 10) the values the come up are slightly wrong. It appears they do it every 10 meters like I originally tested out, or at least somewhere close to that.

This the game must be running these formulas over 50 times per second, as well as calculating the acceleration due to gravity and many other things, and that is for every shot, so if someone is firing a machine gun there are a huge amount of calculations going on.

It's more likely that calculating every 5 meters produces a more accurate result, but one that differs from the longer step period used by the game. I'm surprised they did this based on distance instead of time. Wiki has an article about how complicated drag is. In order to use the classic formula for drag based on coefficient of drag x speed^2, they "cheat" by allowing coefficient of drag to also be a function of speed, where the function just interpolates between sample points in a table. This is mostly a problem for supersonic and transonic speeds. Link to wiki article:

You're right, decreasing the intervals made the values differ from those produced by the game. I don't know how they did it for sure, but my results seem completely accurate to the game's, which was what I was looking for.

In real life (non video game) ballistics there are several extremely long tables which were found using empirical methods... these are what most people use to calculate their information. Some of these tables were created in the 19th century. They used different shaped projectiles to create the tables, G1, G5, G7, etc. G1 is suited to "flatbase projectiles with 2 caliber (blunt) nose ogives", for example. Projectiles will have a ballistic coefficient to be used with a particular table.

Nowadays they are most commonly found in the code of ballistics programs, it's too inconvenient to calculate it by hand when you can just type in the ballistic coefficient and find the answer for yourself.

These tables can be surprisingly accurate, and the calculations can be adjusted for different air densities, etc. Almost no firearms companies measure or supply information such as drag coefficients because Doppler radar is expensive and most shooters don't need such information (they usually give you the BC, the G1 ballistic coefficient), but it's nice when they do.