FlightControl-Master / MOOSE

Mission Object Oriented Scripting Environment (MOOSE) for lua mission scripting design in DCS World
http://flightcontrol-master.github.io/MOOSE/
GNU General Public License v3.0
291 stars 96 forks source link

AIRBOSS STOVL Scoring Incorrect #2099

Closed engines-wafu closed 8 months ago

engines-wafu commented 8 months ago

Having used the AIRBOSS script extensively on a server running CV and STOVL carriers, we noticed that there are inconsistencies with the scoring on the STOVL carrier.

Expected behavior is correctly called out in documentation and code comments, which is as follows:

5.0 Points OK: "Okay underline", given only for a perfect pass, i.e. when no deviations at all were observed by the LSO. The unicorn! 4.0 Points OK: "Okay pass" when only minor () deviations happened. 3.0 Points (OK): "Fair pass", when only "normal" deviations were detected. 2.0 Points --: "No grade", for larger deviations.

The scoring code was modified from the CV code for STOVL application by adding STOVL-only logic in an if/else if block as follows:

  if nL > 1 and playerData.actype==AIRBOSS.AircraftCarrier.AV8B then
      -- Larger deviations ==> "No grade" 2.0 points.
      grade="--"
      points=2.0
  elseif nNv >= 1 and playerData.actype==AIRBOSS.AircraftCarrier.AV8B then
      -- Only average deviations ==>  "Fair Pass" Pass with average deviations and corrections.
      grade="(OK)"
      points=3.0
  elseif nNv < 1 and playerData.actype==AIRBOSS.AircraftCarrier.AV8B then
      -- Only minor average deviations ==>  "OK" Pass with minor deviations and corrections. (test nNv<=1 and)
      grade="OK"
      points=4.0
  elseif nL > 0 then
      -- Larger deviations ==> "No grade" 2.0 points.
      grade="--"
      points=2.0
  elseif nN> 0 then
      -- No larger but average deviations ==>  "Fair Pass" Pass with average deviations and corrections.
      grade="(OK)"
      points=3.0
  else
      -- Only minor corrections
      grade="OK"
      points=4.0
  end

The issue is caused by the third if statement where it is looking for nNv < 1 and playerData.actype==AIRBOSS.AircraftCarrier.AV8B, which is a variation of the fifth statement looking for nN> 0. The nN and nNv are assumed to be the total number of normal deviations and the total number of normal VSTOL deviations respectively. On inspection, and as demonstrated, nN is calculated correctly by taking the total number of deviations and subtracting the total number of large and the total number of small deviations using this line nN=N-nS-nL. However, this approach has attempted to be used for STOVL grades here: nNv=Nv-nS-nL

  local N=nXX+nIM+nIC+nAR
  local Nv=nXX+nIM
  local nL=count(G, '_')/2
  local nS=count(G, '%(')
  local nN=N-nS-nL
  local nNv=Nv-nS-nL

When looking at their derivation, it is clear that to account for the higher likelihood of exceedances in close and at the ramp (nIC and nAR) due to the longer exposure of the pilot in these regimes with a STOVL landing procedures. This justification is valid.

However, in practice, as nS and nL are still counting all large and small deviations at all four phases, instead of just two, it's highly probable that nNv will be less than 1. This will cause elseif nNv < 1 and playerData.actype==AIRBOSS.AircraftCarrier.AV8B to return True and issue a 4.0.

This is demonstrated with the following approach, which has multiple normal deviations, but is still awarded a 4.0 due to the logic above:

ac7e2c04-97d8-4477-8263-c9d80e89f3d7

Where a pilot will also receive a 4.0 for an approach with minor deviations:

funkbot

engines-wafu commented 8 months ago

This is a link to the nNv line: https://github.com/FlightControl-Master/MOOSE/blob/748aa131e4e9ba35bbe728fa6a2acb4d0efa4cf8/Moose%20Development/Moose/Ops/Airboss.lua#L12134

engines-wafu commented 8 months ago

Potential fix, maybe return STOVL specific data in the _Flightdata2Text function?

https://github.com/FlightControl-Master/MOOSE/blob/748aa131e4e9ba35bbe728fa6a2acb4d0efa4cf8/Moose%20Development/Moose/Ops/Airboss.lua#L12271

engines-wafu commented 8 months ago

Pulled the updated moose include to the mission for testing, will report back. Thanks for the quick action, @funkyfranky.

engines-wafu commented 8 months ago

Tested extensively with CV and STOVL approaches and working nominally.

funkyfranky commented 8 months ago

Great, thanks for testing!