Campaign Series Event Engine in Vietnam 1.0: Scenario Design

Welcome to our final issue of articles discussing CSEE prior to our release of CS: Vietnam 1948-1967.

In part one, we discussed events in general. In part two, we then continued on how to access Adaptive AI parameter database dynamically, in the middle of a scenario.

Today, it is time to talk about scenario design with CSEE.

Warning: playing the war in Vietnam against what often is quite an asymmetrical enemy will be different. Managing to occupy a nice little rice paddy with an objective flag on top of it might not actually accomplish much. Instead, one needs to stay alert to events taking place during game play, often thinking of objectives beyond what mission briefings told you.

I will use a Vietnamese Civil War scenario covering Operation Chopper to walk you through some of the tools available for scenario design with Vietnam 1.0. NOTE: To be made available in a future Middle East 3.0 UPDATE as well.

 

Operation Chopper, 12 January 1962

Here’s the scenario briefing, much the same as they ever were. Historical. To the point. Worth a read, absolutely.

Campaign Series Vietnam Vietnamese Civil War

So, ARVN vs Viet Cong from the era of Vietnamese Civil War, before the US involvement, right?

Wrong:

Operation Chopper ready to commence!

Just look at that: US military advisors, transport helicopters, air recon assets such as Birddog, light recon helicopters too!

And it is 1962, so how come the US public does not know about this!

WIth scenario setting as such, let us look at our Mission Briefing first. Mission Briefings are automatically shown on Turn 1 for both sides, each with their specific briefing. They can also be accessed later via the game menu. Typically, you end up studying them several times when playing a scenario for the first time.

Here is the ARVN player briefing for Operation Chopper:

Battle of Houng Viet Con

SITUATION: ARVN forces are to root out any Viet Cong west of Saigon. This is the first time that American helicopters will be assigned for such an operation!

Friendly Forces: The 3rd and 5th Parachute Battalions are available for this mission.

Enemy Forces: A VC unit of unknown size is likely defending the area.

MISSION: Your Primary Mission is to airmobile assault into the banana groves west of Saigon. Search and destroy any Viet Cong in the vicinity.

Your Secondary Mission is to seize any supplies or headquarters discovered there.

EXECUTION: Use the American helicopters to perform airmobile assaults in the area of operations. Once the landing zones are secured, search the entire area.

NOTE: It is essential to keep the losses of American helicopters to a minimum, as the press is watching!

POLITICAL: You lose Event Points for indirect firing or ordering airstrikes on inhabited hexes (village, city, suburb), whether or not occupied by the enemy.

ADMIN: The supply levels are high at the beginning of the scenario, but expect them to taper off as the operation proceeds.

COMMAND AND CONTROL: Weather during the day will be mostly clear with visibility lightly varying as the operation unfolds.

In CS: Vietnam it is vital you consider your brief in detail.

What was said? What was perhaps not said? Were there hints and tips that perhaps looked a bit out of place, or stood out?

Let us now look at how CSEE brings a whole new ballgame to scenario designers toolbox.

 

Victory Conditions

Operation Chopper has its Victory Conditions set as:

  • < -300 points as Major Loss,
  • < 0 points as Minor Loss,
  • < 300 points as Draw,
  • < 600 points as Minor Win, and
  • 600+ points as Major Victory.

There must be some juicy objectives out there, then;

Campaign Series Vietnam Vietnamese Civil War

One victory point Objectives – What gives?

Let us look at our briefing again, especially:

MISSION: Your Primary Mission is to airmobile assault into the banana groves west of Saigon. Search and destroy any Viet Cong in the vicinity.

Your Secondary Mission is to seize any supplies or headquarters discovered there.

This being CS: Vietnam, perhaps do not worry about capturing a single Objective, maybe it is about capturing them all, securing the area, and being rewarded a hefty Event Points award for that?

So it is.

Let us look at CSEE Lua code that deals with Objectives:

function on_objective_capture (hc, value, values, side) — DO NOT REMOVE

if (hc == OBJECTIVES[3]) and (side == SIDE_A) and not OBJECTIVES_3_SIDE_A_CAPTURED then
    inc_event_points(SIDE_A, 25)
    note(“Notice”, “For capturing OBJECTIVES[3], the ARVN gain 25 EPs.”)
    OBJECTIVES_3_SIDE_A_CAPTURED = true
end

Indeed some of those objectives, third one on objectives list in this case, are worth more than the others. Just that you don’t know which ones. And there’s more…

if owned(NW_ZONE, ARVN_SIDE) and not NW_ZONE_SIDE_A_OWNED then — one time only EP award
    inc_event_points(ARVN_SIDE, 100)
    note(“Notice”, “For capturing and holding the VC NW objectives zone, the ARVN side gains 100 EPs.”, ARVN_SIDE, ARVN_SIDE)
    NW_ZONE_SIDE_A_OWNED = true
end

The map here is divided into areas, and once you are able to secure all the objectives there, there’s an extra reward! Be certain that there are similar bonuses for Viet Cong side for preventing you to do that, though…

Lesson learnt: Objectives are often not what they first appear in CS: Vietnam

 

Negative points are a new normal, too

This would not be Vietnam if things were this rosy, right. Any hints for disasters looming out there? Let us look at the Mission Briefing again.

How about this line here:

EXECUTION: Use the American helicopters to perform airmobile assaults in the area of operations. Once the landing zones are secured, search the entire area.

NOTE: It is essential to keep the losses of American helicopters to a minimum, as the press is watching!

Essential to not have any US casualties here? Hints and tips don’t often come as clear as day in CS: Vietnam.

Looking at CH-21 Shawnee stats with Unit Handbook, it is clear these are important assets. A squadron of four CH-21s, each worth 10 points, for a total of 40 points! Now that would be a painful loss indeed.

It does not stop there though, in this scenario, nor in many others, in different ways. In this particular scenario US losses are simply not allowed. It is 1962. remember.

Let us look at CSEE Lua code when unit takes a hit:

function on_unit_reduce (hc, trackid, pid, name, side, nation, oid, orgname, points, strength, HQ, Leader, loss, combat) — DO NOT REMOVE

    if member(trackid, _57TH_UTILITY_TRANSPORTATION_COY_61_CH21_75) then
        inc_event_points(SIDE_B, 50*loss)
        note(“Notice”, “For inflicting casualties on the US 57th Utility Transportation Coy, the VC gain ” .. 50*loss .. ” EPs.”)
    end

end

For each individual transport lost, in addition to 10 point loss per unit data, there’s an additional 50 Event Points given to Viet Cong side. Remember those landing zones? You better hope, or ensure even, they are secure. One ambush, wiping out one squadron, that is 4 * 10 unit points and 4 * 50 event points lost. -240 points lost at one Landing zone disaster. And the units being transported are lost too, they add up too.

Oh, there was this too (and other little things as well, I don’t want to completely spoil this neat little scenario!):

POLITICAL: You lose Event Points for indirect firing or ordering airstrikes on inhabited hexes (village, city, suburb), whether or not occupied by the enemy.

Compare to this code snippet in scenario CSEE Lua file:

function on_hex_attack (hc, side, nation, attype) — DO NOT REMOVE

— lose EPs for indirect fire or airstrike vs. inhabited hex (village, city, suburb), whether or not occupied by the enemy
— side is the firing side
if — is_building_hex(hc) or is_habitat_hex(hc) then
    if not_occupied(hc, other_side(side)) then
        if attype == INDIRECTFIRE_COMBAT then
            inc_event_points(side, -2)
        elseif attype == AIRSTRIKE_COMBAT then
            inc_event_points(side, -5)
        end
    else — occupied
        if attype == INDIRECTFIRE_COMBAT then
            inc_event_points(side, -1)
        elseif attype == AIRSTRIKE_COMBAT then
            inc_event_points(side, -2)
        end
    end
end

end

Tut tut! And, loss of points, too! And, maybe, not every scenario will be this lenient towards you?

Sh*t will happen in CS: Vietnam. As it maybe should. This is Vietnam War, after all.

 

Replayability

MISSION: Your Primary Mission is to airmobile assault into the banana groves west of Saigon. Search and destroy any Viet Cong in the vicinity.

Your Secondary Mission is to seize any supplies or headquarters discovered there.

Holding ground will not be enough, I need to have boots on ground looking for Viet Cong assets as well. But once I have located them the scenario will become so much easier to play. CSEE to rescue.

I can quickly think of two ways having a Headquarters be as elusive as possible.

  • One is to have it move around. With CSEE, it is possible to keep track off spotted enemy units, to move towards them, or in this case: to try to avoid them.
  • Another option to handle this is to have a unit or a formation to appear randomly as you can control both the hex coordinate where the reinforcement is to arrive, and the turn it does arrive.

No two games of same scenario will be alike. Replayability.

As a scenario designer, don’t just think at tactical level though. An often repeated neat trick for replayability factor is to first have a few operation plans available for the AI side, then randomly pick one, per a die roll, upon start.

 

Conclusion

I hope we have managed to brief not only how to use CSEE in scenario design, but also how to approach CS: Vietnam game as well.

It will be quite a different experience to previous scenarios and situations within the Campaign Series. The enemy will often prove to be a cunning and devious opponent, and at times, one slip or mishap might lose a battle. Try, try again, as sometimes there just aren’t enough leeway to recover within the duration of scenario play per turns and objectives, event points, available.

How was my Operation Chopper, then? Quite a disaster at first go. I lost too many transports in particular, in just two incidents during the whole of 25 turns. I was not being careless either, just that sh*t happened, twice even. No way back for me.

But it was fun. Let me try it one more time… that will teach them!

Campaign Series Vietnam Vietnamese Civil War

Note the US casualties here – just unacceptable. Also note the orange circle: this scenario will be decided upon events that take place during the battle. Kill ratio and the points earned there, nor the Objective points held won’t decide the winner here.

So will it be in many of the CS: Vietnam scenarios. We hope you will find them refreshing in as how many of the battles were decided in other games from the series. If you find an interesting scenario “unwinnable”, maybe: try, try again.

Thank you for reading this far. Until next time!

 

 

 

Campaign Series Event Engine in Vietnam 1.0: Accessing Adaptive AI

Welcome to the second Developer Diary on how to use CS Event Engine in Vietnam 1.0. In the first part we talked about the latest CSEE version in CS Vietnam 1.0, now let us have a look how the new CSEE Lua library interacts with another Campaign Series gem: the Adaptive AI database.

Note: This is meant as an introductory blog about the coming features. There will be a complete CS Event Engine manual shipping out together with the game install. 

Adaptive AI in a nutshell

Adaptive AI became available as of Campaign Series: Middle East 2.0. Here’s what our Lead programmer Berto wrote at the time, emphasis mine:

The Campaign Series AI — One size does not fit all!

Arabs did not fight the same way as Israelis. Jordanians outclassed the Egyptians, who outclassed the Syrians. Israel’s combat doctrines changed from 1948 to 1956 to 1967 to 1973 and beyond. The cocky Israelis at the beginning of the Yom Kippur War learned to give their revitalized Egyptian foes newfound respect and learned to change their ways. Adapt or die.

From nation to nation, from war to war, from year to year, even from one battle to the next — they all differed, so much evolved. But in the traditional Campaign Series, as in most (all?) war games, there is one and only one AI. Locked down tight. Mostly inaccessible to the scenario designer, much less to the player. Until now…

We have devised a new customizable AI System. Customizable by side, by nation, by scenario. Open to the scenario designer’s tweaking. Also to modder’s. We call this new system: “Adaptive AI.” As in: An AI that adapts to the side, the nation, the era, the individual scenario. (Not as in: Adapts real-time to changing game play circumstances. But that too will be implemented in future updates.)

The purposes of the Adaptive AI are:

  • To coach the AI in ways and things it is too dumb to figure out by itself.
  • To achieve game play “balance”.
  • Not so much to improve the AI play as to better simulate actual combatant and scenario conditions.
  • To achieve greater “realism” and “historical fidelity”.
  • To add randomness.
  • Thereby increasing replayability.

These cross purposes are often at odds with one another. Some Adaptive AI parameters will make the AI opponent “better”; others will make it “worse”. It all depends. Some players will like the increased uncertainty; others will not. It all depends. That’s why the Adaptive AI is optional. Select it or not as you wish.

Looking back at Adaptive AI: yes, it was static, required creating and adjusting scenario specific *.ai files, but at the same time: it truly opened the game parameter database for the scenario designers. If only it would have been easier to use…

Adaptive AI in Vietnam 1.0

Fast forward to CS: Vietnam 1.0, and the Adaptive Ai database itself got a thorough upgrade for Vietnam 1.0. At the time of writing this there’s a template file now with a slot for 200 adaptive AI parameters. So many new aspects the scenario designer can adjust on a per-scenario basis!

Campaign Series Vietnam Adaptive AI

But what is completely new is the ability to access these parameters as the scenario plays on – from the CSEE Lua code, dynamically throughout the scenario play!

Now, the AI truly adapts itself as how the events take place during the play if the scenario designer so chooses. Have all the SAI controlled troops change their stance from a rear-guard action with Opportunity Fire set at sniping at long ranges to Ambush stance, where they only fire when they see the white of the eyes of their opponent! How cool is that!

Accessing AI parameters from CSEE Lua code

As a recap, here’s how the Adaptive AI was used with CS Middle East 2.0. See below for an example of how it worked at the time: first create a scenario specific *.ai file from the template, then tweak the parameters you want to change.

Here’s how some changes to Opportunity fire settings were made with CS: Middle East 2.0. A bit crude perhaps, but it got the job done:

Campaign Series Middle East Adaptive AI

So, what happens there, exactly? Here’s what the Sirte scenario specific AI file sets to play it out:

  • opfire_sam2_helo_prob defines the likelihood Opportunity Fire kicks on against an aerial target. Think of this as SAM Radar noticing the target, and giving the firing co-ordinates to SAM batteries
  • opfire_sam2_helolow_prob and opfire_sam2_helohigh_prob then define the likelihood the individual SAM battery being able to lock on to target, and to launch their missiles against the target.

In CS Vietnam 1.0, you can set those values you want changes within the scenario specific Lua file.

Here’s an example of how you set up Opportunity Fire values per generic level. This snippet shows just the part for setting Op Fire for all your armored units:

Campaign Series Vietnam CSEE Adaptive AI

Let us look at available CSEE functions in detail. There’s one for setting a value anew and another one for increasing or decreasing the existing value per the parameter provided:

  • set_adaptive_ai (side, nation, index, value)
  • inc_adaptive_ai (side, nation, index, increment)

Here are the parameters, explained:

  • side — “a”, “b”, or some function or expression evaluating to either of those side values
  • nation — integer, or some function or expression evaluating to an integer; from 0 to 99
  • index — integer, or some function or expression evaluating to an integer; from 0 to max Adaptive AI parameter #
  • value — integer, -1 or greater
  • increment — integer; 0, positive or negative

Let us then look at the first call from the code example:

  • set_adaptive_ai (“nil”, FRENCH_NATION, 30, OP_MEDIUM)

And here’s what the parameters mean:

  • “nil” – most AI parameters are set either per nation, or per side. Opportunity fire is per Nation, so side is not provided, ie. nil.
  • FRENCH_NATION – there’s just two values for side, side “a” or side “b”. FRENCH_NATION is a variable with a value of “a”, used as a mnemonic and for ease of use. One could simply say “a” here as well.
  • 30 – this is the Adaptive AI parameter index. 30 is for tanks firing at hard targets, 31 is for tanks firing at soft targets, etc. Parameters are explained in the manual, and in the Init-ai database file for baseline values.
  • OP_MEDIUM – this is a mnemonic for a number value for medium range, ie. 2.

… and that’s all there is to access any of the circa 200 Adaptive AI parameters via CSEE Lua code, at any time, for any reason.

Here’s another example, this time from the CS: Middle East 3.0 early BETA. This is actually an equivalent of what was shown above per how these parameters were accessed via the *.ai files. This time, totally dynamic, with an ability to set and change these values per how the scenario play ebbs and flows.

Campaign Series Vietnam CSEE Adaptive AI

To quote Berto again: Totally dynamic, no time restrictions whatsoever.

Thank you for reading this far!

In part 3 of the CSEE Developer Diary we will ber talking about how to program the computer opponent, or Scripted AI (SAI), to have a keen operational sense, in addition to how legacy AI handles the tactical situations.

Stay tuned!