Intelligent SAM Operator (LUA)

All discussions & material related to Command's Lua interface

Moderators: RoryAndersonCDT, michaelm75au, angster, MOD_Command

Post Reply
Zathred
Posts: 67
Joined: Thu Jul 05, 2018 9:17 am

Intelligent SAM Operator (LUA)

Post by Zathred »

Intelligent SAM Operator (LUA)

The attached example scenario uses LUA scripting to provide some basic AI for non-player SAM operators so they only use active radar when a contact is within missile range for example. The scripts can be extended to implement more complex rules such as using the individual contact details to determine what actions to take.

I’m not going to explain the implementation in detail in this post and leave the reader to look through the 3 events that control the action as you’ll need to extend the LUA for your own scenarios.

Example Scenario

In the test scenario we send a BLUE tanker into the RED air defence zone and watch an SA-12 SAM site operator react to the intrusion.

- Load the scenario in the Scenario Editor so you can see what’s going on behind the scenes.

- Enter as BLUE and pause the sim.

- Select the KC-135 tanker (Blue Hawk #1) and plot a course towards the SA-12 unit so that the tanker stops around 30 miles away from the SAM. Create a second leg that sends the tanker back to the original starting point.

- Switch to RED and select the SA-12 unit. Note that the radar is currently set as passive in the EMCON doctrine and the Sensors window shows the radar is inactive.

- Open the Editor->Event Editor-> Events window and note that there are 3 events but only 1 is currently active (“Activate Air Defence”).

- Note that there is an exclusion zone around the SA-12 site (“SA-12 Zone”). The Reference Points for this zone are also used in the LUA area check code and the Unit Enters Area event trigger.

- Unpause the SIM.

As the KC-135 enters the “SA-12 Zone” exclusion zone it is marked as Unfriendly by the zone rules. Shortly after the tanker enters the zone (up to 1min) you will see 3 separate Events firing in the message log window:

- “Activate Air Defence”: event fired by a unit entering the SA-12 zone using an event “unit enters area” trigger.

- “SA-12 Area Check”: timed regular event (1min) enabled by the “Activate Air Defence” event action which runs a LUA script.

- “SA-12 Range Check”: timed regular event (30sec) enabled by the “Activate Air Defence” event action which runs a LUA script.

At this point there are no other responses to the intruding tanker but behind the scenes the LUA AI SAM operator is checking whether any contacts are still in the exclusion zone (“SA-12 Area Check”) and whether any contacts are within the SA-12 missile engagement range (“SA-12 Range Check”). You will see these two events being regularly fired in the message log window (these messages can be disabled by editing the events and unticking the IsShown box).

Shortly after the tanker moves within 45nm of the SA-12 unit the “SA-12 Range Check” event action will switch the SA-12 radar to active mode. You will see the radar ring appear around the site and can confirm the active status for the Grill Pan FCR in the Sensors window.

Once the tanker turns around and leaves the SA-12 missile engagement range the “SA-12 Range Check” event action will switch the SA-12 radar back to passive mode.

Once the tanker leaves the SA-12 exclusion zone you will see the two timed “check” events are made inactive and are no longer fired.

This process repeats for any intrusions into the exclusion zone and the SA-12 MEZ. If at least one contact is inside the exclusion zone the checks will remain active. If at least one contact is inside the SA-12 MEZ then the Grill Pan FCR will be active. A contact can leave, be lost or destroyed and the outcome is the same in all cases.

Customisation

The Event Action LUA scripts for the Area and Range checks are the key components which can be extended to provide more complex logic based on the contact type and other attributes. For example:

- Bring up extra search radars when a contact is detected in the exclusion zone.

- If a contact is classified as a missile then assume it is an ARM and shutdown the FCR radars in order to prevent the SAM site being destroyed.

- Activate OECM units as well as radars (the test scenario has a Krasuha ELINT truck that can be used for this purpose).

- Change the SAM doctrine to TIGHT or FREE from HOLD based on the contact range to spring a close-range trap.

- Designate a contact as HOSTILE once inside the SAM engagement range.

- Activate an AAW intercept mission depending on the range, type and number of contacts, e.g. don’t launch if a missile-only attack is detected approaching the base, leave them to the SAMs.

If you want to cheat then you can access the data for the real unit associated with the contact although for realism you should only use the known contact data [:)]
Attachments
LUA SAM Ra..Ops Test.zip
(82.4 KiB) Downloaded 89 times
User avatar
1nutworld
Posts: 440
Joined: Sun Apr 13, 2014 12:34 pm

RE: Intelligent SAM Operator (LUA)

Post by 1nutworld »

That is very useful. Would come in very handy in a couple scenarios I have been playing.
USS Dwight D. Eisenhower (CVN-69) 1990-1994.
KnightHawk75
Posts: 1850
Joined: Thu Nov 15, 2018 7:24 pm

RE: Intelligent SAM Operator (LUA)

Post by KnightHawk75 »

Simply put, good stuff, thanks.
User avatar
SeaQueen
Posts: 1436
Joined: Sat Apr 14, 2007 4:20 am
Location: Washington D.C.

RE: Intelligent SAM Operator (LUA)

Post by SeaQueen »

Nice!
Post Reply

Return to “Lua Legion”