Jump to content

Trigger or not to trigger


Recommended Posts

There has been a request for triggers by several people, including myself,but a post by YankeeDog has set me to questioning the worth of triggers. The CMx1 series used a StratAI which used, I suppose, triggers and the AI for CMx1 was easier to beat than CMBN is, at least for me. So the question is, are triggers a good idea for CMBN?

Link to comment
Share on other sites

There has been a request for triggers by several people, including myself,but a post by YankeeDog has set me to questioning the worth of triggers. The CMx1 series used a StratAI which used, I suppose, triggers and the AI for CMx1 was easier to beat than CMBN is, at least for me. So the question is, are triggers a good idea for CMBN?

What leads you to conclude that the AI in CMx1 used scripted triggers? I don't think it did, at least not the kind of triggers that could potentially be implemented in CMx2.

As I noted in another thread, CMx1 had a StratAI layer instead of the scripted plans you see in CMx2. I suppose you could say that the StratAI layer in CMx1 involved triggers, in the sense that the StratAI would see actions by the other side (such as seizing a Victory Flag), and react accordingly. The StratAI wasn't very subtle or elegant in its reaction, but I guess you could say this is a "trigger" type behavior. Note, though, that scenario designers in CMx1 had absolutely no control over StratAI triggers, other than indirectly by where they set Victory Flags.

Triggers in CMx2's scripted AI system would be a very different animal. There are many ways they could be implemented, but in general, with a scripted AI system, you're talking about a system that lets the scenario designer use conditional statements as part of the AI script. For example, for a given AI group, a simple conditional trigger might be something like this:

IF [enemy unit spotted] THEN WAIT [2 minutes], MOVE [location A]

This would be simple trigger that would allow a scenario designer script a group (maybe forward OPs) to stay where they are until spotting an enemy, after which they would remain where they are for 2 minutes , and then attempt to fall back to designer-defined location A.

Not at all the same as CMx1's StratAI. Apples to Oranges.

Link to comment
Share on other sites

Additional thought: Yes, AI Triggers could make the AI in CMx2 easier to beat, if the player knows or is able to guess the triggers. Then he can use gamey tactics to deliberately trigger AI conditions, and anticipate the AI reaction.

But AI actions strictly linked to time have similar problems -- if the player knows or is able to guess the AI's timing, he can time is own actions accordingly.

It's all about using the right tool in the right situation. Overall, I am an advocate of adding conditional statements/triggers to the AI scripting in CMx2. However, I also recognize that adding triggers to the AI scripting has the potential to DRAMATICALLY increase the complexity of AI scripts, and that there are many potential pitfalls.

Therefore, I think the best way to progress is to be very conservative about how and when triggers are implemented. When and if they are added, it would probably be best to start with just a few very simple triggers, rather than throwing a whole library of triggers at designers at once. A complex language of conditional triggers could potentially be used to make very elegant AI plans, but it would also probably turn AI plan scripting into something that would require a degree in programming to do right -- you're really talking about devising a programming language for AI scripting here.

Link to comment
Share on other sites

Last night I watched an HQ unit and a Hvy Vickers MG Team defending from a third story building. They were attacked from two sides. The strategic AI kicked in and had HQ and MG Team switching sides to best defend themselves from their attackers. This just didn't happen once but over and over during the game. At first I thought I'd have to move them against the threats But I finally just trusted the HQ on the spot and neither team lost a man. The attacking Germans, however, paid dearly for their failure.

Link to comment
Share on other sites

I really doubt triggers are the kind of thing we'd see in a patch. I think they definitely fall in the category of "major new feature", and so something that will probably be introduced with a new game family, not a module or a patch.

If you want my totally wild-ass guess, I'd say BFC is hoping to add some simple AI trigger scripts to the engine with the Battle of the Bulge game.

Link to comment
Share on other sites

Triggers would most definitely improve the game. At the very least it would eliminate the scenario where a unit reaches the end of it's orders, and then spends the rest of the battle staring off into space. Just give them a trigger that sends them off on patrol if they haven't seen any enemies in awhile. Also, the problem where if you break through a defense on one flank, you can make your way around through the rear and attack the rest of the defense from behind, as they will never react to being outflanked. A simple trigger that fires when your units reach a certain point could tell the AI to fall back to better positions.

Link to comment
Share on other sites

Interesting thoughts on triggers. I never really though about using triggers so that a unit that reaches the end of its orders would have something else to do after a certain time with no enemy contact. Nor did I think of writing if then else statements in the AI coding.

What I was thinking would like be useful is something much simpler. Consider a AI programmed to defend a few objectives. Right now an AI cannot really have a mobile reserve that can react to an attack. Yes, I know that designers can guess and perhaps get it right but that is all it is a guess. If a AI defense line is breached on a flank then the other units just sit there waiting to get attached from their side.

So I would like to the same kind of AI scripting that we have now but allow which script an AI group runs be triggered (and all times adjusted relative to when the trigger happens). What that would allow a designer to do is arrange a defensive line and hold a couple of AI groups in reserve. Those reserve groups would have a trigger to choose one three scripts: one to move and defend the left, one to move to defend the centre and one to move to defend the right. Then trigger for which script to choose is based on a unit on the left, a unit in the centre or a unit on the right taking casualties. Once the trigger happens the chosen AI script would run as usual. In addition you could add triggers on the main defenders such that the unit in the centre would move left if the defending unit on the left took a high level of casualties etc.

Yes, it is true that fake attacks on a flank would draw the AI the wrong direction, buy hey I sometimes fall for that too. The scenario author could easily vary the triggers so one day your faint draws the reserves but the next day it does not and the reserve instead responds to the real attack. Tweaking those trigger levels would add additional dimensions to varying the AI's behaviour game to game.

Link to comment
Share on other sites

t

So I would like to the same kind of AI scripting that we have now but allow which script an AI group runs be triggered (and all times adjusted relative to when the trigger happens). What that would allow a designer to do is arrange a defensive line and hold a couple of AI groups in reserve. Those reserve groups would have a trigger to choose one three scripts: one to move and defend the left, one to move to defend the centre and one to move to defend the right. Then trigger for which script to choose is based on a unit on the left, a unit in the centre or a unit on the right taking casualties. Once the trigger happens the chosen AI script would run as usual. In addition you could add triggers on the main defenders such that the unit in the centre would move left if the defending unit on the left took a high level of casualties etc.

Sure. But from a technical standpoint, what you are talking about is still a group of IF... THEN conditionals. E.g.: Groups 1-3 are forward units Left, Right, Center, respectively, Group 4 is reserve.

Phase 1

IF [Group 1 takes casualties], THEN [Group 4 executes a certain move or action], GO Phase 2; IF [Group 2 takes casualties], THEN [Group 4 executes a certain move or action], GO Phase 2; IF [Group 2 takes casualties, THEN [Group 4 executes a certain move or action], GO Phase 2

Phase 2 -- Whatever happens next.

I would add this is a very complex set of conditionals that would be challenging to properly script and test. But it's certainly possible.

Link to comment
Share on other sites

I scripted a few of my own scenarios in TOW2. It was only 3 or 4 pages of various script commands to learn. And the compiler that came with the game high lighted mistakes right away so it was pretty easy to get them to work. Yet the possibilities were almost limitless.

Triggers would be great on the simple side for setting victory conditions for ending the game. On the complex side having units actually search to contact and converge on large maps. I must say though that the integrated tac AI of the individual soldier in CM is better than any other game of this sort out there to date (Op Star holds its own too).

Link to comment
Share on other sites

Keep in mind that adding triggers while desirable will make creating AI plans more complex and by default they will take more time to test. So as others have mentioned before, triggers should be simple and used sparingly.

Imo having 2 or more basic AI plans increases re-playability as opposed to 1 single complex plan that once you've seen it, you pretty much know what to expect the next time you play.

Link to comment
Share on other sites

Except that a complex plan with a number of triggers might work out differently each time - you could trigger a different response to an attack on the left, right or centre, say, which would in effect be 3 different AI plans in one.

I'd have thought that attacking plans would certainly be more interesting - imagine if the AI could throw a second wave in when its casualties hit a certain point, rather than at pre-determined intervals.

Link to comment
Share on other sites

Anyone play Steelbeasts Pro PE? its a tank simulator that many armies uses as training tool.

It has a pretty advanced mission editor and trigger is the main point in it.

You can create random paths. for example you can give every unit 4 (or more if you like) different roads, and then add random variables so it takes any of those 4 roads and you can never know which it will take.

"move if/retreat if" - You can script the units behavior. for example:

-if this unit is under direct or/and indirect fire.

-if this unit see/do not see enemy unit, and you can specify that if its generic or in a certain zone. including if a condition is met or a trigger is pressed.

You can script it to move if certain unit gets bellow certain strenght, or move if in a zone blue or red force outweights eachother etc etc.

You can set up triggers that the user can trigger himself. for example a preplanned arty fire and you get several different arty plans, then you can give the player 4 triggers like "Arty triggerplan 1" etc. or triggers to execute an entire attack.

there is more options that I havent bothered listing, but here is a screenshot of the trigger command

trigger.jpg

So I know that triggers enhances the game by tons! :cool:

Link to comment
Share on other sites

Triggers atleast make the game more random given they can be randomised. As said, even simple triggergroups can make the game replayable and unpredistable.

Though best option would be very advanced AI that can think for himself and triggers be used for scenes when you deliberately need them to happen, but that needs exdtended and tedious developing of AI wich costs time. :D

Link to comment
Share on other sites

Sure. But from a technical standpoint, what you are talking about is still a group of IF... THEN conditionals. E.g.: Groups 1-3 are forward units Left, Right, Center, respectively, Group 4 is reserve

OK but I was thinking instead of turning this into a programing language (which BTW I actually would be OK with but that is just me). Keep it really really simple.

Currently each AI group has a single track of actions. I am suggesting that give each AI group two tracks and a trigger to choose which.

Group 1:

Set up in place on the left

Group2:

Setup in place in the centre

Trigger Group2 takes 80% casualties

A chain of AI actions (same as now) that move towards the left flank

Move

Move

Assault

etc.

Trigger Group 3 takes 80% casualties

A chain of AI actions (same as now) that move towards the right flank

Move

Move

Assault

etc

Group 3:

Setup in place on the right

Group 4:

Setup in reserve

Trigger Group 1 takes 10% casualties

A chain of AI actions (same as now) that moves to counter the attack on the left

Move

Move

Move

Move

Assault

Trigger Group 2 takes 10% casualties

A chain of AI actions (same as now) that moves to counter the attack in the centre

Move

Move

Move

Move

Assault

Trigger Group 3 takes 10% casualties

A chain of AI actions (same as now) that moves to counter the attack on the right

Move

Move

Move

Move

Assault

And as you can see just by my writing this down I see that you need multiple triggers for each AI group and you also need to decide if once one trigger happens do the other ones get ignored or might they trigger and override the units current plan.

Clearly this will take a large amount of effort to design correctly.

Link to comment
Share on other sites

Whether you realize it or not, and regardless of the syntax of the exact commands, what you are talking about is an application-specific, high-level programming language.

The details of how you express it can be whatever you like, but logically speaking, it's still IF... THEN conditionals and other logical expressions.

Link to comment
Share on other sites

Whether you realize it or not, and regardless of the syntax of the exact commands, what you are talking about is an application-specific, high-level programming language.

The details of how you express it can be whatever you like, but logically speaking, it's still IF... THEN conditionals and other logical expressions.

There are languages in place that can handle this quite nicely and they could be integrated into most any application. Python comes to mind and it has flavors that run on most any platform so it would work with both Mac and Windows. It can also be customized by BF to handle a very limited command set.

Link to comment
Share on other sites

Thanks for that example, Chainsaw. I was about to post something to the effect that if triggers are implemented, then it can't be done in a simplistic manner. For example, a trigger that reacts to a flanking maneuver can't just be fooled by a simple unit or two. The designer has to have the ability to set the trigger mechanisms in this case, something like X number of units seen will set the trigger off.

The Steelbeasts Pro trigger example is something like I had in mind, except tailored for CMx2 of course.

Link to comment
Share on other sites

There are languages in place that can handle this quite nicely and they could be integrated into most any application. Python comes to mind and it has flavors that run on most any platform so it would work with both Mac and Windows. It can also be customized by BF to handle a very limited command set.

Absolutely. Why reinvent the wheel?

Link to comment
Share on other sites

Whether you realize it or not, and regardless of the syntax of the exact commands, what you are talking about is an application-specific, high-level programming language.

Oh I realize that - I program for a living - so I get it.

There are languages in place that can handle this quite nicely and they could be integrated into most any application. Python comes to mind and it has flavors that run on most any platform so it would work with both Mac and Windows. It can also be customized by BF to handle a very limited command set.

And I would be thrilled and have a blast making the AI do cool stuff.

The thing we need to keep in mind is that the vast majority of people are not capable of (or more accurately not interested in) learning how to program. While we might want an open programming language for the AI, I am not sure it would fit the target audience here very well.

Right now we have a lot of people who can create an AI script that can perform reasonably well. There are enhancements that could be made to the existing AI scripting that could allow those same people to do even better. I personally think that some ability to trigger responses from the AI would go a large way towards that. I also think that to make sure that same group that are creating AI programs now keep creating AI programs, the game needs away to enhance what is there now not replace it with a amazingly flexible programming language.

IMHO

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...