Posted: Mon Sep 21, 2020 5:12 pm Post subject:
Spies and AI
Context: I made a few changes to the Spy, and altered the terrorist to be a de facto soviet spy.
Spy: using NoAmmoWeapon, I've given him a secondary, short-range, anti-infantry weapon that he's able to use when out of ammo, which occurs after one use of the MakeupKit, with no reload.
Terrorist: same logic, but with TerrorBomb as the secondary weapon. I've also given him vehicle-hijacking capabilities via Vehicle Thief (going this route as both weapons slots are taken).
I replicated the Spy AI code to make the soviet AI use its spy.
Both of them work flawlessly and as intended when used by a human player, however, the AI wouldn't cooperate as well.
--- The Problems ---
Several.
1. At first, the Soviet AI just wouldn't pick up disguise (it was effectively ignoring script action 0=0,4; barging straight into my base without a disguise.
Searching around the forums, I found that I wasn't the only one facing this problem. Someone had found a fix by messing around with the AI, but he wasn't sure what he did, and the people asking seemingly never got a solution.
Fix: After trying numerous things, I discovered that adding an action before 0,4 (any action, really, so I first went with 54,0 - gather outside own base, and then with the quicker 21,0 - scatter) made the AI pick up disguises correctly.
Around this time, I started noticing that the Allied spy was lingering around my powerplants, which brings us to problem 2.
2. The AI is stopping short of infiltrating the buildings. They pick up a disguise, and sneak into the enemy base, going first for the barracks, but then turning around and heading for a powerplant, and then just stopping there, doing nothing. For simplicity, I'm describing a spy going for the barracks, but this happens with those going for factories too.
Here's the script in question:
Code:
[0CADF67C-G]
Name=General Spy vs Sov Barracks
0=21,0 ;this is the only change. the rest is unchanged
1=0,4
2=47,11
3=46,11
4=47,131081
5=46,131081
It's apparent the AI is struggling with actions 46, but I'm guessing there's more to it.
Both taskforces consist of a solitary spy/terrorist.
As an added note, after their final stop, the allied spy is in guard mode, killing any infantry that passes next it. Similarly, the terrorist still uses its secondary weapon if its path is blocked by a destroyable obstacle.
Finally, here's the their rules code in spoilers:
Spoiler (click here to read it):
Code:
; RA2 Spy
[SPY]
UIName=Name:SPY
Name=Spy ;locked
Category=Soldier
Prerequisite=GAPILE,GATECH
CrushSound=InfantrySquish
LeadershipRating=3
Strength=100
Primary=MakeupKit ; virtual weapon that picks disguise
Secondary=Silence ; assassination
PipScale=ammo
Ammo=2
NoAmmoWeapon=1
NoAmmoAmount=1
InitialAmmo=2
Reload=200
ReloadAmount=0 ;don't reload
CanPassiveAquire=yes ; Won't try to pick up own targets
CanRetaliate=yes; Won't fire back when hit
Armor=none
TechLevel=5
Infiltrate=yes
Agent=yes
CanDisguise=yes; I appear differently on other people's computers
PermaDisguise=yes; and I appear that way always (Mirage Tank will be Can but not Perma)
Sight=9
Speed=4
Owner=British,French,Germans,Americans,Alliance
AllowedToStartInMultiplayer=no
Cost=1000
Soylent=500
Pip=blue
Points=5
VoiceSelect=SpySelect
VoiceMove=SpyMove
VoiceAttack=SpyAttackCommand
VoiceSecondaryWeaponAttack=SniperAttackCommand
VoiceFeedback=SpyFear
VoiceSpecialAttack=SpySpecialAttack
DieSound=SpyDie
Locomotor={4A582744-9839-11d1-B709-00A024DDAFD1}
PhysicalSize=1
MovementZone=Infantry
ThreatPosed=0 ; This value MUST be 0 for all building addons
SpecialThreatValue=1
PreventAttackMove=yes
IFVMode=2
;Trainable=no
VeteranAbilities=STRONGER,FASTER,ROF,SIGHT,SCATTER
EliteAbilities=SELF_HEAL,STRONGER,SIGHT,ROF,SENSORS,CLOAK ;going ninja
;StupidHunt=yes ;this guy can't handle a hunt command, so he should just run towards the player
CanDrive=yes
;The evil Cuban Terrorist
[TERROR]
UIName=Name:TERROR
Name=Terrorist
Image=TRST
;Image=SPY
Category=Soldier
Prerequisite=NAHAND,NATECH
;Prerequisite=NAHAND,RADAR
CrushSound=InfantrySquish
Crushable=no
LeadershipRating=3
Strength=100
Primary=MakeupKit ; virtual weapon that picks disguise
Secondary=TerrorBomb
PipScale=ammo
Ammo=2
NoAmmoWeapon=1
NoAmmoAmount=1
InitialAmmo=2
Reload=200
ReloadAmount=0 ;don't reload
CanPassiveAquire=no ; Won't try to pick up own targets
CanRetaliate=no; Won't fire back when hit
Armor=none
TechLevel=5
VehicleThief=yes
;Thief=yes
Agent=yes
Infiltrate=yes
CanDisguise=yes; I appear differently on other people's computers
PermaDisguise=yes; and I appear that way always (Mirage Tank will be Can but not Perma)
Sight=9
Speed=5
Owner=Russians,Confederation,Africans,Arabs
;RequiredHouses=Confederation ; We'll differenciate some other way.
AllowedToStartInMultiplayer=no
Cost=1000
Soylent=500
Pip=red
Points=30
VoiceSelect=TerroristSelect
VoiceMove=TerroristMove
VoiceAttack=TerroristAttackCommand
VoiceFeedback=TerroristFear
VoiceSpecialAttack=TerroristAttackCommand
DieSound=TerroristDie
Locomotor={4A582744-9839-11d1-B709-00A024DDAFD1}
PhysicalSize=1
MovementZone=Infantry
ThreatPosed=0 ; This value MUST be 0 for all building addons
SpecialThreatValue=1
;Trainable=no ; if one of infiltrates your barracks
VeteranAbilities=STRONGER,FASTER,FIREPOWER,SIGHT,SENSORS ; lord have mercy
Explodes=yes
DeathWeapon=TerrorBomb
IFVMode=11
CanDrive=yes
Again, this only happens when the AI is in control (both when it's controlling my base, and when it's the enemy). When it happens the AI controlling my base, I'm able to take back control and infiltrate the building it's standing next to just fine.
In any case, I've attached the aimd.ini if the code in this post isn't enough to troubleshoot.
Bonus: I added code hoping to make the AI use the terrorist as a vehicle thief, but I've read that the AI doesn't cooperate with that mechanic as well. However, if you guys have had any luck in that respect, do tell.
aimd.ini
Description:
Search for just search for "Spy". Most additional terrorist code is at the end.
Guess it's the secondary weapon causing trouble, the removal of Mirage's disguise weapon as PrimaryWeapon should have a reason.
I think Ares is going to support vehicle thief scripts in the next version? QUICK_EDIT
From my testing, the AI does occasionally capture vehicles, but it doesn't know what to do with it. Unlike mindcontrol (where it has 4 options on what to do with it), if it captures an enemy tank, the tank will simply sit in place. Further testing on that regard is needed, to see if the AI is able to recruit these units into team types. Making multiple recruiter teamtypes consisting of a solitary tank
@E1: That moving along the vehicle behavior is similar to what I'm getting here, except it keeps switching the target. But if VehicleThief is the culprit, why is the Allied Spy acting up?
@Virgil: I believe the case with the Mirage tank is that they found a better solution (in disguising automagically). The Primary weapon is what gets used for things that aren't covered by Verses (such as firing at the ground). Having said that, the primary weapon is unchanged for the Spy, and the Terrorist is using MakeupKit as primary too, so that shouldn't be the problem.
Both these units work flawlessly under player control, btw.
@Crimsonum: That's interesting. I'm gonna see if giving one a script with a Hunt mission works more consistently.
Anyway, update: I've been trying different things with the scripts, with varying results.
This script, where it's infiltrating a Slave Miner works successfully quite consistently. The major change from the rest of the scripts is that this one doesn't repeat, and the last action - 11,7 is Mission->Enter.
Exhibit A: Allied Spy's behavior - just stands there next to whatever it's infiltrating.
Exhibit B: Terrorist's behavior with an scatter action between 47 and 46, and a repeat script at the end.
When I activate waypoint mode, the targets jump between the Refinery, a nearby GI, and a Chrono Miner. On at least one occasion, he successfully sabotaged the enemy's power while I wasn't looking (thanks Zofia).
I'll post another video with waypoint mode active, so its intentions are clearer. QUICK_EDIT
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You cannot attach files in this forum You can download files in this forum