Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No-unlocks support for rebel AI equipping #2305

Merged

Conversation

jaj22
Copy link

@jaj22 jaj22 commented Mar 24, 2022

What type of PR is this.

  1. Bug
  2. Change
  3. Enhancement

What have you changed and why?

We need a new method of picking rebel AI equipment after removing unlocks. I've decided that the best method is to base AI equipment on the arsenal contents but generate new items. This is relatively simple (actually taking items from the arsenal is complex and expensive, especially with garrisons) and should have low exploit potential and no significant player count balance problems.

Processing the arsenal for each unit recruited is still too expensive, so this PR rewrites the rebel AI equipping code to use server-generated weighted lists. Some details:

  • Generates weighted arrays on server every 10mins, transmits to clients as required.
  • Weight based on arsenal contents. Typically 10 items min chance, 50 max.
  • Item usage is also capped by available magazines/bullets.
  • Refund value halved to reduce effectiveness of exploits.
  • Still works correctly with unlocks enabled.

General improvements to rebel AI equipping:

  • Improved use of NV, grenades, explosives and launchers.
  • Optics are now weapon-appropriate.
  • Magazines are now added by weight instead of count.

General improvements to automatic item categorisation:

  • equipmentClassToCategories now caches for fast subsequent use.
  • Disposable launcher support added.
  • Optic categorization added.
  • Explosive charge detection added.
  • Moved smoke grenade, flashlight and thermal detection to equipmentClassToCategories.
  • Simplified and fixed missile launcher support.
  • Fixed some broken CUP stuff in categoryOverrides.

Misc:

  • Fixed incorrect CUP template dependency.

The only regression at the moment is that missile launchers will no longer be used even if the unlocks are enabled. The plan is to add AT/AA missile launcher rebel infantry types which should be much more expensive to buy, but this requires additional entries added to each rebel template, and some UI work.

Please verify the following and ensure all checks are completed.

  1. Have you loaded the mission in LAN host?
  2. Have you loaded the mission on a dedicated server?

Is further testing or are further changes required?

  1. No
  2. Yes (Please provide further detail below.)

This is insufficiently tested. I've run the categorization code on RHS and CUP, but not VN or BAF yet. The rebel equipping code should be somewhat solid if the categorization works, although if weapons exist without a default magazine then that may trip up some config calls.

How can the changes be tested?

A3A_rebelGear is the hashmap containing all the gear lists, so that's worth looking at before spamming soldiers.

- Generates weighted arrays on server every 10mins, transmits to clients as required.
- Based on arsenal contents. Typically 10 items min chance, 50 max.
- Item usage is also capped by available magazines/bullets.
- Refund value halved to reduce effectiveness of exploits.

General improvements to rebel AI equipping:
- Improved use of NV, grenades, explosives and launchers.
- Optics are now weapon-appropriate.
- Magazines are now added by weight instead of count.

General improvements to automatic item categorisation:
- equipmentClassToCategories now caches for fast subsequent use.
- Disposable launcher support added.
- Optic categorisation added.
- Explosive charge detection added.
- Moved smoke grenade, flashlight and thermal detection to equipmentClassToCategories.
- Simplified and fixed missile launcher support.
- Fixed some broken CUP stuff in categoryOverrides.

Misc:
- Fixed incorrect CUP template dependency.
@jaj22 jaj22 added the Enhancement New feature or request label Mar 24, 2022
@Bob-Murphy Bob-Murphy added this to the 2.5.X milestone Mar 24, 2022
@Bob-Murphy Bob-Murphy added Review pending Change requested A change has been requested, and this can't be merged until it's done. and removed Review pending labels Mar 24, 2022
- Cleared up some "weapons" that weren't fireable with categoryOverrides.
- Expanded OpticsMid detection to 6.25x.
- Belt-and-braces error detection for weapons with no default magazine.
- Fixed precedence syntax error in randomRifle fallback.
- Added safety check for zero-mass secondary weapon mags.
@jaj22
Copy link
Author

jaj22 commented Mar 25, 2022

Fixed everything else that turned up but didn't change the CivilianVests/UnarmoredVests naming yet. I guess "CivilianVests" is kinda weird given that we block undercover for them.

A lot of the VN categoryOverrides look wrong so I'll check that later.

@jaj22
Copy link
Author

jaj22 commented Mar 26, 2022

  • Reworked the optic detection to use the ranging capability, so now it picks up the DMS and PSO-1 as long range. All the VN optics count as long range, which is fine.
  • Switched UnarmoredVests to CivilianVests for consistency.
  • Fixed the VN weapon category overrides. It needs a lot of them.
  • Fixed rebel AIs not using disposable launchers (everything needs a magazine).

…rver.

- Fix some typos added in the last commit.
@jaj22
Copy link
Author

jaj22 commented Mar 26, 2022

Turns out there was a second way to cause the petros vest problem. arsenal_addItem (as used by unlockEquipment) updated every machine with a remoteExecCall, so it was possible for generateRebelGear to run before all the equipment had actually been added to the arsenal. I fixed arsenal_addItem so that it updates the server immediately when run locally.

Also checked the categories with CUP. Optics & launchers seem fine at least, so I think that's all the modsets tested.

@jaj22 jaj22 added Review pending and removed Change requested A change has been requested, and this can't be merged until it's done. labels Mar 26, 2022
private _rangeCat = "OpticsClose";
{
// Assume it's a sniper/marksman optic if it has ranging and zoom. Zoom level alone isn't enough because RHS MDO > PSO-1 & DMS/SOS
if (getNumber (_x >> "opticsZoomMin") < 0.2) exitWith {
Copy link

@Lazejun Lazejun Mar 26, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this causes way more Issue than the Previous version:
RHS (It's all 4 RHSDev variants as i wanted to look at new stuff, should not affect most config Values)
107410_20220326232013_1
And the Funny RPG Sights, only on Russian Equipment with Dovetail mounts annyoing and funny.
RHS Scope lists
Scopes.txt
Vanilla with Ace and Zen
ScopesVanilla.txt
107410_20220326232645_1

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh lol, the ACE compats actually remove the value I was using to identify ranging (discreteDistance), I guess because that was the only way to disable vanilla ranging. I'll have to add a check for the ACE ranging value as well.

Curious about the Russian optics (1P29 and some PSO-1s) that still have discreteDistance. I guess they use vanilla ranging even with ACE?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh yeah, apparently all the PGO_7V variants are compatible with various AKs. Not sure if we want to fight that. Stat-wise they're a valid mid-range optic and they seem to use the standard Russian scope attachment. I'm guessing that the ak/pkp/asval versions are even marked for those weapons. AIs won't care about the markings anyway.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's a bit better with:
3b27e89

But annyoingly still weird in some Cases for RHS:
Scopes.txt
Like the Common RHS ACOGs end up in Long.

I would say fuck it,
It's as good as we can get it so that should be fine now.

["rhsusf_acc_ELCAN",
"rhsusf_acc_ELCAN_ard",
"rhsusf_acc_ACOG",
"rhsusf_acc_ACOG_wd",
"rhsusf_acc_ACOG_d",
"rhsusf_acc_ACOG2",
"rhsusf_acc_ACOG3",
"rhsusf_acc_ACOG_USMC",
"rhsusf_acc_ACOG2_USMC",
"rhsusf_acc_ACOG3_USMC",
"rhsusf_acc_ACOG_RMR"];

CUP With Ace looks pretty OK
ScopesCUP.txt
And Vanilla looks pretty fine
ScopesVanilla.txt

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah yeah, RHS ACOG defines all the ACE scope ranging params with zeros for some reason. Can workaround that easily enough, hopefully without breaking anything else. ELCAN just looks like a busted config (scope zoom is wrong, ACE ranging on marked scope) so I'm not bothered if that slips through.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Double-checked ACE code. If force turrets is disabled and the vertical adjustment value doesn't exist then the default is 0, or no ranging. So checking >0 for vertical adjustment should be correct.

@Lazejun
Copy link

Lazejun commented Mar 27, 2022

Had a look how AI Picks Equipment with No Unlocks, that seems to work pretty nice.

The only funny thing i saw while looking at it, is that the "ADR DLC" P90s are "Rifles"

"SMG_03_TR_black",
"SMG_03_TR_camo",
"SMG_03_TR_khaki",
"SMG_03_TR_hex",
"SMG_03C_TR_black",
"SMG_03C_TR_camo",
"SMG_03C_TR_khaki",
"SMG_03C_TR_hex",
"SMG_03_black",
"SMG_03_camo",
"SMG_03_khaki",
"SMG_03_hex",
"SMG_03C_black",
"SMG_03C_camo",
"SMG_03C_khaki",
"SMG_03C_hex",

And as it seems we kinda forget to stay up to date when Arma Updated for Contact etc.
Marksman Variant of LDFs AR, Classed as Rifles

"arifle_MSBS65_Mark_F",
"arifle_MSBS65_Mark_black_F",
"arifle_MSBS65_Mark_sand_F",
"arifle_MSBS65_Mark_camo_F",

Probably not worth to change but these are Underbarrel Shotgun variants Classed as Just Rifles

"arifle_MSBS65_UBS_F",
"arifle_MSBS65_UBS_black_F",
"arifle_MSBS65_UBS_sand_F",
"arifle_MSBS65_UBS_camo_F"

RPKs are Classed as Rifles but could be Machineguns

"arifle_RPK12_F",
"arifle_RPK12_lush_F",
"arifle_RPK12_arid_F",

@jaj22
Copy link
Author

jaj22 commented Mar 27, 2022

Odd thing about the P90 is that the ammo performance is pretty close to the vanilla 5.45 rounds, and possibly better than the RHS M855 and some RHS 5.45s, so it might not be the worst weapon for a rifleman to carry around. On the other hand it is a light weapon, so good for medics.

I'm not a fan of adding rifles to the sniper list just because they have a long barrel, but apparently in ACE compats these 6.5mm weapons get different cartridges. However, it's barely better than the stock 6.5mm (1.1 caliber vs 1.0, both have 10 hit), so still miserable as marksman ammo. Think I'll keep those in rifles.

The GL code could give ammunition to the underbarrel shotguns (and that 50cal specops underbarrel from Apex), but we wouldn't want them used instead of real grenade launchers, so it'd need an extra keyword. Probably not worth it because AIs likely wouldn't know what to do with them.

RPKs should be MachineGuns, yeah.

Copy link

@Lazejun Lazejun left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should be fine now

@Bob-Murphy Bob-Murphy merged commit 25962d0 into official-antistasi-community:unstable Apr 10, 2022
Bob-Murphy added a commit that referenced this pull request Apr 16, 2022
## What type of PR is this.
1. [X] Bug fix
2. [ ] Change
3. [ ] Enhancement

### What have you changed and why?
Forgot to test #2305 on DS+client. Apparently the only broken bit was that categoryOverrides is only created on the server, but now needs to be created everywhere because equipmentClassToCategories is used for general equipment identification.

Also tagged it with A3A_.

### Please specify which Issue this PR Resolves.
closes #2327

### Please verify the following and ensure all checks are completed.
1. [X] Have you loaded the mission in LAN host?
2. [X] Have you loaded the mission on a dedicated server?

### Is further testing or are further changes required?
1. [X] No
2. [ ] Yes (Please provide further detail below.)

Notes:
Fix categoryOverrides not being created on clients, and tag with A3A
@Bob-Murphy Bob-Murphy added the Added to changelog Added to changelog label Dec 1, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Added to changelog Added to changelog Enhancement New feature or request Ready for merge
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants