Skip to content

The advanced artillery computer for Bohemia Interactive's Arma III. Supports both classic artillery systems like the 2S9 Sochor and M4 Scorcher, but also redneck artillery with the MAAWS rocket launcher.

Notifications You must be signed in to change notification settings

Dreamfarer/ARMA-3-ARTILLERY-CALCULATOR-ARES

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

39 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

About ARES

ARES is a web service to calculate the elevation, heading, and fire mode needed to precisely hit desired targets in Bohemia Interactive's Arma 3. When loading the web app, you get to choose between the classic artillery computer for the 2S9 Sochor and M4 Scorcher, or, you are finally able to opt for the redneck artillery version designed for the MAAWS Mk4 Mod 0Be the real King of the Hill!

Get ARES

It is as simple as cloning this repository and double-clicking the .html file. However, there is yet a more convenient way: Head straight to the live version of this artillery calculator found HERE – Free of charge and no nasty trackers nor advertisements!

How to Use?

When you open the web app, you'll be prompted to choose between two artillery calculators: one for the 2S9 Sochor and M4 Scorcher, and another for the MAAWS Mk4 Mod 0 (redneck artillery version).

Add an Artillery Unit: Right-click on the map to place your artillery unit.
Set a Target: Right-click again anywhere on the map to place a target.
Move Markers: Hold the left mouse button and drag to reposition existing markers.
Delete a Marker: Right-click on any marker to remove it.

For more guidance, check out the tutorial video by Testiboule. Thanks, Testiboule! <3
On mobile, a left-click is equivalent to a single tap, and a right-click is equivalent to a long press.

What Extra Features Does ARES Have to Offer?

ARES has more to offer than what you notice at a first glance.

Altitude API
I have created an API to get the height data of a given coordinate on Altis. It's effortless to use: Transmit a 'x' and 'y' coordinate to the API, and it will return the altitude above sea level in JSON format at this specified point.
Let's go for an example: If you would like to know the altitude at 10'000, 10'000 on Altis, make a call to the API like this: https://api.openlink.bot/ares.php?x=10000&y=10000

Download Map Data
Unfortunately, the map tiles exceed the GitHub upload limit. You can get them HERE. Unzip map.zip and drag-and-drop the map folder into the root project folder

The Magic Behind It

The following documentation is split in two sections. The first section deals with the flight path of artillery shells shot by self-propelled artillery like the 2S9 Sochor and M4 Scorcher. Fortunately, in Arma 3, artillery shells are the only projectiles not affected by external force such as wind or air friction.
In the much more difficult second section, we will go over the projectile motion of the MAAWS Mk4 Mod 0 rocket, which, in contrast to artillery shells, is affected by air resistance, making the calculations much more exhausting.

Self-Propelled Artillery
Will be added on a later date. I know you want the juicy MAAWS rocket science. 🤣

MAAWS Mk4 Mod 0 (Redneck Artillery)
The Arma 3 wiki states that the only properties that influence trajectory are initSpeed (CfgMagazines), airFriction (CfgAmmo) and coefGravity (CfgAmmo). Such projectiles travel based on their muzzle velocity (initSpeed) and aerodynamic drag (airFriction), along with gravity-induced vertical drop.

Fortunately, there is another post on the Arma 3 wiki giving us an insight into the formula used to calculate projectile motion with air resistance. However, it is badly written and formatted to the point of almost no recognition. After further inspection and some guesswork, I decoded the formula to be:

$a= v* \sqrt{v_x^2+v_y^2} * Friction$

While reading through the Projectile Motion on Wikipedia, I have found a somewhat matching formula. However, the variable names are different, and a differential equation is now being introduced because we want to compute the current state instead of the rate of change.

$v = \frac{d}{dt} x$(velocity is the first derivative of displacement)
$a = \frac{d}{dt} v$(acceleration is the first derivative of velocity)
$\mu = - Friction$

Armed with this knowledge, we rearrange the above equation and split it into $x$ and $y$ components.

$\frac{d}{dt} x = v_x$
$\frac{d}{dt} y = v_y$
$\frac{d}{dt} v_x = - \mu * v_x * \sqrt{v_x^2 + v_y^2}$
$\frac{d}{dt} v_y = - g - \mu * v_y * \sqrt{v_x^2 + v_y^2}$

To actually get the current state instead of the rate of change, we need to solve the ordinary differential equations depicted by $\frac{d}{dt}$. But how?
The Wikipedia article further states that the equations of motion can not be easily solved analytically. Through the sheer amount of research I had done, I came across a YouTube video using the Euler method to approximate the projectile path.

Now, I have never been a good student in mathematics, so the explanation might be a bit lacking. What we do with the Euler method is essentially approximating the analytical solution by computing the same equation over and over again while taking the before calculated result into account. The smaller the step size (in our case, time) $h$, the more accurate the approximation will be. The only thing stopping you from reaching infinite precision is the infite computing time needed. You absolutely need to find a balance between the two.

Enough talking, here are the above equations while using the Euler method. Notice that the equation did not change, except I have added the step size multiplication ( $h$ ) and the before state of each variable ( e.g. $x_{before}$ ) on the right side of the equation.

$x = v_{x} * h + x_{before}$
$y = v_{y} * h + y_{before}$
$v_{x}= (v_{x-before} * \sqrt{v_{x-before} ^ 2 + v_{y-before} ^ 2} * - \mu) * h + v_{x-before}$
$v_{y}= (v_{y-before} * \sqrt{v_{x-before} ^ 2 + v_{y-before} ^ 2} * - \mu - g) * h + v_{y-before}$

You would now loop over these equations, each time pushing the new variable (e.g. $v_{x}$ ) into the before variable (e.g. $v_{x-before}$ ) until a certain criteria is met. In our case, it is when the desired distance ( $x$ ) at a given height ( $y$ ) has been reached. Note that the elevation change can be done by shifting the height ( $y$ ) target up or down.

We next need to find a way to incorporate the shooting angle into the equation. As luck would have it, we forgot to define a before state of these variables: $x$, $y$, $v_{x}$ and $v_{y}$. How else would the Euler method be able to start when there is no before value?

Because each component is being calculated separately, we only need to split the rocket's absolute velocity into its x and y components once at the start of the calculation. The Euler method will take care of the rest. We will take 5° gun elevation as an example.

$\mu = 0.000132$(friction for MAAWS Mk4 Mod 0 found through testing)
$x = 0$   (starting at 0m displacement)
$y = 1.53$   (starting at 1.53m because the MAAWS is held at that height)
$v_{x} = 350 * \cos(5 * \frac{\pi}{180})$   (starting with 5° gun elevation $v_{init} = 350 \frac{m}{s}$)
$v_{y} = 350 * \sin(5 * \frac{\pi}{180})$   (starting with 5° gun elevation and $v_{init} = 350 \frac{m}{s}$)

You now might ask; how do we actually find the angle required to fire a MAAWS rocket, let's say, precisely 2000m. The painfully simple answer is: guessing and testing. What my application will do is calculate a specific gun elevation and adjust its error through eliminating the worse chosen angle. Let us walk you through an example:

In this case, the script starts at gun elevation 5° and 10° and will calculate where the rockets impacts. For this angle, it will calculate around 1827m (for 5°) and 3142m (for 10°). 1827m is 173m away from our goal, 2000 m, which translates to 5° being roughly 0.65° away from our unknown goal angle.

My program would then replace 10° with 5.65° and would try again. This time it results in 1827m (for 5°) and 2018m (for 5.65°). 2018m is still 18m away from our goal, 2000m, which now translates to 5.65° being roughly 0.06° away from our unknown goal angle.

My program would then replace 5° with 5.588° and would try again. This time it results in 1999m (for 5.58°) and 2018m (for 5.65°).

As you can see, we are arriving at our unknown goal angle pretty fast. The only thing you would need to specify further is when the precision is enough to stop the recursive execution of this code and print the found angle onto the map.

You can use my Excel file to play around with the now newly acquired knowledge. You can safely ignore Stokes Drag.

About

The advanced artillery computer for Bohemia Interactive's Arma III. Supports both classic artillery systems like the 2S9 Sochor and M4 Scorcher, but also redneck artillery with the MAAWS rocket launcher.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published