sh4rkman / SquadCalc

A Minimalist Squad Mortar Calculator
https://squadcalc.app
MIT License
26 stars 2 forks source link

The results from the 120mm mortar calculator are inaccurate. #156

Closed SuisQi closed 5 days ago

SuisQi commented 3 weeks ago

The calculation results have a significant deviation from reality. Although the game doesn't display numbers to two decimal places, players can still make adjustments close to that precision through subtle controls. Despite this, the results from the calculator are still inaccurate. I'm not sure if it's due to my micro-operations not being precise enough, but after numerous tests, I haven't achieved accurate results even once. It seems like there might be an issue with the formula. For the 120mm mortar, there seems to be a drag coefficient parameter, set at 0.01. image But I modified the formula, and this coefficient has a negligible effect on the results.

sh4rkman commented 3 weeks ago

Re-tested again and it seems on point : the values squadcalc display for elevation is exactly the same as the ingame calculator (900m on flat ground = 82.9, etc), and my three test shots fell around the target

Can you provide a recreation of said inacurracy, weapon/target position, screenshot of where the shots fall, map used etc ?

Keep in mind it has a bigger spread than 80mm mortars : image

SuisQi commented 3 weeks ago

image Here is the position of the 120mm mortar. image This is the position of the point, and it is precisely 83.00 to two decimal places

But when I went into the game and moved from 82.9 to 83.0 and fired three mortars, each time from 82.9 to 83.0, the impact points were scattered and not on this point. image As shown in the picture, the three impact points are on the three red helmets I marked

sh4rkman commented 3 weeks ago

The higher the angle is, the higher the ratio degree/distance is. Aka adding or removing 0.05degree of imprecision at high angle can mean 10m of horizontal distance when it's will be 1m at low angle (the closer you get to 45deg). With 120mm using degree with only one decimal and not mils if can lead up to 8-10 meters imprecision between 82.86 and 82.94.

The ingame range calculator shows this imprecision : for 82.9 and by very slightly moving my mouse i can achieve both 900 & 910m :

image image

So my first thought would be that that the lack of decimal added to the natural dispertion can lead to this shots overlapping. That being said it looks like shots are overlapping target more than they are falling too short. As i'm not taking the vehicule high into account, it could be the reason aswell..

There is definitly no air friction into the game, already looked for the possibility in the past, they are using the classic projetile motion formula

image

Which is :

image

Note: they are using 9.81 gravity here and not 9.8, that can be a hint of why shots are overlapping

SuisQi commented 3 weeks ago

No, I specifically wrote a program that can precisely adjust to two decimal places in mils. When firing five consecutive shots, sometimes all five almost hit the same spot, but the results differ from the calculator by more than 10 meters.

SuisQi commented 3 weeks ago

Manually, you can also adjust from 77.9 to 78.0, which will be very close to 78.00. I have tested this many times in the training ground, and I suggest you try it as well

SuisQi commented 3 weeks ago

Changing gravity to 981 has a very small effect on the results, so it shouldn't be the issue. Is the speed of 190 accurate?

sh4rkman commented 3 weeks ago

No, I specifically wrote a program that can precisely adjust to two decimal places in mils.

is it a program that adjust the ingame precision or a out of game calculator that gives you more decimals ?

sh4rkman commented 3 weeks ago

Changing gravity to 981 has a very small effect on the results, so it shouldn't be the issue. Is the speed of 190 accurate?

This is what i found in the SDK :

image

SuisQi commented 3 weeks ago

No, I specifically wrote a program that can precisely adjust to two decimal places in mils.

is it a program that adjust the ingame precision or a out of game calculator that gives you more decimals ?

No, moving the mouse 50 units equals 0.1 degrees. The program first adjusts to the next position, for example, if the target is 78.74, it will first adjust to 78.6, then move up 5 units at a time until it reaches 78.7, which is already very close to 78.70. Then, it moves up 4 more units (4*5) to get very close to 78.74.

image

SuisQi commented 3 weeks ago

https://github.com/sh4rkman/SquadCalc/assets/160198334/c686437e-ea08-41c8-a603-f4a71d946633

Watch this video.,The mils are almost at a single point; the azimuth might have some deviation, but they are all 3.8.

image image image

sh4rkman commented 3 weeks ago

Same scenario, adjusting to 78.0 coming from 78.1 : image

I'm afraid i can't do better unless OWI add another decimal so i can rule out the possibility of input rounding error.

sh4rkman commented 3 weeks ago

That being said i agree that shots are overlapping most of the time, maybe the 190m/s isn't right and could be adjusted to 191m/s but unless someone find something better in the SDK i have no real reason to change the value

SuisQi commented 3 weeks ago

D1CE15E2F40923FB63BE15D637F6EEDB Your gs is the value from the in-game calculator, which is inaccurate. The value of g should be closer to 10 1AFDBC43B196041A431C6CC03634A1F3

sh4rkman commented 3 weeks ago

Yes i know! It's the only gravity value i can find in the SDK. I'f i use g = 10, the shots are 150/200m too long

-> more gravity = more elevation needed to hit the target = shots going further ingame and we are already overlapping :(

SuisQi commented 2 weeks ago

image image Experiments show that the calculated results are closer than the actual results.

sh4rkman commented 2 weeks ago

What are the differences here in term of velocity/gravity ?

SuisQi commented 2 weeks ago

image The target was supposed to be at my red arrow, but the actual walk was longer than expected

SuisQi commented 2 weeks ago

What are the differences here in term of velocity/gravity ?

That's what you use for your parameters

sh4rkman commented 2 weeks ago

I might deploy a fix soon but since i still have no idea where the problem is coming from, it will be a very ugly hack/fix.

I will either :

I hate to do this because every other weapon from squadcalc use the classic formula and velocity from the SDK and work like a charm. If anybody find out why shots are overlapping i'm all ears

SuisQi commented 2 weeks ago

I might deploy a fix soon but since i still have no idea where the problem is coming from, it will be a very ugly hack/fix.

I will either :

  • Round the elevation to the next decimal (8.12 -> 8.20)
  • add a raw +0.1 on every results
  • Slightly increase velocity (like from 190 to 192 or something)

I hate to do this because every other weapon from squadcalc use the classic formula and velocity from the SDK and work like a charm. If anybody find out why shots are overlapping i'm all ears

No, actually, regular mortars are also inaccurate, it's just that their error margin is not as large.

sh4rkman commented 1 week ago

After some more research and a lot of testing, you are indeed right : every weapons are overlapping target by 1-3 meters on average, sometime more with high velocities weapons. Classic mortar are hitting perfectly, because historically squadmc, squadxyz and squadcalc never used the 110 m/s velocity found in the SDK but a corrected, approximated value of 109.89m/s. It has always been like this, i even forgot about that and thought i was using the SDK value. In the same way of we approximated velocity for classic mortars we should have also approximated the others velocities, but no one did.

Since shots are too long, it's not air-resistance or whatsoever. Only thing left in the equation is gravity. Every calculators have been using 9.8 blindly, it looks like it's UE4 default value but maybe OWI use something along 9.75 that actually fix every weapon all at once.

I'll still dig up a bit / ask OWI what gravity they are using since i can't find it anywhere in the SDK

sh4rkman commented 1 week ago

After another shitload round of testing, i found that a gravity of 9.78 seems to fix everything : classic mortar are slightly different with g= 9.78 and vel=110 (in comparison of g=9.8 and vel=109.89) but that's barely noticeable. It might be even closer to reality now.

Every other weapon tested seems to be working very precisely, fixing the 1-3meters overlap on M121 and HellCanon. I didn't test GRAD/UB for now but calcs are barely changing (-0.1 at long distance at worst, it's was surely wrong too)

That 9.78 that i found while testing is not some random numbers after a quick research : this is the consensus of gravity at the equator, while 9.8 is the average gravity on earth. Looks like OWI is using this value in squad instead.

I'll be pushing a fix soon with updated values.

sh4rkman commented 5 days ago

should be fixed with f0538c4787287130403848a5d8cbcdb9c9509c04