Jump to content
Sign in to follow this  
jedra

CfgAISkill - what does it actually do?

Recommended Posts

Hi,

I have been messing around with AI stuff since 1.6, trying to get a better understanding of how the AI work in Arma 2, especially since the precisionEnemy/Friendly change came to light. I have set up various test harnesses so I can tweak the knobs and calculate the effect. I have particularly been playing with the skills array. So, the wiki talks about a particular config, CfgAISkill which seems to be a good place to tweak some values at source. However, no matter how much tweaking I do there is no effect on the AI.

For example I set up a replacement config with the following values (which I borrowed from the Zeus-AI thread)...

[font=Consolas][size=2][color=#0000ff][font=Consolas][size=2][color=#0000ff][font=Consolas][size=2][color=#0000ff]class [/color][/size][/font][/color][/size][/font][/color][/size][/font][font=Consolas][size=2][font=Consolas][size=2]CfgAiSkill {[/size][/font][/size][/font]
[font=Consolas][size=2][font=Consolas][size=2]
   aimingAccuracy[] = {0, 0.2, 1, 0.39};[/size][/font][/size][/font][font=Consolas][size=2][color=#008000][font=Consolas][size=2][color=#008000][font=Consolas][size=2][color=#008000]
[/color][/size][/font][/color][/size][/font][/color][/size][/font][font=Consolas][size=2][font=Consolas][size=2]    aimingShake[] = {0, 0.2, 1, 0.5};
   aimingSpeed[] = {0, 0.25, 1, 0.8};
   endurance[] = {0, 0.2, 1, 1};
   spotDistance[] = {0, 0.85, 1, 1};
   spotTime[] = {0, 0.1, 1, 0.7};[/size][/font][/size][/font][font=Consolas][size=2][color=#008000][font=Consolas][size=2][color=#008000][font=Consolas][size=2][color=#008000]
[/color][/size][/font][/color][/size][/font][/color][/size][/font][font=Consolas][size=2][font=Consolas][size=2]    courage[] = {0, 0.45, 1, 1};
   reloadSpeed[] = {0, 0.1, 1, 0.7};
   commanding[] = {0, 0.5, 1, 1};
   general[] = {0, 1, 1, 1};
};[/size][/font][/size][/font]

I have checked the configs once Arma has loaded and these have properly overwritten the original config.

Now, as I understand it, these set up the skill values for minimum and maximum unit skill, so;

{0, 0.2, 1, 0.39}

sets up a skill value of 0.2 to 0.39 over a skill range of 0 thru 1. Seems clear enough.

However when I look at the skill array for the units in game, these values seem to have been ignored;

"Skills"
"======"
"                 +Bad Guy 1  +Bad Guy 2  +Bad Guy 3"
"                 +=========  +=========  +========="
"skill          : +0.466667   +0.2   +0.2"
"aimingAccuracy : +0.466667   +0.2   +0.2"
"aimingShake    : +0.466667   +0.2   +0.2"
"aimingSpeed    : +0.466667   +0.2   +0.2"
"endurance      : +0.466667   +0.2   +0.2"
"spotDistance   : +0.466667   +0.2   +0.2"
"spotTime       : +0.466667   +0.2   +0.2"
"courage        : +0.466667   +0.2   +0.2"
"reloadSpeed    : +0.466667   +0.2   +0.2"
"commanding     : +0.466667   +0.2   +0.2"
"general        : +0.466667   +0.2   +0.2"

The above 3 guys have simply taken on the skill level that have been set for them using the slider in the editor and had it applied across the board. If the skill ranges in CfgAISkill were taken into account then a unit who has a skill of 0.47, should have an aimingaccuracy of around 0.3 (halfway between 0.2 and 0.39). No matter what values I put in CfgAISkill, the values in game are always the same (i.e. taken directly from the overall skill of the unit).

Yes, I can change the skills array on the fly using script, but I wanted to understand what effect CfgAISkill has and how it is used in game. Is it irrelevant? The wiki is a bit short on answers here, and a thorough search of the forum didn't turn up any theory.

The aim of this is to eventually write my own AI routine (if I think I can add something to those already out there), but I want to understand it first.

Any ideas?

Share this post


Link to post
Share on other sites

a) Only very little official info is available for all AI values sadly.

b) Vote documentation tickets at the CIT.

c) See at the end of http://community.bistudio.com/wiki/CfgAISkill.

d) In short it is, what the skill level is for all units below a given unit level (minimum/at least value) (all below 0 have 0.2 in your example) and what the skill level is for all units above a given unit level (maximum/not more than value) (all above 1 have 0.39 in your example).

e) Units with in between unit skill have either linear, "random" (within the range) or some other interpolation for the skill value they get.

f) So much for the theory. It doesn't quite add up.

Share this post


Link to post
Share on other sites
a) Only very little official info is available for all AI values sadly.

b) Vote documentation tickets at the CIT.

c) See at the end of http://community.bistudio.com/wiki/CfgAISkill.

d) In short it is, what the skill level is for all units below a given unit level (minimum/at least value) (all below 0 have 0.2 in your example) and what the skill level is for all units above a given unit level (maximum/not more than value) (all above 1 have 0.39 in your example).

e) Units with in between unit skill have either linear, "random" (within the range) or some other interpolation for the skill value they get.

f) So much for the theory. It doesn't quite add up.

Cheers. Been putting in all kinds of crazy numbers tonight and it doesn't seem to make any difference whatsoever! Interestingly, if you change the skills-array in script it definitely does have an effect.

I thnk I understand the theory of what it is supposed to do, I am just not convinced it is actually doing anything!! It's almost like they maybe forgot to apply these skill factors from the config to the actual unit skills array.

Share this post


Link to post
Share on other sites

What is your config? Maybe there is the source problem.

Share this post


Link to post
Share on other sites
What is your config? Maybe there is the source problem.

My full redefine is ;

class CfgPatches {
 units[] = {};
 weapons[] = {};
 requiredVersion = 0.1;
 requiredAddons[] = {};
};
class CfgAiSkill {
aimingAccuracy[] = {0, 0.2, 1, 0.39};
aimingShake[] = {0, 0.2, 1, 0.5};
aimingSpeed[] = {0, 0.25, 1, 0.8};
endurance[] = {0, 0.2, 1, 1};
spotDistance[] = {0, 0.85, 1, 1};
spotTime[] = {0, 0.1, 1, 0.7};
courage[] = {0, 0.45, 1, 1};
reloadSpeed[] = {0, 0.1, 1, 0.7};
commanding[] = {0, 0.5, 1, 1};
general[] = {0, 1, 1, 1};
};

I can see it is working though because if I explore the classes in-game I can see the values I added for cfgAISkill. Although there is always the possibility that I am doing something really stupid! I am just wondering if there is some other 'switch' that needs to be set to get the engine to use the definitions in cfgAISkill? Not sure really - the more I play with the AI settings, the further back I seem to be getting!

Share this post


Link to post
Share on other sites

Yep it should be/is active. Your are lucky as cfgAiSkill is only defined in main config (bin\config.cpp) which is always loaded first.

Otherwise there would be a big chance of your config over-loaded by later loaded BI configs and therefore overriding your changes again.

(this is what requiredAddons is for/about)

Changing cfgAiSkill in a config certainly has an effect.

The question is how much, in what terms and in what way.

Only BI can really answer that. :|

Vote and add your questions:

> Feature #24408: Questions on CfgAISkill and setSkill array

https://dev-heaven.net/issues/24408

Share this post


Link to post
Share on other sites

Ok, thanks for you input. Maybe I am expecting a more drastic change and it's actually more subtle. Anyway I had already voted on the CIT ticket, so I added a comment to refer to my question here.

I am going to leave it for a couple of days and see if I can return to it with a fresh mind - I have run the same sequence over and over again so many times that I am starting to dream about it!!

Share this post


Link to post
Share on other sites

Well you can also try to submit a CIT ticket with obs vs exp and a repro.

If you are lucky, you may catch Suma's attention this way.

Share this post


Link to post
Share on other sites

This is an example of my conclusion:



Config:
spotDistance[] = {0 , 0.2, 1, 0.4}

An AI with Skill 0 has spotDistance 0.2,.

An AI with Skill 1 has spotDistance 0.4.

An AI with Skill between 0 and 1 has respective (probably linear) spotDistance.

Command setSkill:

setSkill ["spotDistance", 1]

Result: spotDistance 0.4. The spotDistance which is defined in the config for an AI with Skill 1.

Command skill:

skill "spotDistance"

Used on an AI with Editor Skill 1:

Result: 1

This means the AI has the Skill spotDistance like an AI with Skill 1, It is spotDistance 0.4, according to the config.

Share this post


Link to post
Share on other sites

That's very interesting and does seem sensible. Are these theoretical conclusions or actuals? I think I understand what you are saying when you set the spotdistance in code, this is a skill 'level', which subsequently has the modifier applied to it based on the config value?

So, there is no way of 'getting' what the actual spotdistance 'value' for a given skill is then, as it is a calculation between the Skill spotdistance and the config spotdistance.

Phew - it seems a convoluted way of doing it, but I can see it's flexibility. I promised myself a 48 hour break from AI though! I'm going to try it myself anyway in the morning!

Share this post


Link to post
Share on other sites

This conclusions comes from practice by making an addon which enables me to change all sub-skills on every AI from 0 to 1.

Basis:

class CfgAISkill {
aimingAccuracy[] = {0, 0, 1, 1};
aimingShake[] = {0, 0, 1, 1};
aimingSpeed[] = {0, 0, 1, 1};
endurance[] = {0, 0, 1, 1};
spotDistance[] = {0, 0, 1, 1};
spotTime[] = {0, 0, 1, 1};
courage[] = {0, 0, 1, 1};
reloadSpeed[] = {0, 0, 1, 1};
commanding[] = {0, 0, 1, 1};
general[] = {0, 0, 1, 1};
};

With this i get exactly what i need:

Command setSkill:

Code:

setSkill ["spotDistance", 0.75]

Result: spotDistance 0.75. The spotDistance which is defined in the config for an AI with Skill 0.75.

Command skill:

Code:

skill "spotDistance"

Used on an AI with Editor Skill 0.75:[/code]

Result: 0.75

This means the AI has the Skill spotDistance like an AI with Skill 0.75, It is spotDistance 0.75, according to the config.

Share this post


Link to post
Share on other sites

Heinbloed - thanks for the explanation and the example - much appreciated.

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×