Phobos-developers / Phobos

Ares-compatible C&C Red Alert 2: Yuri's Revenge engine extension
GNU Lesser General Public License v3.0
264 stars 83 forks source link

Naval units get stuck trying to reach land target #610

Open ghost opened 2 years ago

ghost commented 2 years ago

First check

Description

When AI naval units can't reach a land target they start wiggling around forever somewhere at the closest shore location.

Conditions to reproduce

No response

INI code

[TaskForces]
0=TF0001
1=TF0020
2=TF0029
3=TF0041
4=TF0042
5=TF0081

[TF0001]
Name=Guard - Ally 1 Eng
0=1,ENGINEER
Group=-1

[TF0020]
Name=Guard - Yuri 1 Eng
0=1,YENGINEER
Group=-1

[TF0029]
Name=Naval - Yuri Bombard
0=4,BSUB
Group=-1

[TF0041]
Name=Naval - Ally Bombard
0=4,CARRIER
Group=-1

[TF0042]
Name=Naval - Soviet Bombard
0=4,DRED
Group=-1

[TF0081]
Name=Guard - Sov 1 Eng
0=1,SENGINEER
Group=-1

[ScriptTypes]
0=SCR0001
1=SCR002D
2=SCR0032
3=SCR0039
4=SCR003A
5=SCR0073

[SCR0001]
Name=Guard Allied
0=58,196611
1=71,60
2=58,196611
3=71,60
4=6,1

[SCR002D]
Name=Guard Yuri
0=58,196910
1=71,60
2=58,196910
3=71,60
4=6,1

[SCR0032]
Name=Naval Bomb A
0=49,0
1=46,131095
2=46,131072
3=46,131074
4=46,131136
5=46,131093
6=46,131127
7=46,131138
8=46,131079
9=46,131075
10=46,131073
11=46,131101
12=46,131099
13=46,131428
14=46,131135
15=71,30
16=54,0

[SCR0039]
Name=Naval Bomb S
0=49,0
1=46,131133
2=46,131137
3=46,131081
4=46,131097
5=46,131139
6=46,131125
7=46,131431
8=46,131092
9=46,131086
10=46,131083
11=46,131087
12=46,131096
13=46,131126
14=46,131085
15=71,30
16=54,0

[SCR003A]
Name=Naval Bomb Y
0=49,0
1=46,131376
2=46,131373
3=46,131372
4=46,131380
5=46,131381
6=46,131414
7=46,131375
8=46,131374
9=46,131384
10=46,131387
11=46,131090
12=46,131144
13=46,131383
14=46,131429
15=71,30
16=54,0

[SCR0073]
Name=Guard Soviet
0=58,196619
1=71,60
2=58,196619
3=71,60
4=6,1

[TeamTypes]
0=TEAM0001
1=TEAM002E
2=TEAM003A
3=TEAM003C
4=TEAM003D
5=TEAM0059
6=TEAM005A
7=TEAM005B
8=TEAM005C
9=TEAM005D
10=TEAM005E
11=TEAM00E5

[TEAM0001]
Name=GTeam-A Defend Barracks
VeteranLevel=1
MindControlDecision=0
Loadable=no
Full=no
Annoyance=no
GuardSlower=no
House=<none>
Recruiter=no
Autocreate=yes
Prebuild=no
Reinforce=yes
Droppod=no
UseTransportOrigin=no
Whiner=no
LooseRecruit=no
Aggressive=yes
Suicide=no
Priority=5
Max=1
TechLevel=0
Group=-1
OnTransOnly=no
AvoidThreats=no
IonImmune=no
TransportsReturnOnUnload=no
AreTeamMembersRecruitable=yes
IsBaseDefense=yes
OnlyTargetHouseEnemy=no
Script=SCR0001
TaskForce=TF0001

[TEAM002E]
Name=GTeam-Y Defend Barracks
VeteranLevel=1
MindControlDecision=2
Loadable=no
Full=no
Annoyance=no
GuardSlower=no
House=<none>
Recruiter=no
Autocreate=yes
Prebuild=no
Reinforce=yes
Droppod=no
UseTransportOrigin=no
Whiner=no
LooseRecruit=no
Aggressive=yes
Suicide=no
Priority=5
Max=1
TechLevel=0
Group=-1
OnTransOnly=no
AvoidThreats=no
IonImmune=no
TransportsReturnOnUnload=no
AreTeamMembersRecruitable=yes
IsBaseDefense=yes
OnlyTargetHouseEnemy=no
Script=SCR002D
TaskForce=TF0020

[TEAM003A]
Name=YTeam Navy Bombard A
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=yes
LooseRecruit=no
Aggressive=yes
Suicide=no
Priority=7
Max=2
TechLevel=0
Group=-1
OnTransOnly=no
AvoidThreats=no
IonImmune=no
TransportsReturnOnUnload=no
AreTeamMembersRecruitable=yes
IsBaseDefense=no
OnlyTargetHouseEnemy=no
Script=SCR0032
TaskForce=TF0029

[TEAM003C]
Name=ATeam Navy Bombard A
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=yes
LooseRecruit=no
Aggressive=yes
Suicide=no
Priority=7
Max=2
TechLevel=0
Group=-1
OnTransOnly=no
AvoidThreats=no
IonImmune=no
TransportsReturnOnUnload=no
AreTeamMembersRecruitable=yes
IsBaseDefense=no
OnlyTargetHouseEnemy=no
Script=SCR0032
TaskForce=TF0041

[TEAM003D]
Name=STeam Navy Bombard A
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=yes
LooseRecruit=no
Aggressive=yes
Suicide=no
Priority=7
Max=2
TechLevel=0
Group=-1
OnTransOnly=no
AvoidThreats=no
IonImmune=no
TransportsReturnOnUnload=no
AreTeamMembersRecruitable=yes
IsBaseDefense=no
OnlyTargetHouseEnemy=no
Script=SCR0032
TaskForce=TF0042

[TEAM0059]
Name=YTeam Navy Bombard S
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=yes
LooseRecruit=no
Aggressive=yes
Suicide=no
Priority=7
Max=2
TechLevel=0
Group=-1
OnTransOnly=no
AvoidThreats=no
IonImmune=no
TransportsReturnOnUnload=no
AreTeamMembersRecruitable=yes
IsBaseDefense=no
OnlyTargetHouseEnemy=no
Script=SCR0039
TaskForce=TF0029

[TEAM005A]
Name=YTeam Navy Bombard Y
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=yes
LooseRecruit=no
Aggressive=yes
Suicide=no
Priority=7
Max=2
TechLevel=0
Group=-1
OnTransOnly=no
AvoidThreats=no
IonImmune=no
TransportsReturnOnUnload=no
AreTeamMembersRecruitable=yes
IsBaseDefense=no
OnlyTargetHouseEnemy=no
Script=SCR003A
TaskForce=TF0029

[TEAM005B]
Name=ATeam Navy Bombard S
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=yes
LooseRecruit=no
Aggressive=yes
Suicide=no
Priority=7
Max=2
TechLevel=0
Group=-1
OnTransOnly=no
AvoidThreats=no
IonImmune=no
TransportsReturnOnUnload=no
AreTeamMembersRecruitable=yes
IsBaseDefense=no
OnlyTargetHouseEnemy=no
Script=SCR0039
TaskForce=TF0041

[TEAM005C]
Name=ATeam Navy Bombard Y
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=yes
LooseRecruit=no
Aggressive=yes
Suicide=no
Priority=7
Max=2
TechLevel=0
Group=-1
OnTransOnly=no
AvoidThreats=no
IonImmune=no
TransportsReturnOnUnload=no
AreTeamMembersRecruitable=yes
IsBaseDefense=no
OnlyTargetHouseEnemy=no
Script=SCR003A
TaskForce=TF0041

[TEAM005D]
Name=STeam Navy Bombard S
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=yes
LooseRecruit=no
Aggressive=yes
Suicide=no
Priority=7
Max=2
TechLevel=0
Group=-1
OnTransOnly=no
AvoidThreats=no
IonImmune=no
TransportsReturnOnUnload=no
AreTeamMembersRecruitable=yes
IsBaseDefense=no
OnlyTargetHouseEnemy=no
Script=SCR0039
TaskForce=TF0042

[TEAM005E]
Name=STeam Navy Bombard Y
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=yes
LooseRecruit=no
Aggressive=yes
Suicide=no
Priority=14
Max=2
TechLevel=0
Group=-1
OnTransOnly=no
AvoidThreats=no
IonImmune=no
TransportsReturnOnUnload=no
AreTeamMembersRecruitable=yes
IsBaseDefense=no
OnlyTargetHouseEnemy=no
Script=SCR003A
TaskForce=TF0042

[TEAM00E5]
Name=GTeam-S Defend Barracks
VeteranLevel=1
MindControlDecision=2
Loadable=no
Full=no
Annoyance=no
GuardSlower=no
House=<none>
Recruiter=no
Autocreate=yes
Prebuild=no
Reinforce=yes
Droppod=no
UseTransportOrigin=no
Whiner=no
LooseRecruit=no
Aggressive=yes
Suicide=no
Priority=5
Max=1
TechLevel=0
Group=-1
OnTransOnly=no
AvoidThreats=no
IonImmune=no
TransportsReturnOnUnload=no
AreTeamMembersRecruitable=yes
IsBaseDefense=yes
OnlyTargetHouseEnemy=no
Script=SCR0073
TaskForce=TF0081

[AITriggerTypes]
TRG0001=Guard - Ally Barracks,TEAM0001,<all>,2,1,GAPILE,0100000003000000000000000000000000000000000000000000000000000000,250.000000,250.000000,250.000000,1,0,1,0,<none>,1,1,1
TRG0030=Guard - Yuri Barracks,TEAM002E,<all>,2,1,YABRCK,0100000003000000000000000000000000000000000000000000000000000000,250.000000,250.000000,250.000000,1,0,3,0,<none>,1,1,1
TRG0036=Water Yuri - Siege A,TEAM003A,<all>,4,0,GACNST,0100000003000000000000000000000000000000000000000000000000000000,150.000000,80.000000,500.000000,1,0,3,0,<none>,0,1,1
TRG0039=Water Soviet - Siege A,TEAM003D,<all>,4,0,GACNST,0100000003000000000000000000000000000000000000000000000000000000,150.000000,80.000000,500.000000,1,0,2,0,<none>,0,1,1
TRG003A=Water Ally - Siege A,TEAM003C,<all>,4,0,GACNST,0100000003000000000000000000000000000000000000000000000000000000,150.000000,80.000000,500.000000,1,0,1,0,<none>,0,1,1
TRG0043=Water Yuri - Siege S,TEAM0059,<all>,4,0,NACNST,0100000003000000000000000000000000000000000000000000000000000000,150.000000,80.000000,500.000000,1,0,3,0,<none>,0,1,1
TRG0053=Water Yuri - Siege Y,TEAM005A,<all>,4,0,YACNST,0100000003000000000000000000000000000000000000000000000000000000,150.000000,80.000000,500.000000,1,0,3,0,<none>,0,1,1
TRG0054=Water Ally - Siege S,TEAM005B,<all>,4,0,NACNST,0100000003000000000000000000000000000000000000000000000000000000,150.000000,80.000000,500.000000,1,0,1,0,<none>,0,1,1
TRG0055=Water Ally - Siege Y,TEAM005C,<all>,4,0,YACNST,0100000003000000000000000000000000000000000000000000000000000000,150.000000,80.000000,500.000000,1,0,1,0,<none>,0,1,1
TRG0056=Water Soviet - Siege S,TEAM005D,<all>,4,0,NACNST,0100000003000000000000000000000000000000000000000000000000000000,150.000000,80.000000,500.000000,1,0,2,0,<none>,0,1,1
TRG0057=Water Soviet - Siege Y,TEAM005E,<all>,4,0,YACNST,0100000003000000000000000000000000000000000000000000000000000000,150.000000,80.000000,500.000000,1,0,2,0,<none>,0,1,1
TRG00FD=Guard - Soviet Barracks,TEAM00E5,<all>,2,1,NAHAND,0100000003000000000000000000000000000000000000000000000000000000,250.000000,250.000000,250.000000,1,0,2,0,<none>,1,1,1

Steps to reproduce

  1. Use AIMD.INI sample code above or download the zip.
  2. Set all costs to 100, shroud off and max game speed and wait for AI to build them.
  3. Ships will succeed attacking buildings in range but get stuck on those too far.

Expected behaviour

AI ships should skip unreachable targets and move on to the next script actions.

Actual behaviour

Ships get stuck trying to reach target, see attached gif.

Additional context

ships-cannot-reach-target aimd.zip

FS-21 commented 2 years ago

If I'm not wrong the original 0,x actions works in the same way so this isn't a bug.

I created 2 new actions for the new attack actions for solving this kind of scenarios but isnt in develop branch because nobody tested it.

Look at this PR and give me feedback if this solves the behavior:

Added Timed Jump functions #488

AlliedG commented 2 years ago

Can confirm this is an issue with the original vanilla game.

ghost commented 2 years ago

@FS-21 It's an improper solution, but I love it! I don't know how to use 124 and 126, but 125 works like a charm. Here's a test sample script:

[SCR0032] Name=Naval Bomb A 0=49,0 1=125,5000 ; <-- about 5 minutes at 15 frames/second 2=46,131095 3=125,5000 4=46,131072 5=125,5000 6=46,131074 7=125,5000 8=46,131136 9=125,5000 10=46,131093 11=125,5000 12=46,131127 13=125,5000 14=46,131138 15=125,5000 16=46,131079 17=125,5000 18=46,131075 19=125,5000 20=46,131073 21=125,5000 22=46,131101 23=125,5000 24=46,131099 25=125,5000 26=46,131428 27=125,5000 28=46,131135 29=71,30 30=54,0

Not only stops the wiggling after a while, but it also works to change targets if the current target is too well defended and can't be destroyed. Combined with "pick random script" (which I also tested) can be a blast, please get it into the next release, and thank you for your great work!

FS-21 commented 2 years ago

@FS-21 It's an improper solution, but I love it! I don't know how to use 124 and 126, but 125 works like a charm. Here's a test sample script:

[SCR0032] Name=Naval Bomb A 0=49,0 1=125,5000 ; <-- about 5 minutes at 15 frames/second 2=46,131095 3=125,5000 4=46,131072 5=125,5000 6=46,131074 7=125,5000 8=46,131136 9=125,5000 10=46,131093 11=125,5000 12=46,131127 13=125,5000 14=46,131138 15=125,5000 16=46,131079 17=125,5000 18=46,131075 19=125,5000 20=46,131073 21=125,5000 22=46,131101 23=125,5000 24=46,131099 25=125,5000 26=46,131428 27=125,5000 28=46,131135 29=71,30 30=54,0

Not only stops the wiggling after a while, but it also works to change targets if the current target is too well defended and can't be destroyed. Combined with "pick random script" (which I also tested) can be a blast, please get it into the next release, and thank you for your great work!

...=125,5000 ; <-- about 5 minutes at 15 frames/second Means: in 5 minutes at 15 frames/second jump to the next script line independently the status of the current line.

...=126,5000 ; <-- about 5 minutes at 15 frames/second Means: like action 125 but this time in 5 minutes at 15 frames/second jump re-run the current script line independently the status of the current line.

Action 124,0 means: stop permanently the count of the timed jumps!

ghost commented 2 years ago

@FS-21 I guess 126,n can be used for hunt instructions for units that seem to stop after a while, if you know other uses let me know or write it into docs, and thanks again, your work on AI scripts is very useful.

FS-21 commented 2 years ago

@FS-21 I guess 126,n can be used for hunt instructions for units that seem to stop after a while, if you know other uses let me know or write it into docs, and thanks again, your work on AI scripts is very useful.

The way I use the 126 is for re-targeting in naval teams that never change the target like aircraft carriers or Dreadnought attacking ground objectives. After some time targeting ground targets AI could have other possible targets that could fit the Attack action I prefer to use this action 126 for re-running the targeting algorithm of the current attack action helps the AI.