1. Limited time only! Sign up for a free 30min personal tutor trial with Chegg Tutors
    Dismiss Notice
Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Mysterious video game drag model - any ideas?

  1. Apr 19, 2013 #1
    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.
  2. jcsd
  3. Apr 19, 2013 #2


    User Avatar
    Science Advisor

    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:

    Now you can continue calculating a new acceleration due to the new speed
    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.
  4. Apr 19, 2013 #3
    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.

    I'm impressed...
  5. Apr 19, 2013 #4


    User Avatar
    Homework Helper

    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:

  6. Apr 20, 2013 #5
    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.

    The tables look like so:

    --V----DD-----D------ DT------ T
    4400 22.2 0.0 0.00505 0.0000
    4390 22.2 22.2 0.00506 0.0051
    4380 22.2 44.4 0.00507 0.0101
    4370 22.3 66.6 0.00511 0.0152
    4360 22.4 88.9 0.00514 0.0203

    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.
Share this great discussion with others via Reddit, Google+, Twitter, or Facebook