OpenXcom Forum

OpenXcom Forks => More Forks => Brutal AI => Topic started by: Istvaan 3 on November 15, 2024, 02:29:24 pm

Title: (Brutal AI) Accuracy tweak via submod or by changing game files
Post by: Istvaan 3 on November 15, 2024, 02:29:24 pm
Hello everyone! I'm new to BOXCE modding.
Recently I found this (github.) /Xilmi/OpenXcom/blob/oxce-plus/src/Battlescape/Projectile.cpp, this file (along with OpenXcom/src/Battlescape/Projectile.h) contains variables (From line 38 in projectile.cpp) used to configure accuracy for RA. Is it possible to modify them in some way? I have already tried to change them by creating scripts but have failed (Mostly copied existing scripts and tried to implement changes in this variables).
Can anyone help me and point out how to change accuracy in the game (If it's possible)?

Code from github (Projectile.cpp), lines 36 to 53
namespace OpenXcom
{
AccuracyModConfig AccuracyMod = {
   1,      // MinCap         Minimum accuracy value
   300,   // MaxCap         Maximum accuracy value
   3,      // AimBonus         For aimed shot if total accuracy is 5% or less
   2,      // KneelBonus      For kneeling if total accuracy is 5% or less
   4,      // aimedDivider
   3,      // snapDivider
   3,      // autoDivider      Dividers are used for adding roll-based deviation
   1,      // twoHandsBonus   Less shots dispersion for one weapon in both hands
   3,      // distanceDivider   Additional 1 voxel of deviation per this number of distance tiles
   1.35,   // SizeMultiplier   Accuracy multiplier when targeting big units
   50,      // suicideProtectionDistance   // Minimal distance missing shot should fly, in voxels
   10,      // bonusDistanceMax   Improved accuracy distance - top threshold
   6,      // bonusDistanceMin   Improved accuracy distance - bottom threshold
   {0, 30, 50, 70, 100} // coverEfficiency Percentage of accuracy affected by target exposure
};
Title: Re: (Brutal AI) Accuracy tweak via submod or by changing game files
Post by: Meridian on November 15, 2024, 03:03:34 pm
Moved to Brutal AI board.
Title: Re: (Brutal AI) Accuracy tweak via submod or by changing game files
Post by: jnarical on December 12, 2024, 01:08:18 am
Hello everyone! I'm new to BOXCE modding.
Recently I found this (github.) /Xilmi/OpenXcom/blob/oxce-plus/src/Battlescape/Projectile.cpp, this file (along with OpenXcom/src/Battlescape/Projectile.h) contains variables (From line 38 in projectile.cpp) used to configure accuracy for RA. Is it possible to modify them in some way? I have already tried to change them by creating scripts but have failed (Mostly copied existing scripts and tried to implement changes in this variables).
Can anyone help me and point out how to change accuracy in the game (If it's possible)?

I wasn't checking the forum for quite a while, as like as participating in BOXCE development - real life takes its toll...
As for your question - it wasn't meant to be changed by users, but it would be useful to make those values available for modding... I just don't know how, this idea never came to my mind, honestly. I'll look into it.
Title: Re: (Brutal AI) Accuracy tweak via submod or by changing game files
Post by: Istvaan 3 on January 05, 2025, 10:22:58 am
The temporal solution I found for it is to use a script that increases the overall accuracy stat for each unit. It's quite crude, but still works.
Code: [Select]
extended:

  scripts:
    createUnit:
      - offset: 1
        code: |
          unit.Stats.addFiring 100;

          return;
When I'll learn more advanced coding/scripting, there may be an option to multiply firing stats, like multiply twice for each unit.
Title: Re: (Brutal AI) Accuracy tweak via submod or by changing game files
Post by: jnarical on January 05, 2025, 01:09:27 pm
The temporal solution I found for it is to use a script that increases the overall accuracy stat for each unit. It's quite crude, but still works.
...
When I'll learn more advanced coding/scripting, there may be an option to multiply firing stats, like multiply twice for each unit.
That way, you can change either base or final RA-modified accuracy, but not any internal numbers for intermediate calculations.
Title: Re: (Brutal AI) Accuracy tweak via submod or by changing game files
Post by: jnarical on April 01, 2025, 02:18:35 am
Projectile.cpp.... contains variables used to configure accuracy for RA. Is it possible to modify them in some way?
Now it's moddable. I changed the parameters along with spread algorithm itself.
Still don't recommend touching anything related to distances and distance-related bonuses - they were set for different insane weapons in XCF mod, and nothing breaks atm as far as I know. I can't even guarantee that game won't crash because of some unexpected numbers - I didn't plan to expose that config to user from the beginning, so no safeguards there.

But in the end, it's up to you.