Jump to content
Sign in to follow this  
maturin

Help the devs! Public service mission adaptation

Recommended Posts

Citizens of Altis!

The devs have just rolled out log-awaited AI accuracy tweaks on dev branch. They need detailed, empirical feedback from players.

Unfortunately, everyone is too lazy.

I've found an old A2 mission for Utes that would answer this purpose admirably, but I don't know how to transfer its location and scripts to the Stratis airfield. It should be a simple job, and the ArmA community needs a good Samaritan who can jump on the job ASAP.

I'm being intentionally dramatic, but development is at a critical phase, and your contributions here will directly influence the quality of the game upon release.

The devs have heard us, now we need to back them up.

Mission here: http://www.filedropper.com/fabtargetrangeutes

Good night and good luck.

Share this post


Link to post
Share on other sites

Hey maturin,

Damn filedropper is crap when I try to download the file to help !

Share this post


Link to post
Share on other sites

I'm running it right now on the dev branch stratis. I will provide the code and the result in the rpt in few minutes.

I had to change the target for an opfor soldier and it seems to work great.

---------- Post added at 17:20 ---------- Previous post was at 17:10 ----------

"# targetrange session begin"

"#"

"# Skill: 1 - Distance: 50 - Stance: up - Iterations: 21 of 20 - Shots fired: 45 - On target avg: 45%"

"# Skill: 1 - Distance: 50 - Stance: middle - Iterations: 21 of 20 - Shots fired: 47 - On target avg: 43%"

"# Skill: 1 - Distance: 50 - Stance: down - Iterations: 21 of 20 - Shots fired: 47 - On target avg: 43%"

"# Skill: 1 - Distance: 100 - Stance: up - Iterations: 21 of 20 - Shots fired: 39 - On target avg: 52%"

"# Skill: 1 - Distance: 100 - Stance: middle - Iterations: 21 of 20 - Shots fired: 39 - On target avg: 52%"

"# Skill: 1 - Distance: 100 - Stance: down - Iterations: 21 of 20 - Shots fired: 56 - On target avg: 36%"

first run it gave that. At 200 it was too far for the marksman. :(

here's the files needed: mission.sqm and main.sqf. That's all

Feel free to add your own touch...

mission.sqm

version=12;
class Mission
{
addOns[]=
{
	"a3_map_stratis",
	"A3_Characters_F_BLUFOR",
	"A3_Characters_F_Civil"
};
addOnsAuto[]=
{
	"A3_Characters_F_BLUFOR",
	"A3_Characters_F_Civil",
	"a3_map_stratis"
};
randomSeed=7835659;
class Intel
{
	timeOfChanges=1800.0002;
	startWeather=0.30000001;
	startWind=0.1;
	startWaves=0.1;
	forecastWeather=0.30000001;
	forecastWind=0.1;
	forecastWaves=0.1;
	forecastLightnings=0.1;
	year=2035;
	month=7;
	day=6;
	hour=12;
	minute=0;
	startFogBase=0.001;
	forecastFogBase=0.001;
	startFogDecay=0.0049999999;
	forecastFogDecay=0.0049999999;
};
class Groups
{
	items=2;
	class Item0
	{
		side="WEST";
		class Vehicles
		{
			items=2;
			class Item0
			{
				position[]={1653.4586,5.5,5470.3726};
				azimut=100;
				id=0;
				side="WEST";
				vehicle="B_soldier_M_F";
				leader=1;
				rank="CAPTAIN";
				skill=1;
				text="shooter";
				init="_nil = [this, spotter, ""O_Soldier_F"", [50, 100, 200], [""up"", ""middle"", ""down""], 20 ] execVM  ""main.sqf"";";
			};
			class Item1
			{
				position[]={1653.317,5.5,5469.5332};
				azimut=165;
				id=1;
				side="WEST";
				vehicle="B_Soldier_F";
				rank="CORPORAL";
				skill=1;
				text="spotter";
				init="this setVehicleAmmo 0;";
			};
		};
	};
	class Item1
	{
		side="CIV";
		class Vehicles
		{
			items=1;
			class Item0
			{
				position[]={1652.1278,5.5,5469.9976};
				azimut=100;
				id=2;
				side="CIV";
				vehicle="C_man_1";
				player="PLAYER COMMANDER";
				leader=1;
				skill=0.60000002;
			};
		};
	};
};
};
class Intro
{
addOns[]=
{
	"a3_map_stratis"
};
addOnsAuto[]=
{
	"a3_map_stratis"
};
randomSeed=5051319;
class Intel
{
	timeOfChanges=1800.0002;
	startWeather=0.30000001;
	startWind=0.1;
	startWaves=0.1;
	forecastWeather=0.30000001;
	forecastWind=0.1;
	forecastWaves=0.1;
	forecastLightnings=0.1;
	year=2035;
	month=7;
	day=6;
	hour=12;
	minute=0;
	startFogBase=0.001;
	forecastFogBase=0.001;
	startFogDecay=0.0049999999;
	forecastFogDecay=0.0049999999;
};
};
class OutroWin
{
addOns[]=
{
	"a3_map_stratis"
};
addOnsAuto[]=
{
	"a3_map_stratis"
};
randomSeed=2531566;
class Intel
{
	timeOfChanges=1800.0002;
	startWeather=0.30000001;
	startWind=0.1;
	startWaves=0.1;
	forecastWeather=0.30000001;
	forecastWind=0.1;
	forecastWaves=0.1;
	forecastLightnings=0.1;
	year=2035;
	month=7;
	day=6;
	hour=12;
	minute=0;
	startFogBase=0.001;
	forecastFogBase=0.001;
	startFogDecay=0.0049999999;
	forecastFogDecay=0.0049999999;
};
};
class OutroLoose
{
addOns[]=
{
	"a3_map_stratis"
};
addOnsAuto[]=
{
	"a3_map_stratis"
};
randomSeed=3227307;
class Intel
{
	timeOfChanges=1800.0002;
	startWeather=0.30000001;
	startWind=0.1;
	startWaves=0.1;
	forecastWeather=0.30000001;
	forecastWind=0.1;
	forecastWaves=0.1;
	forecastLightnings=0.1;
	year=2035;
	month=7;
	day=6;
	hour=12;
	minute=0;
	startFogBase=0.001;
	forecastFogBase=0.001;
	startFogDecay=0.0049999999;
	forecastFogDecay=0.0049999999;
};
};

And the main.sqf that I had to modify due to a division by zero. I'm not sure it was that bad for the result...

/*
--------------------------------
How to  script call this script:
--------------------------------

_nil = [<shooter>, <spotter>, <target type>, <distance array>, <stance array>, <iterations number>];

<shooter> = unit fining on target. Should be a WEST unit, otherwise <target type> should be changerd accordingly. <shooter> should be manually placed on map.
<spotter> = unit helping identify target as foe, needed for far targets. <spotter> should be manually placed on map.
<target type> = type of target, e.g. "TargetE". 
<distance array> =  array of numbers representing distances for target.
<stance array>  =  array of string representing possible stance for <shooter>. Possible values are "up", "middle", "down".
<iterations number> = number of targets spawned foreach distance and stance stettings.

--------------------------------
Stats
--------------------------------

stats are logged to .rpt file.
*/

private["_unit", "_spotter", "_target_type", "_distances", "_stances", "_max_iterations"];

if( count _this > 0 ) then { _unit = _this select 0; };
if( count _this > 1 ) then { _spotter = _this select 1; };
if( count _this > 2 ) then { _target_type = _this select 2; };
if( count _this > 3 ) then { _distances = _this select 3; };
if( count _this > 4 ) then { _stances = _this select 4 };
if( count _this > 5 ) then { _max_iterations = _this select 5; };

//sleep 1;
//hintc format["%1 %2 %3 %4 %5 %6", _unit, _spotter, _target_type, _stances, _distances, _max_iterations];

if( isNil "_unit" ) exitWith{ hint "ERROR: Shooter is undefined"; };
if( isNil "_spotter" ) exitWith{ hint "ERROR: Spotter is undefined"; };
if( isNil "_target_type") then { _target_type = "TargetE"; };
if( isNil "_distances") then { _distances = [50, 100, 200]; };
if( isNil "_stances") then { _stances = ["up", "middle", "down"]; };
if( isNil "_max_iterations") then { _max_iterations = 20; };

_planned_iterations = (count _stances) * (count _distances) * _max_iterations;

diag_log "# targetrange session begin";
diag_log "#";

_time1 = time;

sleep 1;

{
if(_x != primaryWeapon _unit) then
{
	_unit removeWeapon _x;
};

} foreach weapons _unit;

_unit setvariable ["shots_fired", 0];
_unit setvariable ["iterations", 1];

_spotter allowdamage false;
_spotter disableAI "move";

_unit addEventHandler ["fired", { (_this select 0) setvariable ["shots_fired", ((_this select 0) getVariable "shots_fired") + 1]; (_this select 0) setVehicleAmmo 1; }];

_n = 1;

{
_distance = _x;

_target_pos_x = (position _unit select 0) + _distance;
_target_pos_y = (position _unit select 1) + 0;

_spotter setpos [_target_pos_x, _target_pos_y + 10];
_spotter setdir 180;

{
	_stance = _x;
	_iterations = 1;
	_perc = 0;

	_unit setunitpos _stance;

	_unit setVariable ["shots_fired", 0];

	while {	_iterations <= _max_iterations} do 
	{
		hintsilent format["TARGETRANGE SESSION\nIn progress, please wait\nRunning iteration %1 of %2", _n, _planned_iterations];

		_target = _target_type createVehicle [_target_pos_x, _target_pos_y];
		_target setdir 90;

		_target setvariable["hit", false];

		_eh_n = _target addEventHandler ["hit", { (_this select 0) setdamage 1;(_this select 0) setvariable["hit", true]; } ];

		_spotter reveal _target;
		_unit reveal _target;
		//sleep .5;

		_target addrating -100000;
		_unit lookAt _target;
		_unit doTarget _target;
		_unit doWatch _target;
		_unit doFire _target;

		waitUntil{ _target getVariable "hit" };

		_target removeEventHandler["hit", _eh_n];
		deleteVehicle _target;
		_target = nil;

		_unit doTarget objNull;
		_unit doWatch objNull;
		_unit setdir 180;

		_perc = if (_unit getVariable "shots_fired" == 0) then {0} else {ceil ( 100 * _iterations / (_unit getVariable "shots_fired") );};

		_iterations = _iterations + 1;
		_n = _n + 1;

		sleep 1;
	};

	_line01 = format["Skill: %1", skill _unit];
	_line02 = format["Distance: %1", _distance];
	_line03 = format["Stance: %1", _stance];		
	_line04 = format["Iterations: %1 of %2", _iterations, _max_iterations];
	_line05 = format["Shots fired: %1", _unit getVariable "shots_fired"];		
	_line06 = format["On target avg: %1%2", _perc, "%" ];

	_msg = format["# %1 - %2 - %3 - %4 - %5 - %6", _line01, _line02, _line03, _line04, _line05, _line06];

	_unit globalchat _msg;
	diag_log _msg;

} foreach _stances;

} foreach _distances;

_time2 = time;

diag_log "#";
diag_log format["# Targetrange session end. Duration: %1 seconds", _time2 - _time1];

hintc "Run completed, check your .rpt log for stats";

---------- Post added at 17:22 ---------- Previous post was at 17:20 ----------

Btw, I'm running 0.77.109586

Edited by holo89
bad version of the files

Share this post


Link to post
Share on other sites

That's fantastic! Thanks a bunch.

If you post your AI skill and precision settings, I'll show your data in the AI dev thread.

Share this post


Link to post
Share on other sites

I got the marksman to complete the test by moving the team on the side of a hill.

"# targetrange session begin"

"#"

"# Skill: 1 - Distance: 50 - Stance: up - Iterations: 21 of 20 - Shots fired: 41 - On target avg: 49%"

"# Skill: 1 - Distance: 50 - Stance: middle - Iterations: 21 of 20 - Shots fired: 62 - On target avg: 33%"

"# Skill: 1 - Distance: 50 - Stance: down - Iterations: 21 of 20 - Shots fired: 36 - On target avg: 56%"

"# Skill: 1 - Distance: 100 - Stance: up - Iterations: 21 of 20 - Shots fired: 54 - On target avg: 38%"

"# Skill: 1 - Distance: 100 - Stance: middle - Iterations: 21 of 20 - Shots fired: 83 - On target avg: 25%"

"# Skill: 1 - Distance: 100 - Stance: down - Iterations: 21 of 20 - Shots fired: 60 - On target avg: 34%"

"# Skill: 1 - Distance: 200 - Stance: up - Iterations: 21 of 20 - Shots fired: 64 - On target avg: 32%"

"# Skill: 1 - Distance: 200 - Stance: middle - Iterations: 21 of 20 - Shots fired: 85 - On target avg: 24%"

"# Skill: 1 - Distance: 200 - Stance: down - Iterations: 21 of 20 - Shots fired: 75 - On target avg: 27%"

"#"

"# Targetrange session end. Duration: 831.341 seconds"

here the mission.sqm I used to get those results:

version=12;
class Mission
{
addOns[]=
{
	"a3_map_stratis",
	"A3_Characters_F_BLUFOR",
	"A3_Characters_F_Civil"
};
addOnsAuto[]=
{
	"A3_Characters_F_BLUFOR",
	"A3_Characters_F_Civil",
	"a3_map_stratis"
};
randomSeed=7835659;
class Intel
{
	timeOfChanges=1800.0002;
	startWeather=0.30000001;
	startWind=0.1;
	startWaves=0.1;
	forecastWeather=0.30000001;
	forecastWind=0.1;
	forecastWaves=0.1;
	forecastLightnings=0.1;
	year=2035;
	month=7;
	day=6;
	hour=12;
	minute=0;
	startFogBase=0.001;
	forecastFogBase=0.001;
	startFogDecay=0.0049999999;
	forecastFogDecay=0.0049999999;
};
class Groups
{
	items=2;
	class Item0
	{
		side="WEST";
		class Vehicles
		{
			items=2;
			class Item0
			{
				position[]={2402.2761,60.690536,2195.3735};
				azimut=100;
				id=0;
				side="WEST";
				vehicle="B_soldier_M_F";
				leader=1;
				rank="CAPTAIN";
				skill=1;
				text="shooter";
				init="_nil = [this, spotter, ""O_Soldier_F"", [50, 100, 200], [""up"", ""middle"", ""down""], 20 ] execVM  ""main.sqf"";";
			};
			class Item1
			{
				position[]={2402.094,60.313126,2194.6978};
				azimut=165;
				id=1;
				side="WEST";
				vehicle="B_Soldier_F";
				rank="CORPORAL";
				skill=1;
				text="spotter";
				init="this setVehicleAmmo 0;";
			};
		};
	};
	class Item1
	{
		side="CIV";
		class Vehicles
		{
			items=1;
			class Item0
			{
				position[]={2400.9048,60.970051,2195.1621};
				azimut=100;
				id=2;
				side="CIV";
				vehicle="C_man_1";
				player="PLAYER COMMANDER";
				leader=1;
				skill=0.60000002;
			};
		};
	};
};
};
class Intro
{
addOns[]=
{
	"a3_map_stratis"
};
addOnsAuto[]=
{
	"a3_map_stratis"
};
randomSeed=5051319;
class Intel
{
	timeOfChanges=1800.0002;
	startWeather=0.30000001;
	startWind=0.1;
	startWaves=0.1;
	forecastWeather=0.30000001;
	forecastWind=0.1;
	forecastWaves=0.1;
	forecastLightnings=0.1;
	year=2035;
	month=7;
	day=6;
	hour=12;
	minute=0;
	startFogBase=0.001;
	forecastFogBase=0.001;
	startFogDecay=0.0049999999;
	forecastFogDecay=0.0049999999;
};
};
class OutroWin
{
addOns[]=
{
	"a3_map_stratis"
};
addOnsAuto[]=
{
	"a3_map_stratis"
};
randomSeed=2531566;
class Intel
{
	timeOfChanges=1800.0002;
	startWeather=0.30000001;
	startWind=0.1;
	startWaves=0.1;
	forecastWeather=0.30000001;
	forecastWind=0.1;
	forecastWaves=0.1;
	forecastLightnings=0.1;
	year=2035;
	month=7;
	day=6;
	hour=12;
	minute=0;
	startFogBase=0.001;
	forecastFogBase=0.001;
	startFogDecay=0.0049999999;
	forecastFogDecay=0.0049999999;
};
};
class OutroLoose
{
addOns[]=
{
	"a3_map_stratis"
};
addOnsAuto[]=
{
	"a3_map_stratis"
};
randomSeed=3227307;
class Intel
{
	timeOfChanges=1800.0002;
	startWeather=0.30000001;
	startWind=0.1;
	startWaves=0.1;
	forecastWeather=0.30000001;
	forecastWind=0.1;
	forecastWaves=0.1;
	forecastLightnings=0.1;
	year=2035;
	month=7;
	day=6;
	hour=12;
	minute=0;
	startFogBase=0.001;
	forecastFogBase=0.001;
	startFogDecay=0.0049999999;
	forecastFogDecay=0.0049999999;
};
};

The skill is 1 and the rest is by default.

I'll run another test with the whole array of skills of the spotter and shooter if you whish.

Regards,

Holo.

Share this post


Link to post
Share on other sites

I've created the mission for myself with your code now.

Can you figure out why the shooter stops shooting? Are they running out of ammo?

Share this post


Link to post
Share on other sites

they seem not to see the target sometime and get stuck in a search pattern.

I'll try a modif on the code to reveal again and stuff after a certain number of seconds.

I'll let you know when it's finished.

edit: btw, the whole array of skill is 1

edit2: it cannot get out of ammo, the fired event has a setVehicleAmmo 1 to the shooter (_unit)

Edited by holo89

Share this post


Link to post
Share on other sites

Run1

"# Skill: 1 - Distance: 50 - Stance: up - Iterations: 21 of 20 - Shots fired: 52 - On target avg: 39%"

"# Skill: 1 - Distance: 50 - Stance: middle - Iterations: 21 of 20 - Shots fired: 50 - On target avg: 40%"

"# Skill: 1 - Distance: 50 - Stance: down - Iterations: 21 of 20 - Shots fired: 50 - On target avg: 40%"

"# Skill: 1 - Distance: 100 - Stance: up - Iterations: 21 of 20 - Shots fired: 66 - On target avg: 31%"

"# Skill: 1 - Distance: 100 - Stance: middle - Iterations: 21 of 20 - Shots fired: 68 - On target avg: 30%"

"# Skill: 1 - Distance: 100 - Stance: down - Iterations: 21 of 20 - Shots fired: 68 - On target avg: 30%"

"# Skill: 1 - Distance: 200 - Stance: up - Iterations: 21 of 20 - Shots fired: 108 - On target avg: 19%"

"# Skill: 1 - Distance: 200 - Stance: middle - Iterations: 21 of 20 - Shots fired: 80 - On target avg: 25%"

"# Skill: 1 - Distance: 200 - Stance: down - Iterations: 21 of 20 - Shots fired: 70 - On target avg: 29%"

"#"

"# Targetrange session end. Duration: 769.508 seconds"

Will run another time for consistency.

The MAIN problem as I see it is that the AI will snap the first shot missing to the right by quite a margin.

Run2

"# Skill: 1 - Distance: 50 - Stance: up - Iterations: 21 of 20 - Shots fired: 50 - On target avg: 40%"

"# Skill: 1 - Distance: 50 - Stance: middle - Iterations: 21 of 20 - Shots fired: 48 - On target avg: 42%"

"# Skill: 1 - Distance: 50 - Stance: down - Iterations: 21 of 20 - Shots fired: 54 - On target avg: 38%"

"# Skill: 1 - Distance: 100 - Stance: up - Iterations: 21 of 20 - Shots fired: 72 - On target avg: 28%"

"# Skill: 1 - Distance: 100 - Stance: middle - Iterations: 21 of 20 - Shots fired: 54 - On target avg: 38%"

"# Skill: 1 - Distance: 100 - Stance: down - Iterations: 21 of 20 - Shots fired: 51 - On target avg: 40%"

"# Skill: 1 - Distance: 200 - Stance: up - Iterations: 21 of 20 - Shots fired: 73 - On target avg: 28%"

"# Skill: 1 - Distance: 200 - Stance: middle - Iterations: 21 of 20 - Shots fired: 62 - On target avg: 33%"

"# Skill: 1 - Distance: 200 - Stance: down - Iterations: 21 of 20 - Shots fired: 91 - On target avg: 22%"

"#"

"# Targetrange session end. Duration: 695.176 seconds"

Edited by Kremator
getting rid of nonnetwork objects

Share this post


Link to post
Share on other sites

Got the modif. and it seems to restart well now.

The log:

"# targetrange session begin"

"#"

"# Spotter skill array: aimingAccuracy=1 aimingShake=1 aimingSpeed=1 endurance=1 spotDistance=1 spotTime=1 courage=1 reloadSpeed=1 commanding=1"

"# Shooter skill array: aimingAccuracy=1 aimingShake=1 aimingSpeed=1 endurance=1 spotDistance=1 spotTime=1 courage=1 reloadSpeed=1 commanding=1"

"# Skill: 1 - Distance: 50 - Stance: up - Iterations: 21 of 20 - Shots fired: 44 - On target avg: 46%"

"# Skill: 1 - Distance: 50 - Stance: middle - Iterations: 21 of 20 - Shots fired: 41 - On target avg: 49%"

"# Skill: 1 - Distance: 50 - Stance: down - Iterations: 21 of 20 - Shots fired: 43 - On target avg: 47%"

"# Skill: 1 - Distance: 100 - Stance: up - Iterations: 21 of 20 - Shots fired: 65 - On target avg: 31%"

"# Skill: 1 - Distance: 100 - Stance: middle - Iterations: 21 of 20 - Shots fired: 48 - On target avg: 42%"

"# Skill: 1 - Distance: 100 - Stance: down - Iterations: 21 of 20 - Shots fired: 53 - On target avg: 38%"

"# reset 20 sec."

"# Skill: 1 - Distance: 200 - Stance: up - Iterations: 21 of 20 - Shots fired: 78 - On target avg: 26%"

"# reset 20 sec."

"# reset 20 sec."

"# Skill: 1 - Distance: 200 - Stance: middle - Iterations: 21 of 20 - Shots fired: 93 - On target avg: 22%"

"# Skill: 1 - Distance: 200 - Stance: down - Iterations: 21 of 20 - Shots fired: 92 - On target avg: 22%"

"#"

"# Targetrange session end. Duration: 832.086 seconds"

This is run in the grass by the way. So maybe it's better on concrete?

main.sqf

/*
--------------------------------
How to  script call this script:
--------------------------------

_nil = [<shooter>, <spotter>, <target type>, <distance array>, <stance array>, <iterations number>];

<shooter> = unit fining on target. Should be a WEST unit, otherwise <target type> should be changerd accordingly. <shooter> should be manually placed on map.
<spotter> = unit helping identify target as foe, needed for far targets. <spotter> should be manually placed on map.
<target type> = type of target, e.g. "TargetE". 
<distance array> =  array of numbers representing distances for target.
<stance array>  =  array of string representing possible stance for <shooter>. Possible values are "up", "middle", "down".
<iterations number> = number of targets spawned foreach distance and stance stettings.

--------------------------------
Stats
--------------------------------

stats are logged to .rpt file.
*/

private["_unit", "_spotter", "_target_type", "_distances", "_stances", "_max_iterations"];

if( count _this > 0 ) then { _unit = _this select 0; };
if( count _this > 1 ) then { _spotter = _this select 1; };
if( count _this > 2 ) then { _target_type = _this select 2; };
if( count _this > 3 ) then { _distances = _this select 3; };
if( count _this > 4 ) then { _stances = _this select 4 };
if( count _this > 5 ) then { _max_iterations = _this select 5; };

//sleep 1;
//hintc format["%1 %2 %3 %4 %5 %6", _unit, _spotter, _target_type, _stances, _distances, _max_iterations];

if( isNil "_unit" ) exitWith{ hint "ERROR: Shooter is undefined"; };
if( isNil "_spotter" ) exitWith{ hint "ERROR: Spotter is undefined"; };
if( isNil "_target_type") then { _target_type = "TargetE"; };
if( isNil "_distances") then { _distances = [50, 100, 200]; };
if( isNil "_stances") then { _stances = ["up", "middle", "down"]; };
if( isNil "_max_iterations") then { _max_iterations = 20; };

_planned_iterations = (count _stances) * (count _distances) * _max_iterations;

diag_log "# targetrange session begin";
diag_log "#";

diag_log format [
"# Spotter skill array: aimingAccuracy=%1 aimingShake=%2 aimingSpeed=%3 endurance=%4 spotDistance=%5 spotTime=%6 courage=%7 reloadSpeed=%8 commanding=%9",
_spotter skill "aimingAccuracy", 
_spotter skill "aimingShake", 
_spotter skill "aimingSpeed", 
_spotter skill "endurance", 
_spotter skill "spotDistance", 
_spotter skill "spotTime", 
_spotter skill "courage", 
_spotter skill "reloadSpeed", 
_spotter skill "commanding"];

diag_log format [
"# Shooter skill array: aimingAccuracy=%1 aimingShake=%2 aimingSpeed=%3 endurance=%4 spotDistance=%5 spotTime=%6 courage=%7 reloadSpeed=%8 commanding=%9",
_unit skill "aimingAccuracy", 
_unit skill "aimingShake", 
_unit skill "aimingSpeed", 
_unit skill "endurance", 
_unit skill "spotDistance", 
_unit skill "spotTime", 
_unit skill "courage", 
_unit skill "reloadSpeed", 
_unit skill "commanding"];

_time1 = time;

sleep 1;

{
if(_x != primaryWeapon _unit) then
{
	_unit removeWeapon _x;
};

} foreach weapons _unit;

_unit setvariable ["shots_fired", 0];
_unit setvariable ["iterations", 1];

_spotter allowdamage false;
_spotter disableAI "move";

_unit addEventHandler ["fired", { (_this select 0) setvariable ["shots_fired", ((_this select 0) getVariable "shots_fired") + 1]; (_this select 0) setVehicleAmmo 1; }];

_n = 1;
_lastHit=time;

{
_distance = _x;

_target_pos_x = (position _unit select 0) + _distance;
_target_pos_y = (position _unit select 1) + 0;

_spotter setpos [_target_pos_x, _target_pos_y + 10];
_spotter setdir 180;

{
	_stance = _x;
	_iterations = 1;
	_perc = 0;

	_unit setunitpos _stance;

	_unit setVariable ["shots_fired", 0];

	while {	_iterations <= _max_iterations} do 
	{
		hintsilent format["TARGETRANGE SESSION\nIn progress, please wait\nRunning iteration %1 of %2", _n, _planned_iterations];

		_target = _target_type createVehicle [_target_pos_x, _target_pos_y];
		_target setdir 90;

		_target setvariable["hit", false];

		_eh_n = _target addEventHandler ["hit", { (_this select 0) setdamage 1;(_this select 0) setvariable["hit", true]; } ];

		_spotter reveal _target;
		_unit reveal _target;
		//sleep .5;

		_target addrating -100000;
		_unit lookAt _target;
		_unit doTarget _target;
		_unit doWatch _target;
		_unit doFire _target;

		//waitUntil{ _target getVariable "hit" };

           While {!(_target getVariable "hit")} do {
               if (time - _lastHit > 20) then {
                   _spotter reveal _target;
                   _unit reveal _target;
                   _unit lookAt _target;
                   _unit doTarget _target;
                   _unit doWatch _target;
                   _unit doFire _target;
                   _lastHit=time;
                   _unit globalchat "# reset 20 sec.";
                   diag_log "# reset 20 sec.";
               };
           };

           _lastHit=time;

		_target removeEventHandler["hit", _eh_n];
		deleteVehicle _target;
		_target = nil;

		_unit doTarget objNull;
		_unit doWatch objNull;
		_unit setdir 180;

		_perc = if (_unit getVariable "shots_fired" == 0) then {0} else {ceil ( 100 * _iterations / (_unit getVariable "shots_fired") );};

		_iterations = _iterations + 1;
		_n = _n + 1;

		sleep 1;
	};

	_line01 = format["Skill: %1", skill _unit];
	_line02 = format["Distance: %1", _distance];
	_line03 = format["Stance: %1", _stance];		
	_line04 = format["Iterations: %1 of %2", _iterations, _max_iterations];
	_line05 = format["Shots fired: %1", _unit getVariable "shots_fired"];		
	_line06 = format["On target avg: %1%2", _perc, "%" ];

	_msg = format["# %1 - %2 - %3 - %4 - %5 - %6", _line01, _line02, _line03, _line04, _line05, _line06];

	_unit globalchat _msg;
	diag_log _msg;

} foreach _stances;

} foreach _distances;

_time2 = time;

diag_log "#";
diag_log format["# Targetrange session end. Duration: %1 seconds", _time2 - _time1];

hintc "Run completed, check your .rpt log for stats";

---------- Post added at 19:56 ---------- Previous post was at 19:39 ----------

Run1

Will run another time for consistency.

The MAIN problem as I see it is that the AI will snap the first shot missing to the right by quite a margin.

Run2

Yeah, I did realised that too. It seem to miss the first shot "almost" every time. The way the script is done, the shooter has to turn 90 deg to the left to acquire the target. It would be that it shoot too fast. But as the targets generally moves, it may be a tactic to shoot one bullet just before. It may have better results on the field with real target??

I have not tried with another class though. But the range would have to be adjusted also I think.

---------- Post added at 20:39 ---------- Previous post was at 19:56 ----------

here with an AutoRifleman just for fun.

It does shoot few rounds even after a hit, and for now, it does count as shots. I'll take a look to see if I can change that. That only shots fired while target is alive is counted in.

"# targetrange session begin"

"#"

"# spotter:B_Soldier_F Shooter:B_soldier_AR_F"

"# Spotter skill array: aimingAccuracy=1 aimingShake=1 aimingSpeed=1 endurance=1 spotDistance=1 spotTime=1 courage=1 reloadSpeed=1 commanding=1"

"# Shooter skill array: aimingAccuracy=1 aimingShake=1 aimingSpeed=1 endurance=1 spotDistance=1 spotTime=1 courage=1 reloadSpeed=1 commanding=1"

"# Skill: 1 - Distance: 50 - Stance: up - Iterations: 21 of 20 - Shots fired: 208 - On target avg: 10%"

"# Skill: 1 - Distance: 50 - Stance: middle - Iterations: 21 of 20 - Shots fired: 240 - On target avg: 9%"

"# Skill: 1 - Distance: 50 - Stance: down - Iterations: 21 of 20 - Shots fired: 176 - On target avg: 12%"

"# Skill: 1 - Distance: 100 - Stance: up - Iterations: 21 of 20 - Shots fired: 303 - On target avg: 7%"

"# Skill: 1 - Distance: 100 - Stance: middle - Iterations: 21 of 20 - Shots fired: 184 - On target avg: 12%"

"# Skill: 1 - Distance: 100 - Stance: down - Iterations: 21 of 20 - Shots fired: 224 - On target avg: 10%"

"# Skill: 1 - Distance: 200 - Stance: up - Iterations: 21 of 20 - Shots fired: 217 - On target avg: 10%"

"# Skill: 1 - Distance: 200 - Stance: middle - Iterations: 21 of 20 - Shots fired: 224 - On target avg: 10%"

"# Skill: 1 - Distance: 200 - Stance: down - Iterations: 21 of 20 - Shots fired: 232 - On target avg: 9%"

"#"

"# Targetrange session end. Duration: 797.52 seconds"

With the modification to count only bullets shot when target is active, the AutoRifleman is doing better:

"# targetrange session begin"

"#"

"# spotter:B_Soldier_F Shooter:B_soldier_AR_F"

"# Spotter skill array: aimingAccuracy=1 aimingShake=1 aimingSpeed=1 endurance=1 spotDistance=1 spotTime=1 courage=1 reloadSpeed=1 commanding=1"

"# Shooter skill array: aimingAccuracy=1 aimingShake=1 aimingSpeed=1 endurance=1 spotDistance=1 spotTime=1 courage=1 reloadSpeed=1 commanding=1"

"# Skill: 1 - Distance: 50 - Stance: up - Iterations: 21 of 20 - Shots fired: 122 - On target avg: 17%"

"# Skill: 1 - Distance: 50 - Stance: middle - Iterations: 21 of 20 - Shots fired: 123 - On target avg: 17%"

"# Skill: 1 - Distance: 50 - Stance: down - Iterations: 21 of 20 - Shots fired: 48 - On target avg: 42%"

"# Skill: 1 - Distance: 100 - Stance: up - Iterations: 21 of 20 - Shots fired: 194 - On target avg: 11%"

"# Skill: 1 - Distance: 100 - Stance: middle - Iterations: 21 of 20 - Shots fired: 264 - On target avg: 8%"

"# Skill: 1 - Distance: 100 - Stance: down - Iterations: 21 of 20 - Shots fired: 104 - On target avg: 20%"

"# Skill: 1 - Distance: 200 - Stance: up - Iterations: 21 of 20 - Shots fired: 281 - On target avg: 8%"

"# Skill: 1 - Distance: 200 - Stance: middle - Iterations: 21 of 20 - Shots fired: 229 - On target avg: 9%"

"# Skill: 1 - Distance: 200 - Stance: down - Iterations: 21 of 20 - Shots fired: 172 - On target avg: 12%"

"#"

"# Targetrange session end. Duration: 637.908 seconds"

---------- Post added at 21:51 ---------- Previous post was at 20:39 ----------

Here the medic, he did not bad:

I added some more stats like Min Max and how many OneShot he got.

"# targetrange session begin"

"#"

"# spotter:B_Soldier_F Shooter:B_medic_F"

"# Spotter skill array: aimingAccuracy=1 aimingShake=1 aimingSpeed=1 endurance=1 spotDistance=1 spotTime=1 courage=1 reloadSpeed=1 commanding=1"

"# Shooter skill array: aimingAccuracy=1 aimingShake=1 aimingSpeed=1 endurance=1 spotDistance=1 spotTime=1 courage=1 reloadSpeed=1 commanding=1"

Fresnel k must be >0, given n=2.51,k=0

"# Skill: 1 - Distance: 50 - Stance: up - Iterations: 21 of 20 - Shots fired: 45 - On target avg: 45% - Best: 1 - Worst: 6 - One shot: 5"

"# Skill: 1 - Distance: 50 - Stance: middle - Iterations: 21 of 20 - Shots fired: 46 - On target avg: 44% - Best: 1 - Worst: 4 - One shot: 4"

"# Skill: 1 - Distance: 50 - Stance: down - Iterations: 21 of 20 - Shots fired: 50 - On target avg: 40% - Best: 1 - Worst: 6 - One shot: 5"

"# Skill: 1 - Distance: 100 - Stance: up - Iterations: 21 of 20 - Shots fired: 64 - On target avg: 32% - Best: 1 - Worst: 9 - One shot: 4"

"# Skill: 1 - Distance: 100 - Stance: middle - Iterations: 21 of 20 - Shots fired: 61 - On target avg: 33% - Best: 1 - Worst: 6 - One shot: 1"

"# Skill: 1 - Distance: 100 - Stance: down - Iterations: 21 of 20 - Shots fired: 76 - On target avg: 27% - Best: 1 - Worst: 10 - One shot: 3"

"# Skill: 1 - Distance: 200 - Stance: up - Iterations: 21 of 20 - Shots fired: 79 - On target avg: 26% - Best: 1 - Worst: 9 - One shot: 1"

"# Skill: 1 - Distance: 200 - Stance: middle - Iterations: 21 of 20 - Shots fired: 71 - On target avg: 29% - Best: 1 - Worst: 8 - One shot: 2"

"# Skill: 1 - Distance: 200 - Stance: down - Iterations: 21 of 20 - Shots fired: 88 - On target avg: 23% - Best: 1 - Worst: 9 - One shot: 2"

"#"

"# Targetrange session end. Duration: 815.821 seconds"

/*
--------------------------------
How to  script call this script:
--------------------------------

_nil = [<shooter>, <spotter>, <target type>, <distance array>, <stance array>, <iterations number>];

<shooter> = unit fining on target. Should be a WEST unit, otherwise <target type> should be changerd accordingly. <shooter> should be manually placed on map.
<spotter> = unit helping identify target as foe, needed for far targets. <spotter> should be manually placed on map.
<target type> = type of target, e.g. "TargetE". 
<distance array> =  array of numbers representing distances for target.
<stance array>  =  array of string representing possible stance for <shooter>. Possible values are "up", "middle", "down".
<iterations number> = number of targets spawned foreach distance and stance stettings.

--------------------------------
Stats
--------------------------------

stats are logged to .rpt file.
*/
countIn=false;

private["_unit", "_spotter", "_target_type", "_distances", "_stances", "_max_iterations"];

if( count _this > 0 ) then { _unit = _this select 0; };
if( count _this > 1 ) then { _spotter = _this select 1; };
if( count _this > 2 ) then { _target_type = _this select 2; };
if( count _this > 3 ) then { _distances = _this select 3; };
if( count _this > 4 ) then { _stances = _this select 4 };
if( count _this > 5 ) then { _max_iterations = _this select 5; };

//sleep 1;
//hintc format["%1 %2 %3 %4 %5 %6", _unit, _spotter, _target_type, _stances, _distances, _max_iterations];

if( isNil "_unit" ) exitWith{ hint "ERROR: Shooter is undefined"; };
if( isNil "_spotter" ) exitWith{ hint "ERROR: Spotter is undefined"; };
if( isNil "_target_type") then { _target_type = "TargetE"; };
if( isNil "_distances") then { _distances = [50, 100, 200]; };
if( isNil "_stances") then { _stances = ["up", "middle", "down"]; };
if( isNil "_max_iterations") then { _max_iterations = 20; };

_planned_iterations = (count _stances) * (count _distances) * _max_iterations;

diag_log "# targetrange session begin";
diag_log "#";

diag_log format ["# spotter:%1 Shooter:%2", typeOf _spotter, typeOf _unit];
diag_log format [
"# Spotter skill array: aimingAccuracy=%1 aimingShake=%2 aimingSpeed=%3 endurance=%4 spotDistance=%5 spotTime=%6 courage=%7 reloadSpeed=%8 commanding=%9",
_spotter skill "aimingAccuracy", 
_spotter skill "aimingShake", 
_spotter skill "aimingSpeed", 
_spotter skill "endurance", 
_spotter skill "spotDistance", 
_spotter skill "spotTime", 
_spotter skill "courage", 
_spotter skill "reloadSpeed", 
_spotter skill "commanding"];

diag_log format [
"# Shooter skill array: aimingAccuracy=%1 aimingShake=%2 aimingSpeed=%3 endurance=%4 spotDistance=%5 spotTime=%6 courage=%7 reloadSpeed=%8 commanding=%9",
_unit skill "aimingAccuracy", 
_unit skill "aimingShake", 
_unit skill "aimingSpeed", 
_unit skill "endurance", 
_unit skill "spotDistance", 
_unit skill "spotTime", 
_unit skill "courage", 
_unit skill "reloadSpeed", 
_unit skill "commanding"];

_time1 = time;

sleep 1;

{
if(_x != primaryWeapon _unit) then
{
	_unit removeWeapon _x;
};

} foreach weapons _unit;

_unit setvariable ["shots_fired", 0];
_unit setvariable ["iterations", 1];

_spotter allowdamage false;
_spotter disableAI "move";

_unit addEventHandler ["fired", { 
   if (countIn) then {
       (_this select 0) setvariable ["shots_fired", ((_this select 0) getVariable "shots_fired") + 1];
   };
   (_this select 0) setVehicleAmmo 1; 
}];

_n = 1;
_lastHit=time;

{
_distance = _x;

_target_pos_x = (position _unit select 0) + _distance;
_target_pos_y = (position _unit select 1) + 0;

_spotter setpos [_target_pos_x, _target_pos_y + 10];
_spotter setdir 180;

{
	_stance = _x;
	_iterations = 1;
	_perc = 0;
       _minShot=9999;
       _maxShot=0;
       _oneShot=0;

	_unit setunitpos _stance;

	_unit setVariable ["shots_fired", 0];

	while {	_iterations <= _max_iterations} do 
	{
           _shotsUpToNow= (_unit getVariable "shots_fired");
		hintsilent format["TARGETRANGE SESSION\nIn progress, please wait\nRunning iteration %1 of %2\nOneShot:%3  Min:%4  Max:%5", 
           _n, 
           _planned_iterations,
           _oneShot,
           if (_minShot != 9999) then {_minShot} else {"-"},
           if (_maxShot != 0) then {_maxShot} else {"-"}
           ];

		_target = _target_type createVehicle [_target_pos_x, _target_pos_y];
           countIn=true;
		_target setdir 90;

		_target setvariable["hit", false];

		_eh_n = _target addEventHandler ["hit", { 
               (_this select 0) setdamage 1;(_this select 0) setvariable["hit", true];
               countIn=false;
           } ];

		_spotter reveal _target;
		_unit reveal _target;
		//sleep .5;

		_target addrating -100000;
		_unit lookAt _target;
		_unit doTarget _target;
		_unit doWatch _target;
		_unit doFire _target;

		//waitUntil{ _target getVariable "hit" };

           While {!(_target getVariable "hit")} do {
               if (time - _lastHit > 20) then {
                   _spotter reveal _target;
                   _unit reveal _target;
                   _unit lookAt _target;
                   _unit doTarget _target;
                   _unit doWatch _target;
                   _unit doFire _target;
                   _lastHit = time;
                   _unit globalchat "# reset 20 sec.";
                   diag_log "# reset 20 sec.";
                   sleep 0.5;
               };
           };

           _lastHit = time;
           _shotsForThisTarget = (_unit getVariable "shots_fired") - _shotsUpToNow;

		_target removeEventHandler["hit", _eh_n];
		deleteVehicle _target;
		_target = nil;

		_unit doTarget objNull;
		_unit doWatch objNull;
		_unit setdir 180;

		_perc = if (_unit getVariable "shots_fired" == 0) then {0} else {ceil ( 100 * _iterations / (_unit getVariable "shots_fired") );};
		_minShot = if (_shotsForThisTarget < _minShot) then {_shotsForThisTarget} else {_minShot};
		_maxShot = if (_shotsForThisTarget > _maxShot) then {_shotsForThisTarget} else {_maxShot};
           if (_shotsForThisTarget == 1) then {_oneShot = _oneShot + 1};

		_iterations = _iterations + 1;
		_n = _n + 1;

		sleep 1;
	};

	_line01 = format["Skill: %1", skill _unit];
	_line02 = format["Distance: %1", _distance];
	_line03 = format["Stance: %1", _stance];		
	_line04 = format["Iterations: %1 of %2", _iterations, _max_iterations];
	_line05 = format["Shots fired: %1", _unit getVariable "shots_fired"];		
	_line06 = format["On target avg: %1%2", _perc, "%" ];
	_line07 = format["Best: %1", _minShot];
	_line08 = format["Worst: %1", _maxShot];
	_line09 = format["One shot: %1", _oneShot];

	_msg = format["# %1 - %2 - %3 - %4 - %5 - %6 - %7 - %8 - %9", _line01, _line02, _line03, _line04, _line05, _line06, _line07, _line08, _line09];

	_unit globalchat _msg;
	diag_log _msg;

} foreach _stances;

} foreach _distances;

_time2 = time;

diag_log "#";
diag_log format["# Targetrange session end. Duration: %1 seconds", _time2 - _time1];

hintc "Run completed, check your .rpt log for stats";

Edited by holo89
adding stats of AR with new modif.

Share this post


Link to post
Share on other sites

Great stuff, guys. The devs are watching for results in the other thread linked below, so feel free to cross post:

http://forums.bistudio.com/showthread.php?159710-Development-Branch-AI-Discussion/page85

The snap-shot waste or rounds is definitely a factor, but it appears to affect the standing accuracy the most, and kneeling only a little. That just goes to underscore how little the AI gains from being prone, when it should make all the difference.

Share this post


Link to post
Share on other sites

Maturin and holo89!

Thanks for putting this together, and raising it as an issue (which it is). The comunity works!

Share this post


Link to post
Share on other sites

I'm playing the current dev branch and am running the test right now. So far, the accuracy is quite a bit higher than what it was in the beta. Accuracy so far for every stance and at each distance is over 41%. Compared to the results on the previous page, that's a pretty big difference (especially at 200 meters) and it explains why the game has been a lot less fun for me since release. I hope the AI tweaks from the beta return soon. Here is the full report:

"# Skill: 1 - Distance: 50 - Stance: up - Iterations: 21 of 20 - Shots fired: 36 - On target avg: 56%"

"# Skill: 1 - Distance: 50 - Stance: middle - Iterations: 21 of 20 - Shots fired: 39 - On target avg: 52%"

"# Skill: 1 - Distance: 50 - Stance: down - Iterations: 21 of 20 - Shots fired: 36 - On target avg: 56%"

"# Skill: 1 - Distance: 100 - Stance: up - Iterations: 21 of 20 - Shots fired: 40 - On target avg: 50%"

"# Skill: 1 - Distance: 100 - Stance: middle - Iterations: 21 of 20 - Shots fired: 38 - On target avg: 53%"

"# Skill: 1 - Distance: 100 - Stance: down - Iterations: 21 of 20 - Shots fired: 40 - On target avg: 50%"

"# Skill: 1 - Distance: 200 - Stance: up - Iterations: 21 of 20 - Shots fired: 41 - On target avg: 49%"

"# Skill: 1 - Distance: 200 - Stance: middle - Iterations: 21 of 20 - Shots fired: 49 - On target avg: 41%"

"# Skill: 1 - Distance: 200 - Stance: down - Iterations: 21 of 20 - Shots fired: 44 - On target avg: 46%"

Share this post


Link to post
Share on other sites

Looks like we're still in rollback territory, then.

And it's really dire when prone and standing shots are the same.

Share this post


Link to post
Share on other sites

So I changed over to the Stable branch because the Spotrep listed AI tweaks as being back in. I ran the test again and the AI is actually even more accurate:

"# Skill: 1 - Distance: 50 - Stance: up - Iterations: 21 of 20 - Shots fired: 39 - On target avg: 52%"

"# Skill: 1 - Distance: 50 - Stance: middle - Iterations: 21 of 20 - Shots fired: 38 - On target avg: 53%"

"# Skill: 1 - Distance: 50 - Stance: down - Iterations: 21 of 20 - Shots fired: 35 - On target avg: 58%"

"# Skill: 1 - Distance: 100 - Stance: up - Iterations: 21 of 20 - Shots fired: 39 - On target avg: 52%"

"# Skill: 1 - Distance: 100 - Stance: middle - Iterations: 21 of 20 - Shots fired: 38 - On target avg: 53%"

"# Skill: 1 - Distance: 100 - Stance: down - Iterations: 21 of 20 - Shots fired: 35 - On target avg: 58%"

"# Skill: 1 - Distance: 200 - Stance: up - Iterations: 21 of 20 - Shots fired: 41 - On target avg: 49%"

"# Skill: 1 - Distance: 200 - Stance: middle - Iterations: 21 of 20 - Shots fired: 43 - On target avg: 47%"

"# Skill: 1 - Distance: 200 - Stance: down - Iterations: 21 of 20 - Shots fired: 43 - On target avg: 47%"

Share this post


Link to post
Share on other sites

Remember to post your difficulty settings from the profile txt file.

Share this post


Link to post
Share on other sites

Right. I'm playing on regular. I think these are default, but I'm not sure:

skillFriendly=1;

skillEnemy=0.69999999;

precisionFriendly=0.99999994;

precisionEnemy=0.45999998;

Share this post


Link to post
Share on other sites

Oh, and the dev branch AI thread is a better place to post. No one reads this thread.

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  

×