:: Home :: Get Hosted :: PPM FAQ :: Forum FAQ :: Privacy Policy :: Search :: Memberlist :: Usergroups :: Register :: Profile :: Log in to check your private messages :: Log in ::

Do you want to advertise at Project Perfect Mod. Find out how to do it HERE.

The time now is Tue Oct 20, 2020 4:45 pm
All times are UTC + 0
 Forum index » Modding Central » Red Alert 2 Editing Forum
Spies and AI
Moderators: Global Moderators, Red Alert 2 Moderators
Post new topic   Reply to topic Page 1 of 1 [5 Posts] View previous topic :: View next topic
Author Message
silverwind
Rocket Cyborg


Joined: 11 Jun 2016

PostPosted: Mon Sep 21, 2020 5:12 pm    Post subject:  Spies and AI Reply with quote

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.

Team Type code in spoilers.
Spoiler (click here to read it):
Code:

[0CE32D3C-G]
Name=Allied Spy vs Sov Barracks
VeteranLevel=1
MindControlDecision=0
Loadable=no
Full=no
Annoyance=no
GuardSlower=no
House=<none>
Recruiter=no
Autocreate=yes
Prebuild=no
Reinforce=no
Droppod=no
UseTransportOrigin=no
Whiner=no
LooseRecruit=no
Aggressive=no
Suicide=no
Priority=5
Max=1
TechLevel=0
Group=-1
OnTransOnly=no
AvoidThreats=no
IonImmune=no
TransportsReturnOnUnload=no
AreTeamMembersRecruitable=no
IsBaseDefense=no
OnlyTargetHouseEnemy=no
Script=0CADF67C-G
TaskForce=0D0828BC-G


[0TT0011C-G]
Name=Soviet Terrorist vs Soviet Barracks
VeteranLevel=1
MindControlDecision=0
Loadable=no
Full=no
Annoyance=no
GuardSlower=no
House=<none>
Recruiter=no
Autocreate=yes
Prebuild=no
Reinforce=no
Droppod=no
UseTransportOrigin=no
Whiner=no
LooseRecruit=no
Aggressive=no
Suicide=no
Priority=5
Max=1
TechLevel=0
Group=-1
OnTransOnly=no
AvoidThreats=no
IonImmune=no
TransportsReturnOnUnload=no
AreTeamMembersRecruitable=no
IsBaseDefense=no
OnlyTargetHouseEnemy=no
Script=0CADF67C-G
TaskForce=0TF0002C-G


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


[BuildingTypes] ; for your reference
0=GAPOWR
1=GAREFN
2=GACNST
3=GAPILE
4=GASAND
5=GADEPT
6=GATECH
7=GAWEAP
8=CALAB
9=NAPOWR
10=NATECH
11=NAHAND
12=GAWALL
13=NARADR
14=NAWEAP
15=NAREFN
16=NAWALL



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.

Download
 Filename:  aimd.ini
 Filesize:  151.18 KB
 Downloaded:  1 Time(s)


Back to top
View user's profile Send private message
E1 Elite
Commander


Joined: 28 May 2013

PostPosted: Tue Sep 22, 2020 1:27 am    Post subject: Reply with quote

May be the secondary weapon does not work well with the makeupkit logic.

AI vehicle thief doesn't work as the infantry keeps running along the vehicle without entering it, from my testing in TS.

Back to top
View user's profile Send private message
Virgil
Rocket Cyborg


Joined: 22 Jul 2018

PostPosted: Tue Sep 22, 2020 4:32 am    Post subject: Reply with quote

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?

Back to top
View user's profile Send private message
Crimsonum
Seth


Joined: 14 Jul 2005
Location: Fineland

PostPosted: Tue Sep 22, 2020 7:34 am    Post subject: Reply with quote

The only time I've seen the AI properly use hijackers is when they were assigned to hunt mode.
_________________


Back to top
View user's profile Send private message Visit poster's website
silverwind
Rocket Cyborg


Joined: 11 Jun 2016

PostPosted: Tue Sep 22, 2020 12:49 pm    Post subject: Reply with quote

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.

Code:
[0SC0008C-G]
Name=General Spy vs Yuri Refinery
0=21,0
1=0,4
2=47,131429 ;YAREFN
3=46,357
4=11,7


These two videos show what's been happening.

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.

Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic Page 1 of 1 [5 Posts] View previous topic :: View next topic
 Forum index » Modding Central » Red Alert 2 Editing Forum
Jump to:  
Share on TwitterShare on FacebookShare on Google+Share on DiggShare on RedditShare on PInterestShare on Del.icio.usShare on Stumble Upon
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


Powered by phpBB © phpBB Group

[ Time: 0.1417s ][ Queries: 12 (0.0053s) ][ Debug on ]