Jump to content


Photo

Dynamic attack paths


  • Please log in to reply
10 replies to this topic

#1 Mithril

Mithril

    496

  • Hosted
  • 1,386 posts
  • Location:UK
  • Projects:Heh! You're not going to ask me that question.

Posted 24 July 2004 - 05:28 PM

New tutorial about Dynamic attack paths is up. If you implement this your AI won't just send teams to die at the enemy base defenses. Especially useful for Burton\Black Lotus rush tactics...
Command & Conquer: Red Alert - ReGeneration

"Not the faintest clue =\"

-ComradeJ

#2 Mastermind

Mastermind

    Server Technician

  • Undead
  • 7,014 posts
  • Location:Cambridge, MA
  • Projects:MasterNews 3
  •  The Man Behind the Curtain

Posted 27 July 2004 - 12:11 AM

You might want to change the Aeroasai Enemyhasdefenses flag, but other than that I like the tutorial. I think for Defcon R2 I'll try to do the AI myself, and not make you do all the work again.
:D
Posted Image

Well, when it comes to writing an expository essay about counter-insurgent tactics, I'm of the old school. First you tell them how you're going to kill them. Then you kill them. Then you tell them how you just killed them.

Too cute! | Server Status: If you can read this, it's up |

#3 thudo

thudo

    Wacko AI Guy!

  • Division Leaders
  • 12,035 posts
  • Location:Lemonville North, Canada
  • Projects:DoW AI Scripting Project
  • Division:DoW
  • Job:Division Leader

Posted 27 July 2004 - 12:59 PM

Hmmm.. now if we could get Siege-class units to pound those defenses while being guarded by its own units out of the range of those enemy defenses. Having units guard another unit has never worked well (stupid EA) but if we sent a team with siege in mind, based on the location of enemy defenses, then set this team to take these defenses out being defended by non-siege team members then.. W00t! This would be interesting..
Advanced Skirmish AI Team Lead for the coolest Warhammer40k PC RTS out there:

Dawn of War Advanced AI Headquarters

Latest DoW Advanced AI Download!

#4 Akkrand

Akkrand
  • New Members
  • 61 posts
  • Location:Melbourne, Australia

Posted 06 August 2004 - 04:55 AM

I've just today decided to have a look at how well the computer uses these dynamic paths, only to find that the 'Check X' scripts are not even evaluating!
I previously made changes to the Check X scripts such that there were 2 of them, the first evaluating whether the probe had reached the waypoint, which called the second which evaluated whether it had been attacked by a defense, and set the 'enemyXhasdefences' flag accordingly.
The first Check X script never evaluates to true, so it never checks for defences hence never updates the flags.
In addition, I found several teams get through but then sit there passive waiting to die. So in the first Check X script before calling the second one, I set the team to aggressive, and in the second one, as well as setting the flag appropriately, I set the team to hunt.

I've altered mine again and the condition for Check X is now 'True', but the script has been moved from the teams 'Generic' tab to the teams 'On Idle' slot; Now the team is created, instantly runs 'Move to X' OnCreate, when it gets there, it becomes Idle, runs the Check, becomes aggressive, decides whether its been attacked, sets the flag accordingly, and starts hunting.

Can't wait to see if it makes a significant difference this time!

Cheers,
Lord Akkrand

#5 Mithril

Mithril

    496

  • Hosted
  • 1,386 posts
  • Location:UK
  • Projects:Heh! You're not going to ask me that question.

Posted 06 August 2004 - 11:17 AM

Thanks a lot for testing this! If it works I'll edit the tutorial a bit. Strangely enough, I tested this and it worked for some reason... anyway please tell me what you've discovered once you have tested it :sleep:
Command & Conquer: Red Alert - ReGeneration

"Not the faintest clue =\"

-ComradeJ

#6 Akkrand

Akkrand
  • New Members
  • 61 posts
  • Location:Melbourne, Australia

Posted 08 August 2004 - 11:04 PM

Ok, it worked now; the Check X script would evaluate the moment the probe team reached the waypoint, it would determine if it had been attacked by a defense, and then hunt fine...

I found a problem that may have been map specific - in Homeland Defence, the waypoint for the attack path Center was the crossroads just outside the base, and I found that the probe would get to the waypoint, check, find no defence had attacked it, then move forward for about a second before my defences opened up on it...
IIRC, the waypoints Center, Flank & Backdoor are all just outside the base, and are where teams gather before they attack, so it's only logical they'll be out of range of most defences...
So this doesn't seem to affect the my AI's effectiveness that much...

BTW Mithril you mentioned (in some thread) that you wanted a method that worked out how many defences were present without using timers; why didn't you want to use timers? 'Cos I've got an idea that would use them...

Cheers,
Lord Akkrand

#7 Mithril

Mithril

    496

  • Hosted
  • 1,386 posts
  • Location:UK
  • Projects:Heh! You're not going to ask me that question.

Posted 10 August 2004 - 10:27 AM

Yes explain! That would be even more powerful. BTW have you got MSN? That way we won't have to rely on forums too much
Command & Conquer: Red Alert - ReGeneration

"Not the faintest clue =\"

-ComradeJ

#8 Akkrand

Akkrand
  • New Members
  • 61 posts
  • Location:Melbourne, Australia

Posted 10 August 2004 - 11:28 PM

Okay, this method is simple, yet the scripting of it is a little complex (due to the limiting factors of the scripting language - <rant> WHY THE HELL CAN'T I COMPARE TWO VARIABLES </rant>)

I make the assumption that you have defined the flags '_EnemyXHasDefenses' where X is Center, Flank & Back(door). I also assume that you've got some script that periodically creates three 'Probe' teams to send; mine has a timer which goes off every 2-3 minutes, '_IntelNeeded'

*** IF ***
    Timer '_NeedIntel' has expired.
*** THEN ***
  Start building team Team 'Demo Probe Center'
  Start building team Team 'Demo Probe Back'
  Start building team Team 'Demo Probe Flank'
  Set timer '_NeedIntel' to expire between 120.00 and 180.00 seconds.

I also have another init script which sets up all the variables needed for this (it saves adding them into the paper work vars init script)

*** IF ***
    True.
*** THEN ***
  Set Flag named 'ReachedEnemyCenter' to FALSE
  Set Flag named 'ReachedEnemyFlank' to FALSE
  Set Flag named 'ReachedEnemyBack' to FALSE
  Set Flag named 'AttackedBeforeReachedBack' to FALSE
  Set Flag named 'AttackedBeforeReachedFlank' to FALSE
  Set Flag named 'AttackedBeforeReachedCenter' to FALSE
  Set Flag named 'CenterTimerSet' to FALSE
  Set Flag named 'FlankTimerSet' to FALSE
  Set Flag named 'BackTimerSet' to FALSE
  Set 'DestroyedBeforeCenter' to  0
  Set 'DestroyedBeforeFlank' to  0
  Set 'DestroyedBeforeBack' to  0
  Set 'DestroyedBeforeCenterDefenses' to  0
  Set 'DestroyedBeforeFlankDefenses' to  0
  Set 'DestroyedBeforeBackDefenses' to  0
  Set timer 'FlankAttackedToDeath' to expire in 1.00 seconds.
  Set timer 'BackAttackedToDeath' to expire in 1.00 seconds.
  Set timer 'CenterAttackedToDeath' to expire in 1.00 seconds.
  Stop timer 'CenterAttackedToDeath'
  Stop timer 'FlankAttackedToDeath'
  Stop timer 'BackAttackedToDeath'
  Set 'CenterAliveSeconds' to  0
  Set 'FlankAliveSeconds' to  0
  Set 'BackAliveSeconds' to  0
  Set 'IntelLevel' to  3


I'll explain them as needed.

First I'll describe the probe teams - they're pretty similar to the ones from the tutorial, except they have 'Move to X' OnCreate & 'Check X' OnIdle. In their Generic tab they have 'Check X Attacked Before', 'Check X Attacked Timer' & 'Check X Timer Expired'. Also it has 'Check X Death' On 100% Destroyed.
Here's those scripts:

Move to X:

*** IF ***
    True.
*** THEN ***
  Have Team '<This Team>' move to the start of enemy path 'Center'.
  Set Flag named 'AttackedBeforeReachedCenter' to FALSE
  Set Flag named 'ReachedEnemyCenter' to FALSE
  Set Flag named 'CenterTimerSet' to FALSE
  Subtract  1  from counter 'IntelLevel'

This resets all the variables for this team (as there will be multiple times this team is built). It also subtracts 1 from IntelLevel (which begins at 3). IntelLevel is a value which allows me to determine whether the AI is in the middle of sending probe teams. Basically, until all three probes have completed their recon, the intelligence is 'supsect'.

Check X:

*** IF ***
    True.
*** THEN ***
  Team '<This Team>' change their attitude to Aggressive
  Set Flag named 'ReachedEnemyCenter' to TRUE
  Run Subroutine 'Check Center 2'.

This script is run OnIdle, so it runs when the probe reaches the waypoint and stops. Here the AI doesn't stand around but gets aggressive. It also sets a flag which lets me know it reached the waypoint, which becomes useful later. It finally runs the sub 'Check X 2'

Check X 2:

*** IF ***
    Team '<This Team>' has been attacked by a(n) 'Base Defenses'
*** THEN ***
  Set Flag named '_EnemyCenterHasDefenses' to TRUE
  Team '<This Team>' begins hunting.
*** ELSE ***
  Set Flag named '_EnemyCenterHasDefenses' to FALSE
  Team '<This Team>' begins hunting.

I know; putting "Team '<This Team>' begins hunting" in both is silly, I should have put it in 'Check X', but initially the scripts worked differently & I couldn't be bothered changing it... it still works, hey.
This one is simple, it either sets '_EnemyXHasDefenses' to TRUE or FALSE based on whether it has been attacked by a base defence up to this point. Note that if you look at tha placement of these waypoints on a standard map, you will realise this only tells you if someone has defenses really quite far from their base, so its not that useful; I find most of the time the AI gets to the waypoint, gives the all clear, then takes about five steps forward and comes under attack (at least from my base)... Anyway...

Now for the Generic ones:
Check X Attacked Before:

*** IF ***
    Team '<This Team>' has been attacked by a(n) 'Base Defenses'
    *AND*  Flag named 'ReachedEnemyCenter' IS FALSE
*** THEN ***
  Set Flag named '_EnemyCenterHasDefenses' to TRUE
  Set Flag named 'AttackedBeforeReachedCenter' to TRUE
  Team '<This Team>' begins hunting.

This one kicks in if the probe is attacked by a base defence before it reaches the waypoint, which can be useful if the defense kills the team; previously it would never reach the waypoint and hence never update the flag (if it had previously been set to FALSE). It also sets the flag 'AttackedBeforeReachedX', which is used later.
In hindsight this one should probably have
"*AND* Flag named 'AttackedBeforeReachedCenter' IS FALSE"
in the condition as well, so once it runs the moment the probe is attacked, it won't run again. ( I *hate* it when scripts needlessly run every frame, slows the game down so much in multiplayer... 0.5 frames / sec, anyone?)

Check X Attacked Timer:

*** IF ***
    Team '<This Team>' has been attacked by a(n) 'Base Defenses'
    *AND*  Flag named 'CenterTimerSet' IS FALSE
  *** OR ***
    Team '<This Team>' has been attacked by Player '<This Player's Enemy>'
    *AND*  Flag named 'CenterTimerSet' IS FALSE
*** THEN ***
  Set timer 'CenterAttackedToDeath' to expire in 1.00 seconds.
  Set Flag named 'CenterTimerSet' to TRUE
  Set 'CenterAliveSeconds' to  0
  Restart timer 'CenterAttackedToDeath'

This one checks if the probe has been attacked at all (by anything). The other condition is so it only runs once. It sets a timer to expire in a second, sets a counter to zero, and makes sure the timer is counting down. These actions make more sense later.

Check X Timer Expired:

*** IF ***
    Timer 'CenterAttackedToDeath' has expired.
*** THEN ***
  Set timer 'CenterAttackedToDeath' to expire in 1.00 seconds.
  Add  1  to counter 'CenterAliveSeconds'

Simple. This script 'counts' the number of seconds since the timer was first started. Every second, the timer expires, it adds one to the counter, restarts. If only I could have upwards counting timers!

Lastly, there is the On death condition,
Check X Death:

*** IF ***
    True.
*** THEN ***
  Stop timer 'CenterAttackedToDeath'
  Add  1  to counter 'IntelLevel'

This stops the above mentioned timer upon the moment of the probes death, as well as adding to the IntelLevel, letting us know the team has performed its 'recon'.

So the above scripts give you a probe that moves to a base entrance, checks if it been attacked by a defense, and sets the 'has defenses' flag accordingly. If its attacked by a base defense before it reaches the waypoint, it sets the flag also. Lastly, if its attacked AT ALL, it counts how many seconds from that point to when he dies. Note that of course several of these will run concurrently, like when a base defense attackes the probe before it reaches the waypoint... And the values you have are how many seconds each team survives once under attack, giving you a rough guide to how deadly/effiecient the defence of that entrance is.

I'll follow up with my new dynamic choosing in a new post, as this one is getting long :rolleyes:

Cheers,
Lord Akkrand

#9 Akkrand

Akkrand
  • New Members
  • 61 posts
  • Location:Melbourne, Australia

Posted 11 August 2004 - 12:05 AM

Okay, the choosing of the path is all begun with 'Attack Dynamic Center'; I'd rather it was simply 'Attack Dynamic', but I altered all the Team Attack Behaviour 'Attack Enemy Base X' scripts to run 'Attack Dynamic Center' and can't be bothered going back and altering them for cosmetics.
Attack Dynamic Center:
[quote]*** IF ***
    Counter 'IntelLevel' IS Equal To  3
*** THEN ***
  Run Subroutine 'Attack Dynamic All'.
*** ELSE ***
  Run Subroutine 'Attack Dynamic Center DefenceFlags'.[/quote]
Thus we see that the AI does use the IntelLevel; if the intel is insufficient, it relies upon a simpler, less efficient method... unlucky if the _LAUNCH_ATTACK_FLAG sets at this point.
Attack Dynamic Center DefenseFlags:
[quote]*** IF ***
    Flag named '_EnemyCenterHasDefenses' IS FALSE
    *AND*  Flag named '_EnemyFlankHasDefenses' IS FALSE
    *AND*  Flag named '_EnemyBackHasDefenses' IS FALSE
*** THEN ***
  Run Subroutine 'Attack Dynamic Intel Check'.
*** ELSE ***
  Run Subroutine 'Attack Dynamic 2'.[/quote]
Checks if all entrances are free of defenses, if so, checks to see whether this Intel is correct, else continues.

Attack Dynamic Intel Check:
[quote]*** IF ***
    Counter 'IntelLevel' IS Equal To  3
*** THEN ***
  Run Subroutine 'Attack Dynamic All'.
*** ELSE ***
  Team '<This Team>' executes Script 'Attack Enemy Base Center Sequence' sequentially.[/quote]
Basically does the check from above again (this is called from more than one place), if the Intel is not full then simply attacks the Center... bad luck. I suppose it could go ahead on false/incomplete intelligence, but I didn't like it...

Continutaion,
Attack Dynamic 2:
[quote]*** IF ***
    Flag named '_EnemyCenterHasDefenses' IS FALSE
    *AND*  Flag named '_EnemyFlankHasDefenses' IS TRUE
    *AND*  Flag named '_EnemyBackHasDefenses' IS TRUE
*** THEN ***
  Team '<This Team>' executes Script 'Attack Enemy Base Center Sequence' sequentially.
*** ELSE ***
  Run Subroutine 'Attack Dynamic 3'.[/quote]
Next possibliity, only the Center is free of defense... no brainer this one, attack the center... else...

Attack Dynamic 3:
[quote]*** IF ***
    Flag named '_EnemyCenterHasDefenses' IS TRUE
    *AND*  Flag named '_EnemyFlankHasDefenses' IS FALSE
    *AND*  Flag named '_EnemyBackHasDefenses' IS TRUE
*** THEN ***
  Team '<This Team>' executes Script 'Attack Enemy Base Flank Sequence' sequentially.
*** ELSE ***
  Run Subroutine 'Attack Dynamic 4'.[/quote]
Again, no brainer; flank is free, attack flank, else...

Attack Dynamic 4:
[quote]*** IF ***
    Flag named '_EnemyCenterHasDefenses' IS TRUE
    *AND*  Flag named '_EnemyFlankHasDefenses' IS TRUE
    *AND*  Flag named '_EnemyBackHasDefenses' IS FALSE
*** THEN ***
  Team '<This Team>' executes Script 'Attack Enemy Base Back Sequence' sequentially.
*** ELSE ***
  Run Subroutine 'Attack Dynamic 5'.[/quote]
Getting a bit 'samey', isn't it?

Attack Dynamic 5:
[quote]*** IF ***
    Flag named '_EnemyCenterHasDefenses' IS TRUE
    *AND*  Flag named '_EnemyFlankHasDefenses' IS TRUE
    *AND*  Flag named '_EnemyBackHasDefenses' IS TRUE
*** THEN ***
  Run Subroutine 'Attack Dynamic Intel Check'.
*** ELSE ***
  Run Subroutine 'Attack Dynamic 6'.[/quote]
If they all have defenses, run the Intel Check; this pretty much means it will attack Center, this is a leftover from when the scripts, in dev, changed to only use the 'defense flags' approach when the intel was scarce.

Attack Dynamic 6:
[quote]*** IF ***
    Flag named '_EnemyCenterHasDefenses' IS FALSE
    *AND*  Flag named '_EnemyFlankHasDefenses' IS FALSE
    *AND*  Flag named '_EnemyBackHasDefenses' IS TRUE
*** THEN ***
  Run Subroutine 'Attack Dynamic FlankvsCenter'.
*** ELSE ***
  Run Subroutine 'Attack Dynamic 7'.[/quote]
Starts checking 2 open/1 closed conditions, and running compare scripts... these are the good ones... I'm keeping them for later... :p
...else...

Attack Dynamic 7:
[quote]*** IF ***
    Flag named '_EnemyCenterHasDefenses' IS FALSE
    *AND*  Flag named '_EnemyFlankHasDefenses' IS TRUE
    *AND*  Flag named '_EnemyBackHasDefenses' IS FALSE
*** THEN ***
  Run Subroutine 'Attack Dynamic BackvsCenter'.
*** ELSE ***
  Run Subroutine 'Attack Dynamic 8'.[/quote]
Same... 2 other entrances open... else...

Attack Dynamic 8:
[quote]*** IF ***
    Flag named '_EnemyCenterHasDefenses' IS TRUE
    *AND*  Flag named '_EnemyFlankHasDefenses' IS FALSE
    *AND*  Flag named '_EnemyBackHasDefenses' IS FALSE
*** THEN ***
  Run Subroutine 'Attack Dynamic BackvsFlank'.
*** ELSE ***
  Team '<This Team>' executes Script 'Attack Enemy Base Center Sequence' sequentially.[/quote]
The else in this one is just a precaution, unless my logic is flawed, this can never be run, all the possibilities have already been checked, this condition HAS to be true.

Now the next few are quite long and I plan to increase then twofold when I have time, the reason they're so long is :
[quote]Due to technical limitations, you cannot compare a variable to another variable in scripts.  Variables can be compared to fixed values.[/quote]
I couldn't believe it when I read that...

Attack Dynamic All:
[quote]*** IF ***
    Counter 'BackAliveSeconds' IS Less Than  1
    *AND* Counter 'FlankAliveSeconds' IS Greater Than or Equal To  1
  *** OR ***
    Counter 'BackAliveSeconds' IS Less Than  2
    *AND* Counter 'FlankAliveSeconds' IS Greater Than or Equal To  2
  *** OR ***
    Counter 'BackAliveSeconds' IS Less Than  3
    *AND* Counter 'FlankAliveSeconds' IS Greater Than or Equal To  3
  *** OR ***
    Counter 'BackAliveSeconds' IS Less Than  4
    *AND* Counter 'FlankAliveSeconds' IS Greater Than or Equal To  4
  *** OR ***
    Counter 'BackAliveSeconds' IS Less Than  5
    *AND* Counter 'FlankAliveSeconds' IS Greater Than or Equal To  5
  *** OR ***
    Counter 'BackAliveSeconds' IS Less Than  6
    *AND* Counter 'FlankAliveSeconds' IS Greater Than or Equal To  6
  *** OR ***
    Counter 'BackAliveSeconds' IS Less Than  7
    *AND* Counter 'FlankAliveSeconds' IS Greater Than or Equal To  7
  *** OR ***
    Counter 'BackAliveSeconds' IS Less Than  8
    *AND* Counter 'FlankAliveSeconds' IS Greater Than or Equal To  8
  *** OR ***
    Counter 'BackAliveSeconds' IS Less Than  9
    *AND* Counter 'FlankAliveSeconds' IS Greater Than or Equal To  9
  *** OR ***
    Counter 'BackAliveSeconds' IS Less Than  10
    *AND* Counter 'FlankAliveSeconds' IS Greater Than or Equal To  10
*** THEN ***
  Run Subroutine 'Attack Dynamic FlankvsCenter'.
*** ELSE ***
  Run Subroutine 'Attack Dynamic BackvsCenter'.[/quote]
As you can see, it checks if the time the Flank Probe stayed alive is longer than the time the Back Probe stayed alive (once they came under attack). If the flank survived longer, it checks the Flank vs the Center, else the Back vs the Center.
I plan on 'upgrading' all these scripts to go to 20 seconds, I don't think the data is meaningful past that... If it takes that long at more than one entrance, then the data is either invalid (attacked briefly way away from the base) or the defender is screwed anyway, it shouldn't matter which entrance you use... ;)
Note that in the case of a tie (both died in 1 second, for example), it will go with the ELSE clause, hence compare back to center.


For completeness, and used by the Attack Dynamic X (number) scripts is
Attack Dynamic BackvsFlank:
[quote]*** IF ***
    Counter 'BackAliveSeconds' IS Less Than  1
    *AND* Counter 'FlankAliveSeconds' IS Greater Than or Equal To  1
  *** OR ***
    Counter 'BackAliveSeconds' IS Less Than  2
    *AND* Counter 'FlankAliveSeconds' IS Greater Than or Equal To  2
  *** OR ***
    Counter 'BackAliveSeconds' IS Less Than  3
    *AND* Counter 'FlankAliveSeconds' IS Greater Than or Equal To  3
  *** OR ***
    Counter 'BackAliveSeconds' IS Less Than  4
    *AND* Counter 'FlankAliveSeconds' IS Greater Than or Equal To  4
  *** OR ***
    Counter 'BackAliveSeconds' IS Less Than  5
    *AND* Counter 'FlankAliveSeconds' IS Greater Than or Equal To  5
  *** OR ***
    Counter 'BackAliveSeconds' IS Less Than  6
    *AND* Counter 'FlankAliveSeconds' IS Greater Than or Equal To  6
  *** OR ***
    Counter 'BackAliveSeconds' IS Less Than  7
    *AND* Counter 'FlankAliveSeconds' IS Greater Than or Equal To  7
  *** OR ***
    Counter 'BackAliveSeconds' IS Less Than  8
    *AND* Counter 'FlankAliveSeconds' IS Greater Than or Equal To  8
  *** OR ***
    Counter 'BackAliveSeconds' IS Less Than  9
    *AND* Counter 'FlankAliveSeconds' IS Greater Than or Equal To  9
  *** OR ***
    Counter 'BackAliveSeconds' IS Less Than  10
    *AND* Counter 'FlankAliveSeconds' IS Greater Than or Equal To  10
*** THEN ***
  Team '<This Team>' executes Script 'Attack Enemy Base Flank Sequence' sequentially.
*** ELSE ***
  Team '<This Team>' executes Script 'Attack Enemy Base Back Sequence' sequentially.[/quote]
Same thing, but since its only comparing those two entrances (Center has been ruled out), the actions are the attack sequences. Note that in the case of a tie (both died in 1 second, for example), it will go with the ELSE clause, hence the back of the base.

Attack Dynamic FlankvsCenter:
[quote]*** IF ***
    Counter 'CenterAliveSeconds' IS Less Than  1
    *AND* Counter 'FlankAliveSeconds' IS Greater Than or Equal To  1
  *** OR ***
    Counter 'CenterAliveSeconds' IS Less Than  2
    *AND* Counter 'FlankAliveSeconds' IS Greater Than or Equal To  2
  *** OR ***
    Counter 'CenterAliveSeconds' IS Less Than  3
    *AND* Counter 'FlankAliveSeconds' IS Greater Than or Equal To  3
  *** OR ***
    Counter 'CenterAliveSeconds' IS Less Than  4
    *AND* Counter 'FlankAliveSeconds' IS Greater Than or Equal To  4
  *** OR ***
    Counter 'CenterAliveSeconds' IS Less Than  5
    *AND* Counter 'FlankAliveSeconds' IS Greater Than or Equal To  5
  *** OR ***
    Counter 'CenterAliveSeconds' IS Less Than  6
    *AND* Counter 'FlankAliveSeconds' IS Greater Than or Equal To  6
  *** OR ***
    Counter 'CenterAliveSeconds' IS Less Than  7
    *AND* Counter 'FlankAliveSeconds' IS Greater Than or Equal To  7
  *** OR ***
    Counter 'CenterAliveSeconds' IS Less Than  8
    *AND* Counter 'FlankAliveSeconds' IS Greater Than or Equal To  8
  *** OR ***
    Counter 'CenterAliveSeconds' IS Less Than  9
    *AND* Counter 'FlankAliveSeconds' IS Greater Than or Equal To  9
  *** OR ***
    Counter 'CenterAliveSeconds' IS Less Than  10
    *AND* Counter 'FlankAliveSeconds' IS Greater Than or Equal To  10
*** THEN ***
  Team '<This Team>' executes Script 'Attack Enemy Base Flank Sequence' sequentially.
*** ELSE ***
  Team '<This Team>' executes Script 'Attack Enemy Base Center Sequence' sequentially.[/quote]
Same but comparing Flank to Center... Here again it chooses the ELSE in case of a tie, going with Center this time;

Attack Dynamic BackvsCenter:
[quote]*** IF ***
    Counter 'BackAliveSeconds' IS Less Than  1
    *AND* Counter 'CenterAliveSeconds' IS Greater Than or Equal To  1
  *** OR ***
    Counter 'BackAliveSeconds' IS Less Than  2
    *AND* Counter 'CenterAliveSeconds' IS Greater Than or Equal To  2
  *** OR ***
    Counter 'BackAliveSeconds' IS Less Than  3
    *AND* Counter 'CenterAliveSeconds' IS Greater Than or Equal To  3
  *** OR ***
    Counter 'BackAliveSeconds' IS Less Than  4
    *AND* Counter 'CenterAliveSeconds' IS Greater Than or Equal To  4
  *** OR ***
    Counter 'BackAliveSeconds' IS Less Than  5
    *AND* Counter 'CenterAliveSeconds' IS Greater Than or Equal To  5
  *** OR ***
    Counter 'BackAliveSeconds' IS Less Than  6
    *AND* Counter 'CenterAliveSeconds' IS Greater Than or Equal To  6
  *** OR ***
    Counter 'BackAliveSeconds' IS Less Than  7
    *AND* Counter 'CenterAliveSeconds' IS Greater Than or Equal To  7
  *** OR ***
    Counter 'BackAliveSeconds' IS Less Than  8
    *AND* Counter 'CenterAliveSeconds' IS Greater Than or Equal To  8
  *** OR ***
    Counter 'BackAliveSeconds' IS Less Than  9
    *AND* Counter 'CenterAliveSeconds' IS Greater Than or Equal To  9
  *** OR ***
    Counter 'BackAliveSeconds' IS Less Than  10
    *AND* Counter 'CenterAliveSeconds' IS Greater Than or Equal To  10
*** THEN ***
  Team '<This Team>' executes Script 'Attack Enemy Base Center Sequence' sequentially.
*** ELSE ***
  Team '<This Team>' executes Script 'Attack Enemy Base Back Sequence' sequentially.[/quote]
Same stuff as before.

The 'Attack Enemy Base X Sequence' scripts are basically lifted straight from the Generic Attack Behaviour folder, they all follow the pattern:
[quote]*** IF ***
    True.
*** THEN ***
  Have Team '<This Team>' move to the start of enemy path 'Center'.
  Have Team '<This Team>' approach the enemy using path 'Center', as a team is TRUE
  Team '<This Team>' begins hunting.[/quote]

So there you have it... If I hadn't put so much work into the Attack Dynamic 2-8 scripts, I'd probably drop them entirely & have Attack Dynamic Center say:
[QUOTE]
*** IF ***
True.
*** THEN ***
Run Subroutine 'Attack Dynamic All'
[QUOTE]
I think it would work better. But hey, its better than it was. ;)


And now I've got to do some work, as its 10am, I should have been working now for an hour, although it looks like I'm working... :)

BTW Mithril I don't have MSN, although I do have Yahoo, ID 'akkrand'... But I fear it might be difficult, as I'm in Oz and gathering from the times of your posts, you're somewhere in the US - I don't believe you're at the North Pole ;) - and the timezone difference may be a problem... By about the time I'm finishing work, tho, around 4-5 here, its 6-7am there (IIRC), so we might catch each other briefly then, or when I get home if I don't just watch TV and go to bed...

I apologise for the massive posts, but you asked for details... :rolleyes:

Cheers,
Lord Akkrand

#10 Mithril

Mithril

    496

  • Hosted
  • 1,386 posts
  • Location:UK
  • Projects:Heh! You're not going to ask me that question.

Posted 11 August 2004 - 08:45 AM

Details of things - that is exactly what I wanted!

Thanks a bunch!

I'll convert this into a "Advanced dynamic attack paths" tutorial at another interval of time. Newbies will be overwhelmed, but determined scripters will find this to be useful.


BTW I'm in europe, not the US.. well the north pole is a bit cold for me to be there I must admit :rolleyes:
We'll stick to the forums then
Command & Conquer: Red Alert - ReGeneration

"Not the faintest clue =\"

-ComradeJ

#11 Akkrand

Akkrand
  • New Members
  • 61 posts
  • Location:Melbourne, Australia

Posted 13 August 2004 - 05:56 AM

Okay,
I've cleaned up the Dynamic Attack Paths folder a bit, gotten rid of all the 'Attack Dynamic 2-8' crap, as I don't feel the flag telling me whether there are defenses before the waypoint is of any use, as the waypoints are typically a 'muster point', just outside where you could reasonable expect defenses to be.
Instead all the path choosing is based on the time it takes to kill each team from when they first get attacked.
Also instead of automatically sending a team to 'Center' when the IntelLevel is not 3, it runs the normal comparison, but if it finds that all three 'AliveXSeconds' are zero, it will go with Center anyway... that doesn't make much of a difference, but it means that if there is a probe still alive, and the other 2 are dead, it uses the best of the intelligence gathered so far (better the devil you know that the devil you don't). In any case it made the whole thing a lot cleaner.
Also, I have made 4 scripts which I use to tell units to use the Dynamic Attack Paths, 'Wave Attack Dynamic', 'Wave Attack Hunt', 'Immediate Attack Dynamic' & 'Immediate Attack Hunt'. Obviously the 2 'Hunt' ones don't use the dynamic paths.
They are all run from the Generic tab of the team you want to use them, and are all pretty self explanatory; if it starts with 'Wave', it will attack when _LAUNCH_ATTACK goes TRUE; if it starts with 'Immediatly', they will start immediately; if it ends in 'Dynamic' they use the attack paths; if it ends in 'Hunt' they begin hunting. Simple.
The beauty of these Dynamic scripts is that they have conditions such that, should a probe die *after* they have commenced their attack sequence, they will 'redirect', running the comparisons again in the light of the new information. This allows a team halfway across the map to make a slight change of plans to take advantage of developing conditions on the battlefield.
An example best illustrates this:
3 Probe teams leave the base, one by one. Probe Center hits a defense wall and dies in 1 second. Probe Flank hits a defence wall and dies in 3 seconds. Probe Back has not yet been attacked or died when _LAUNCH_ATTACK goes TRUE.
A team of tanks evaluates the three entrances and sees that 'Flank' has the highest count, so goes for Flank. It starts running the 'Attack Enemy Dynamic Flank Sequence' script sequentially.
Probe Back runs into a lone defence, and gets attacked. It screams on, heading into the base, and is killed 5 seconds later. Upon its death, the team of tanks (now already moving across the map), runs the Attack Dynamic Paths again, sees that the Backdoor is the least defended, and reroutes to there.

Seems to work quite well.

Anyway, gotta get back to work... Hmmm... I've got v1.13 here at work, gotta try to upload that to my site later today. It contains these changes (but only to standard USA, who I was testing it on) and some other minor things.

Here is an .scb of the 'Dynamic Attack Paths' folder if you don't want to rip it out of my SkirmishScripts.scb - note that the script 'Send Probe Teams' is not active, it needs to be activated after you import, and the 3 teams named need to match the names of the probe teams you set up in the teams list.

Cheers,
Lord Akkrand

Attached Files






0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users