A3Wasteland / ArmA3_Wasteland.Altis

A3Wasteland is a survival sandbox mission for Arma 3 where two teams and independent players fight for survival. Built in collaboration between GoT, TPG, KoS, 404Games, and others.
http://a3wasteland.com
GNU Affero General Public License v3.0
104 stars 185 forks source link

AI is dumb #89

Open AgentRev opened 10 years ago

AgentRev commented 10 years ago

Apparently the v1.08 update made them dumb as fuck

MudBone commented 10 years ago

I can confirm the AI are almost completely oblivious to the enemy making most of the side missions no challenge at all. I am able to drive or walk right through them. Often times they will walk right by me, ignore my vehicle and wander around aimlessly.

contactgus commented 10 years ago

Try adding the following lines to setMissionSkill.sqf to see the actual final subskill values of spawned units in the server .rpt files (don't use -nologs in launch parameters):

_expaAunit = _unit skillFinal "aimingAccuracy";
_expaSunit = _unit skillFinal "aimingShake";
_expaSpunit = _unit skillFinal "aimingSpeed";
_expEunit = _unit skillFinal "Endurance";
_expsDunit = _unit skillFinal "spotDistance";
_expsTunit = _unit skillFinal "spotTime";
_expCnit = _unit skillFinal "courage";
_exprSunit =_unit skillFinal "reloadSpeed";
_expCounit =_unit skillFinal "commanding";
_expGunit =_unit skillFinal "general";

    diag_log format ["unit: %1 aimingAccuracy: %2 aimingShake: %3 aimingSpeed: %4 Endurance: %5 spotDistance: %6 spotTime: %7 courage: %8 reloadSpeed: %9 commanding:%10 general: %11",_unit,_expaAunit,_expaSunit,_expaSpunit,_expEunit,_expsDunit,_expsTunit,_expCnit,_exprSunit,_expCounit,_expGunit];

See here for two factors that contribute to skillfinal, I don't think it is a simple multiplication: http://community.bistudio.com/wiki/server.armaprofile (located in your profile folder) http://community.bistudio.com/wiki/setSkill_array I managed to get the bots to fire on military vehicles by giving them grenade launchers but 1.10 broke that. The other thing that could be checked is the combat mode: http://community.bistudio.com/wiki/ArmA:_AI_Combat_Modes I gave up trying to tweak mine for now

MudBone commented 10 years ago

Thanks for the suggestions. It didnt really help. I was able to walk right through them ...even follow them around.

I wonder how Sa Matra is getting his to work.

YahPager commented 10 years ago

I put in Anti Tank and Anti Air units and they will shoot you down from 1000M away and I have mine set on 50% trust me my AI will mess you up. I also gave them 7.62 guns and not 5.56 they will shot at you. plus I added Snipers they have a MK 18 w/ a SOS. leaving them with shit guns and they won't do nothing give them good equipment and they will kill you.

AgentRev commented 10 years ago

Wait a minute... Could this be related to the fact that we are spawning civilian units? Maybe it could be why they don't react properly... Will test with normal units.

contactgus commented 10 years ago

Civilian AI units attack with rifles for me but after 1.10 stopped attacking military vehicles with their grenade launchers. The leader will fire ATs after i added a bag with rockets. I thought about the civilian thing but I assumed that Opfor Ai would not attack Opfor players and the same for the other factions. It will be interesting to see what you find.

AgentRev commented 10 years ago

The Opfor thing could be true, however maybe if the group is still created as civilian, it could work. Otherwise, I am pretty sure there is a way to override the civilian AI logic and execute the soldier one from the game files directly.

mawendt commented 10 years ago

I'm going to draw upon some memory on this, working with TAW_Tonic a year or so ago...

Tonic had the same problem, and the work around was this: he discovered that Civs don't like to engage, so he moved all players to OPFOR, BLUFOR, and CIV and assigned all AI at spawn as Independants. Then set Independants are enemies to everyone. Then set the skills up as per Bis.

One way, I think, is to spawn an invisible leader as an Independant, then assign the AI as subordinate reassigning any AI to his leader's faction. Then no matter what you spawn (BUFOR, OPFOR, CIV or IND) they are all on the IND team.

Another way was to spawn an AI team with a script that was like "if any player is is seen and closer than 700m to AI then attack player" and have it check every 5 seconds or so. Forces attacks.

Which really brings to mind: why bother with BLUFOR or OPFOR at all? If we assume the world has fallen apart, drive everyone to CIV. Let them build their own teams through Group chat. Or, if you must spawn 'Teams', spawn them in groups subordinate to an invisible leader. Then you may also be able to have atmospheric sqaud/team battles of spawned OPFOR and BLUFOR and IND doing battle as a mission. Then loot the corpses? whiskey

YahPager commented 10 years ago

Tried what mawendt suggested and my AI still engage better being CIV's then being Indie's This is my smallGroup.sqf:

if (!isServer) exitWith {}; private ["_group", "_pos", "_leader", "_man2", "_man3", "_man4", "_man5", "_man6", "_man7"]; _group = _this select 0; _pos = _this select 1; // Leader _leader = _group createUnit ["C_man_1_1_F", [(_pos select 0) + 10, _pos select 1, 0], [], 1, "Form"]; removeAllAssignedItems _leader; _leader addUniform "U_I_OfficerUniform"; _leader addVest "V_TacVest_blk_POLICE"; _leader addBackpack "B_Carryall_oucamo"; _leader addMagazine "20Rnd_762x51_Mag"; _leader addWeapon "srifle_EBR_DMS_F"; _leader addMagazine "20Rnd_762x51_Mag"; _leader addMagazine "20Rnd_762x51_Mag"; _leader addMagazine "NLAW_F"; _leader addWeapon "launch_NLAW_F"; _leader addMagazine "NLAW_F"; // Rifleman _man2 = _group createUnit ["C_man_p_fugitive_F", [(_pos select 0) - 30, _pos select 1, 0], [], 1, "Form"]; removeAllAssignedItems _man2; _man2 addUniform "U_I_CombatUniform_tshirt"; _man2 addVest "V_TacVest_blk_POLICE"; _man2 addMagazine "20Rnd_762x51_Mag"; _man2 addWeapon "srifle_EBR_ACO_F"; _man2 addMagazine "20Rnd_762x51_Mag"; _man2 addMagazine "20Rnd_762x51_Mag"; // Rifleman _man3 = _group createUnit ["C_man_p_fugitive_F", [(_pos select 0) - 30, _pos select 1, 0], [], 1, "Form"]; removeAllAssignedItems _man3; _man3 addUniform "U_I_CombatUniform_tshirt"; _man3 addVest "V_TacVest_blk_POLICE"; _man3 addMagazine "20Rnd_762x51_Mag"; _man3 addWeapon "srifle_EBR_DMS_F"; _man3 addMagazine "20Rnd_762x51_Mag"; _man3 addMagazine "20Rnd_762x51_Mag"; // Grenadier _man4 = _group createUnit ["C_man_p_fugitive_F", [_pos select 0, (_pos select 1) - 40, 0], [], 1, "Form"]; removeAllAssignedItems _man4; _man4 addUniform "U_I_CombatUniform_tshirt"; _man4 addVest "V_TacVest_blk_POLICE"; _man4 addMagazine "30Rnd_556x45_Stanag"; _man4 addWeapon "arifle_TRG21_GL_F"; _man4 addMagazine "30Rnd_556x45_Stanag"; _man4 addMagazine "30Rnd_556x45_Stanag"; _man4 addMagazine "1Rnd_HE_Grenade_shell"; _man4 addMagazine "1Rnd_HE_Grenade_shell"; _man4 addMagazine "1Rnd_HE_Grenade_shell"; // Sniper _man5 = _group createUnit ["C_man_p_fugitive_F", [_pos select 0, (_pos select 1) - 20, 0], [], 1, "Form"]; removeAllAssignedItems _man5; _man5 addUniform "U_I_GhillieSuit"; _man5 addVest "V_TacVest_blk_POLICE"; _man5 addMagazine "20Rnd_762x51_Mag"; _man5 addWeapon "srifle_EBR_SOS_F"; _man5 addMagazine "20Rnd_762x51_Mag"; _man5 addMagazine "20Rnd_762x51_Mag"; // Anti Tank _man6 = _group createUnit ["C_man_p_fugitive_F", [_pos select 0, (_pos select 1) - 10, 0], [], 1, "Form"]; removeAllAssignedItems _man6; _man6 addUniform "U_I_CombatUniform_tshirt"; _man6 addVest "V_TacVest_blk_POLICE"; _man6 addBackpack "B_Carryall_oucamo"; _man6 addMagazine "20Rnd_762x51_Mag"; _man6 addWeapon "srifle_EBR_DMS_F"; _man6 addMagazine "20Rnd_762x51_Mag"; _man6 addMagazine "20Rnd_762x51_Mag"; _man6 addMagazine "Titan_AT"; _man6 addWeapon "launch_Titan_short_F"; _man6 addMagazine "Titan_AT"; _man6 addMagazine "Titan_AT"; // Anti Air _man7 = _group createUnit ["C_man_p_fugitive_F", [_pos select 0, (_pos select 1) - 10, 0], [], 1, "Form"]; removeAllAssignedItems _man7; _man7 addUniform "U_B_CombatUniform_mcam_tshirt"; _man7 addVest "V_TacVest_blk_POLICE"; _man7 addBackpack "B_Carryall_oucamo"; _man7 addMagazine "20Rnd_762x51_Mag"; _man7 addWeapon "srifle_EBR_DMS_F"; _man7 addMagazine "20Rnd_762x51_Mag"; _man7 addMagazine "20Rnd_762x51_Mag"; _man7 addMagazine "Titan_AA"; _man7 addWeapon "launch_Titan_F"; _man7 addMagazine "Titan_AA"; _man7 addMagazine "Titan_AA"; _leader = leader _group; { _x spawn refillPrimaryAmmo; _x spawn addMilCap; _x call setMissionSkill; _x addRating 9999999; _x addEventHandler ["Killed", {_this call server_playerDied; (_this select 1) call removeNegativeScore}]; } forEach units _group; [_group, _pos] call defendArea;

As you can see it's bigger because I added 2 more guys AT & AA units also changed a Rifleman to a Sniper. My midGroup is a 10 man group and the largeGroup is a 15 man group w/ 2 Snipers, 2 AT and 1 AA units.

My setMissionSkill.sqf as tested:

if (!isServer) exitWith {};

private ["_unit", "_skill", "_accuracy"]; _unit = _this;

_skill = if (["A3W_missionsDifficulty", 0] call getPublicVar > 0) then { 0.66 } else { 0.50 }; _accuracy = if (["A3W_missionsDifficulty", 0] call getPublicVar > 0) then { 0.75 } else { 0.66 };

_unit allowFleeing 0; _unit setSkill _skill; _unit setSkill ["aimingAccuracy", (_unit skill "aimingAccuracy") * _accuracy]; _unit setSkill ["courage", 1];

Everything seem to work as it should on our server.

p.s. Don't know why it deleted some of the "_" in the code but they are there.

contactgus commented 10 years ago

Thanks for sharing. Use 3 back-ticks to fence your code on github otherwise this:

man7 = _group createUnit ["Cman_p_fugitive_F"

becomes this: man7 = _group createUnit ["Cman_p_fugitive_F"

3 Back-ticks --> ``` (I couldn't find them on my keyboard so I pirated them :) )
AgentRev commented 10 years ago

You only need one back-tick on each side, actually. Edit: I guess both works.

YahPager commented 10 years ago

They look like >> on my editor and it's one those = 8 spaces which I have found saves space and makes the .pbo smaller I did that to all 500+ files and just for the addons folder went from 335KB to 293KB now with the Icons I use, Loading pick, and custom Mission.sqm I'm over by 186KB but that better then the 500KB I use to be over.

mawendt commented 10 years ago

GSN-Pager,

The engagement quality is directed by you setMissionSkill.sqf which would make any group a bunch of killers. I like. I think you could create any faction of any composition, though, and toss them that skill set and they would engage equally as well.

I notice your smallGroup.sqf is redundant. Anything that is redundant can be simplified with a looping structure. You can create a loop to the group member limit and run it till it hits a limit, rather than creating 7 men seperately. I've done it, but I'd have to dig it up (though I'm sure you can put it together with your own spin). Essentially it becomes a short, elegant script that when given a number (preferably a random number) it creates a group to that size. you could further randomly arm and clothe them. Much more Wastelandish, I'd say. (In your development, you cann create an interrupt that mandates the first couple members have a required AT or AA system).

Have you given thought to randomizing equipment? Creating arrays from which to draw the equipment would add loot variety as well as upset a player's expectations on what they are fighting against.

So to finish the thought: A shorter script allowing killer AI with random equipment. Need help, pm me.

MudBone commented 10 years ago

mawendt...

Why not fork the original topic and help us all. Seems like a bunch of us are in the same situation and if you could help resolve the situation I'm sure the whole project could benefit from your skills rather than just on select community.

YahPager commented 10 years ago

I tried something different I took out the [_group, _pos] call defendArea; (also delete the defendArea.sqf) and replaced it with [group this, getPos this] call bis__fnc_taskDefend. Now my AI don't wonder off they start to engage about 700M's out I seem them shot down a Heli (sure it was the Anti-Air guy I added) Watched them kill a Ifrit that was coming at them (which would be the Anti-Tank guy I added) and they killed me several times trying to kill them from 600M's out. I added that to all my groups including Divers seems to be working better then the defendArea.sqf did.For the largeDivers.sqf since you had "Ship" in there I added that as such [group this, getPos this, "Ship"] call bis_fnc_taskDefend. I did readjust the number of AI spawning in each group setting them back to the normal of 10 Large 7 Mid 5 Small all groups have The Leader 1 Rifleman 1 Anti-Tank 1 Anti-Air 1 Sniper and filled the rest with Grenadier. The Large group has 2 Snipers 2 Anti-Tank and 1 Anti-Air.

I don't know if this helps but it seems to be going down the right track.

~Pager

p.s.

Forgot that my Small group doesn't have a Rifleman but has the rest as stated above.

mawendt commented 10 years ago

k. i'll dig up what i got and post it quick as i can, though it may be this weekend.

I don't believe there was an 'original topic' on Bis; it was something Tonic was working through and was in his original wasteland pbo (which i have). shows how anything that is done repetitively can be done by a looping structure like:

while {true} do .... {whatever you want done}..... forEach [whatever array you want here]

array would be a distinctive man1, man2, man3, man4, etc or whatever. i'll find an example and post it; i seem to remember that the UPSmon script had great examples of arrays and loops.

http://forums.bistudio.com/showthread.php?170803-UPSMON-Updated-to-ArmaIII&highlight=upsmon

(really. i'm not a good idea fairy. i just have good ideas. usually someone else's, but they're still good ideas.) I've been trolling the dev threads too long trying to get a handle on A3 Wasteland, and now I'm ready to embarrass myself.

MudBone commented 10 years ago

Thanks mawendt

Off topic here but does anyone know how to enable to player saving? I have been trying to make it work and have iniDB installed on the server. Or maybe its not functional at this time?

MudBone commented 10 years ago

Pager thats great news. Are you going to branch and share your changes?

YahPager commented 10 years ago

Still testing I keep getting errors but they seem to be doing their job a lot better.

MudBone commented 10 years ago

Great work and thanks for your help...