Mysterious video game drag model - any ideas?

In summary, the game ArmA 2 uses a piecewise linear approximation to simulate ballistics and incorporates a drag model based on distance rather than time. By using a formula to calculate acceleration based on air friction and speed, the game is able to accurately depict the velocity of a projectile at different ranges. This method is also used in real life ballistics, where empirical tables are used to determine the ballistic coefficient for a particular projectile.
  • #1
Gews
7
0
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".

Can be calculated as:
airFriction = accel / speed^2
using real world acceleration and speed of the bullet from ballistic tables.


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.
 
Physics news on Phys.org
  • #2
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.
 
  • #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...
 
  • #4
Gews said:
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'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:

wiki_external_ballistics_drag_table.htm
 
  • #5
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.

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.
 

FAQ: Mysterious video game drag model - any ideas?

1. What is a "mysterious video game drag model"?

A "mysterious video game drag model" refers to a character or object in a video game that moves in a strange or unexpected way, often creating confusion or intrigue among players.

2. How do developers create mysterious drag models in video games?

Developers may use a variety of techniques to create mysterious drag models, such as manipulating physics engines, using glitchy animations, or intentionally designing characters with unusual movement patterns.

3. Are mysterious drag models intentionally added by developers, or are they glitches?

It could be either or both. Some developers may intentionally design mysterious drag models as a way to add an element of mystery or surprise to the game. On the other hand, glitches in the game's code can also result in unexpected and mysterious movement patterns.

4. Do mysterious drag models serve a purpose in the game, or are they just for entertainment?

In some cases, mysterious drag models may serve a purpose in the game, such as providing clues or hints to the player. However, they may also just be for entertainment purposes and have no impact on gameplay.

5. Can players control or interact with mysterious drag models?

It depends on the game. In some cases, players may be able to control or interact with mysterious drag models, while in others they may simply observe them. It ultimately depends on the intentions of the developers and the design of the game.

Similar threads

Back
Top