Space Engineers

Space Engineers

66 ratings
Guide for Diamond Dome Defense Script
By Alysius
Complete Setup and Usage Guide for Diamond Dome Defense Script:
https://steamhost.cn/steamcommunity_com/sharedfiles/filedetails/?id=1734964925
5
   
Award
Favorite
Favorited
Unfavorite
How To Setup

Setting up Diamond Dome Defense Script involves the following steps:
1 - Creating PDC Turret (Dual and Quad Arm is Supported. Modded Weapon is Supported).
2 - Mounting PDCs to Warship.
3 - Mounting Target Designators.
4 - Mounting Raycast Cameras.
5 - Adding Guided Missiles to Warship.
6 - Adding Manual Aimed Lock-On Missiles.
7 - Final Checks, Load Script and Add Radio Antenna.



1 - Creating PDC Turret

Each PDC Turret requires the following blocks:
  1. One Rotor or Hinge name tagged Azimuth.
  2. One Rotor or Hinge name tagged Elevation.
  3. Gatling Guns -or- Modded Weapons (see below for configuration required).
  4. (Optional) One Block name tagged Aiming. Use this as middle point reference only if your gatling guns are placed off center.
NOTE: After setting to desired Upper and Lower Limits, these limits will be saved to the rotor's Custom Data. If you want to change them, be sure to clear the rotor's Custom Data of these saved values for script to re-read the rotor limits and save them again.


If your PDC is not fully conveyored, include 2 Connectors name tagged Reload, one on Azimuth Base Subpart and one on Turreted Subpart.

Script does a Tilt-Lock-Reload Procedure to reload ammo.

Be sure to have another script or by hand to put ammo into the base connector on the azimuth rotor base subpart.

SKIP this if your PDC Turret is Fully Conveyored and does not require Tilt-Lock-Reload Procedure:

Dual And Quad Arm PDCs
DDS now supports PDCs with multiple arms. Just build the PDC with the extra arms as usual.

Modded Weapons Support
By default it detects Vanilla Gatling Guns and Rockets. To support Modded Weapons, refer to the Modded Weapons Support Section of this guide.


2 - Mounting PDCs To Warship

Group all PDC Turret Blocks under One Single Group named DDS Turrets:



3 - Mounting Target Designators

Mount AI Turrets to warship to act as Target Designators. Group them all under one single group named DDS Designators:
In Survival Mode, AI Turrets MUST HAVE at least 1 Ammo to work!



4 - Mounting Raycast Cameras

Create patches of Cameras and mount them on all 6 sides of your warship. Group them all under one single group named DDS Cameras:



5 - Adding Guided Missiles To Warship

You can only mount Guided Missiles piloted by Advanced Guided Missile Script found here:
https://steamhost.cn/steamcommunity_com/sharedfiles/filedetails/?id=1734970571
Build missile using the above link for the script and guide.

After mounting Guided Missiles, group ALL of the missile's Programmable Block under one single group named DDS Missiles:


There is another group of guided weaponry called Torpedo, which is for large guided missiles that are intended to be launched via manual trigger only (no auto launch by script). To include this type of missiles, group the Programmable Block of the Guided Torpedos under DDS Torpedos.


Note: If your Torpedo does not have an Antenna, you must put the name tag [CGE] in the name of the PB (note: must have the square brackets). This is to signal the use of cross grid reference to transmit initial lock-on information instead of the normal IGC method which requires Antenna.

Only manually launched Torpedos are allowed IGC waiver to use CGE. For automatic launch missiles, Antenna is mandatory for IGC to be used.


6 - Adding Manual Aimed Lock-On Missiles

Manually launched Guided Missiles can be fired from this script, and requires a different set of cameras to use for targeting and initial lock-on (i.e. aim at target until missile locks on).

Mount a few (1 to 5) forward facing Cameras (all cameras MUST face forward in the same direction intended for aiming). Group them all under one single group named DDS Aiming:



7 - Final Checks, Load Script and Add Antenna

Before you proceed, ensure no enemies are around as warship will fire immediately.

Load Diamond Dome Defense Script to a Programmable Block on your Warship, then check:


Ensure PDC Turrets, Designators, Raycast Cameras and Missiles are ALL detected properly.

Ensure you have a Radio Antenna, preferably 2000m and above, installed and turned on. Script needs it to relay initial target information to guided missiles.


Setup done! All DDS warships communicate and share target information with each other.


Notes About DDS:

1) Minimum target size for missile launch is 2 meters cross section.

2) One missile is launched for every 12 meters of extra cross section, every 10 seconds.

3) If enemy is in blind spot of the Raycast Cameras, script cannot determine target size and therefore no missiles will be launch (there is a minimum size for launch, to avoid launching expensive guided missiles against tiny debris).
How To Operate

DDS operates on its own. However, you can enter commands to control its behavior. Drag the DDS script's PB to Toolbar and choose Run action with Arguments entered based on operation:


See Script Commands Section for available commands.
Script Commands (1 / 1)
Below are the list of commands:

TOGGLE
Toggle DDS Enable and Disable. DDS will cease fire upon disabling. Any missile not achieved full active locked-on yet will be lost immediately.

ENABLE
Set DDS to Enable. DDS will resume operation.

DISABLE
Set DDS to Disable. DDS will cease fire upon disabling. Any missile not achieved full active locked-on yet will be lost immediately.

AUTOLAUNCH
Toggle automatic launching of missiles from "DDS Missiles" group if script determines a tracked target is eligible.

AUTOLAUNCH_ON
Enable automatic launching of missiles from "DDS Missiles" group if script determines a tracked target is eligible.

AUTOLAUNCH_OFF
Disable automatic launching of missiles from "DDS Missiles" group if script determines a tracked target is eligible.

FIRE
Fires one Guided Missile (in the "DDS Missiles" group) for manual lock-on using DDS Aiming blocks. Starts raycast tracking from "Forward" block if not already tracking.

Once target is locked, it is added to the main raycast tracking system. Script bypasses the max raycast range defined by "maxRaycastTrackingDistance" (default 3km), and instead uses the max range defined by "manualLaunchRaycastDistance" (default 5km).

FIRE:LARGEST
Fires one Guided Missile (in the "DDS Missiles" group) at the current Largest Target. Does nothing if no eligible targets found.

FIRE:EXTEND
Fires one Guided Missile (in the "DDS Missiles" group) for manual lock-on using DDS Aiming blocks. Once target is locked, it is added to the main raycast tracking system.

Script bypasses the max raycast range defined by "maxRaycastTrackingDistance" (default 3km), and instead uses "manualLaunchRaycastDistance" (default 5km).

On top of that, it also bypasses the max missile launch range defined by "maxMissileLaunchDistance" (default 2km), and instead uses "manualLaunchRaycastDistance" (default 5km).

Note: This usually results in script suddenly launching additional missiles at the target if target size is large (Since now it is a valid target and distance limits are extended).

FIRE:BIG
Fires one Guided Torpedo (in the "DDS Torpedos" group) for manual lock-on using DDS Aiming blocks.

Once target is locked, it is added to the main raycast tracking system. Script bypasses the max raycast range defined by "maxRaycastTrackingDistance" (default 3km), and instead uses the max range defined by "manualLaunchRaycastDistance" (default 5km).

FIRE:BIG:LARGEST
Fires one Guided Torpedo (in the "DDS Torpedos" group) at the current Largest Target. Does nothing if no eligible targets found.

FIRE:BIG:EXTEND
Fires one Guided Torpedo (in the "DDS Torpedos" group) for manual lock-on using DDS Aiming blocks. Once target is locked, it is added to the main raycast tracking system.

Script bypasses the max raycast range defined by "maxRaycastTrackingDistance" (default 3km), and instead uses "manualLaunchRaycastDistance" (default 5km).

On top of that, it also bypasses the max missile launch range defined by "maxMissileLaunchDistance" (default 2km), and instead uses "manualLaunchRaycastDistance" (default 5km).

Note: This usually results in script suddenly launching additional missiles at the target if target size is large (Since now it is a valid target and distance limits are extended).

Modded Weapons Support
By default it detects Vanilla Gatling Guns and Rockets. To support Modded Weapons, put in the following Custom Data configuration to the Azimuth Rotor of the PDC.

You will need to know the weapon projectile values and add in using the following template (copy, change values, and paste to the Custom Data):

[DDS] WeaponInitialSpeed=100 WeaponAcceleration=0 WeaponMaxSpeed=1000 WeaponMaxRange=1600 WeaponIsCappedSpeed=false

This is how it should look in game:


Note: Script restart required. Different PDCs can have different modded weapons (via above configuration), but ALL weapons on the same PDC must be the same.

Note: As DDS also saves rotor limits, you may see UpperLimit and LowerLimit values there. Just append the above 5 settings below it.

Custom Configuration (Page 1 / 3)
You can customize the behavior of this script via Custom Data of this script's Programmable Block. The configuration settings are to be added to the DDS section, like the example below:

Note: The configuration is using the INI file format. Above example shows the DDS section and where / how the settings are placed. The variables are non-case sensitive.

Legends:
  • "Per Tick" means in one update tick, which is 1÷60 second for normal 1.0 sim speed.
  • "Number of ticks" means number of the tick described above (i.e. 60 ticks per sec).
  • "Distance" are all in Metres unless specifically mentioned otherwise.
  • "Target Size" refers to target's AABB bounding box's diagonal size in Metres.
  • "Target Radius" refers to half of Target Size, in metres.
  • "IGC" means Intergrid Communications (send data to other ships via Antenna).

Below is the full list of settings available for configuration:

MainBlocksReloadTicks
Number of ticks between before DDS reloads the critical system blocks like DDS Turrets, DDS Designators etc. <Integer> (default: 600)

TargetTracksTransmitIntervalTicks
Number of ticks between each consolidation of all targets tracked by this script for IGC transmission. After consolidation, tracks are transmitted one target per tick to all other IGC listeners, until list is exhausted. <Integer> (default: 45)

ManualAimBroadcastDurationTicks
Number of ticks to send target information to manually launched missile for initial guidance before missile locks-on itself. If missile has not locked-on after this period, it will be lost. <Integer> (default: 3600)

ManualAimRaycastDistance
Distance in metres to attempt raycast from cameras in "DDS Aiming" group for target trcking (used for manually painting targets or guide manually launched missiles). <Number> (default: 5000)

ManualAimRaycastRefreshInterval
Raycasting interval in ticks for "DDS Aiming" tracking. <Integer> (default: 30)

MaxDesignatorUpdatesPerTick
Number of designators to read target information from per tick. This is solely for performance and throttling purposes. 0 means no limit, and all designators will be read from every tick. <Integer> (default: 1)

MaxPDCUpdatesPerTick
Maximum number of PDCs allowed for update per tick. This is solely for performance and throttling purposes. 0 means no limit, and script is allowed to update all PDCs in one tick if required. You can use an alternate mechanism called "minPDCRefreshRate" (see below) to control refresh rate instead of this (in this case, set this to 0). Reason for this alternative is in case you have many PDCs, effectiveness could be reduced if all are assigned targets to shoot (e.g. 60 PDCs and this set to one. If all shoots, each PDC only gets 1 update every second). <Integer> (default: 1)

MinPDCRefreshRate
Script will ensure each PDC gets updated X number of times per second, whereby X is this configured value (e.g. setting this to 15 means it updates PDC 15 times per second). This is used if you want throttling for performance purposes but does no want it to limit too much as to degrade PDC effectiveness which "maxPDCUpdatesPerTick" cannot provide (e.g. too many PDCs on grid with target assigned, resulting in very slow update rate). To use this setting, "maxPDCUpdatesPerTick" must be set to 0. <Integer> (default: 15)

UseDesignatorReset
Whether to trigger ResetTargetingToDefault command on the designator after reading target information, in hopes of it switching to a different target and not be locked to one (e.g. decoys etc). This mechanism is not as effective at the moment. <True/False> (default: true)

DesignatorResetInterval
Number of ticks between each operation of performing ResetTargetingToDefault on designators. <Integer> (default: 45)

UseRangeSweeper
Whether to Fiddle with the Range to force designator to re-target another target. This is done in hopes of it switching to a different target and not be locked to one (e.g. decoys etc) <True/False> (default: true)

RangeSweeperPerTick
Number of designators to perform range sweeper operations on per tick. <Integer> (default: 2)

RangeSweeperInterval
Number of ticks between each performing of the range sweeper operation. <Integer> (default: 3)

TargetFoundHoldTicks
Range sweeper only kicks in when there are targets found by at least one designator. It switches off after waiting a number of ticks specified by this value when all designators are cleared of targets. <Integer> (default: 60)

UsePDCSpray
Whether to allow PDC to perform spraying on different points of the target. <True/False> (default: true)

PDCSprayMinTargetSize
Minimum target size for PDC spraying to be triggered. <Number> (default: 12)

RandomOffsetProbeInterval
If using PDC spraying, script will perform additional raycast at this interval to probe for possible offset target points. <Integer> (default: 15)

MaxRaycastTrackingDistance
Distance in metres for DDS to automatically track raycast targets. <Number> (default: 3000)

RaycastTargetRefreshTicks
Number of ticks between each raycasting of a particular target. This is solely for performance and throttling purposes. 0 means no limit, however script will still throttle internally based on camera charges as raycast have a cooldown (2km per second per camera). <Integer> (default: 15)

RaycastGlobalRefreshTicks
Number of ticks between each raycasting of any targets (except manual launch raycast system since it uses a separate set of cameras). This is solely for performance and throttling purposes. 0 means no limit, however script will still throttle internally based on camera charges as raycast have a cooldown (2km per second per camera). <Integer> (default: 2)
Custom Configuration (Page 2 / 3)
PriorityMinRefreshTicks
Minimum number of ticks allowed between each operation of performing calculations to re-prioritize PDC and missile targets. This is solely for performance and throttling purposes. 0 means no limit. <Integer> (default: 15)

PriorityMaxRefreshTicks
General number of ticks between each operation of performing calculations to re-prioritize PDC and missile targets. This is solely for performance and throttling purposes. 0 means no limit. <Integer> (default: 90)

PriorityGlobalRefreshTicks
Number of ticks between each operation of target assignment to PDCs and missiles. This differs from the above in that the above 2 are for re-prioritization calculation and this value is for target assignment after re-prioritization is completed. This is solely for performance and throttling purposes. 0 means no limit. <Integer> (default: 2)

TargetSlippedTicks
Script marks target as intermittent (cannot confirm target is lost yet and still attempting tracking) if the target is not re-detected by designators or raycast with the number of ticks specified by this value. <Integer> (default: 15)

TargetLostTicks
Script marks target as lost if the target is not re-detected by designators or raycast with the number of ticks specified by this value. <Integer> (default: 60)

RaycastExtensionDistance
Distance in metres to extend raycast to targets. Target usually rotates in combat, causing raycast to fall short slightly from target point. This extension allows it to "cut through" to minimize this scenario. <Number> (default: 5)

MinTargetSizeEngage
Minimum size for script to maintain target. If target size is smaller than this, PDCs will stop engaging it. Note: When the designator first detects a target, it does not know the target size and will need the raycast system to detetmine. Therefore PDCs may shoot at it first and suddenly stops as the raycast is made and determined it as too small of a target. <Number> (default: 2)

MinTargetSizePriority
Minimum size of target in metres to consider it as priority target (raycast must have detected target properly for this to work; in raycast camera view and not in blind spots). <Number> (default: 4)

AutoMissileLaunch
Whether to automatically launch missiles from "DDS Missiles" group. <True/False> (default: true)

MissileMinTargetSize
Minimum size of target in metres for missile to be launched at it (raycast must have detected target properly for this to work; in raycast camera view and not in blind spots). <Number> (default: 12)

MissileCountPerSize
Number of missiles to be assigned to target and queued for firing per linear size. Example: If this is 36 and target is 120 metres, 4 missiles will be assigned and queued for launch against this target (120÷36=3.33 round up ~4). Note: This number will be reset after "missileReassignIntervalTicks" duration. (raycast must have detected target properly for this to work; in raycast camera view and not in blind spots). <Integer> (default: 36)

MaxMissileLaunchDistance
Maximum distance in metres of target from ship for missiles to be assigned to it for launch. <Number> (default: 2000)

MissileOffsetRadiusFactor
If missile is marked for offset targeting (home in on target other than its center), it will randomly select a point on a circle at the target. The size of the circle will be a ratio of Target Radius based on this value. Example: if Target Radius is 20 metres and this value is 0.7, the circle radius used for random hit spot calculation is 14 metres. <Number> (default: 0.5)

MissileOffsetProbability
Probability that a missile will be selected for offset targeting (0 = no offset, 1 = 100% use offset). <Number> (default: 0.75)

MissileStaggerWaitTicks
Number of ticks to stagger the missile launch. <Integer> (default: 60)

MissileReassignIntervalTicks
Number of ticks between each operation of assigning missiles to be queued for launch against a particular target <Integer> (default: 600)

MissilePBGridReloadTicks
Number of ticks between each operation of checking grid for fresh new missiles. <Integer> (default: 300)

MissileTransmitDurationTicks
Number of ticks to transmit initial lock-on target information to missiles. Missiles must lock-on with its on-board raycast cameras with this period. <Integer> (default: 600)

MissileTransmitIntervalTicks
Number of ticks between each operation of transmiting target information to missiles. This is for performance and throttling purposes. 0 means no wait time. <Integer> (default: 15)

MissileLaunchSpeedLimit
Speed limit in m/s before attempting to launch missiles. This is to avoid collision with own ship. <Number> (default: 60)

PDCFireDotLimit
Dot product deviation before PDC starts firing. This equates to PDC starts firing when it is within about 5.732 degrees away from intended aim point. When engaging large targets (after raycast detected its size), the angle allowance is increased internally. <Number> (default: 0.995)

RotorUseLimitSnap
If True, script will utilize the power of Clang by using rotor limit snapping (extremely fast PDC aiming at the cost of more Clang). If False, script uses Predictive Controller on PDC rotors for aiming. <True/False> (default: false)

RotorCtrlDeltaGain
Script tracks predicted angle changes. This value sets the factor of the new value when adding to the prediction pool. Warning: Value can only be between 0.01 to 2.0, else script produces unexpected behavior. <Number> (default: 1)

ReloadCheckTicks
Number of ticks between each operation of checking if PDC needs reloading. This is only if PDC is setup to perform a tilt lock reload for non-conveyored PDCs. <Integer> (default: 90)

ReloadedCooldownTicks
Number of ticks between each reloading operation. <Integer> (default: 300)

ReloadMaxAngle
Angle in degrees to tilt elevation rotor to align connectors. Connectors won't be ready for locking (yellow) at this point, it only sets the stage for the "reloadLockStateAngle" to work. <Number> (default: 88)

ReloadLockStateAngle
Angle in degrees to tilt elevation rotor after "reloadMaxAngle" is achieved, to trigger the connectors ready for locking state. <Number> (default: 79)

DisplaysRefreshInterval
Interval in ticks for refreshing LCD panels. <Integer> (default: 30)

AllyTrackLostTicks
Numbeer of ticks to hold Ally tracks before next update must be sent to maintain tracking. <Integer> (default: 120)

Custom Configuration (Page 3 / 3)
CheckSelfOcclusion
Whether to perform collision checks to ensure PDC does not shoot own ship. <True/False> (default: true)

UseAABBOcclusionChecker
Whether to use AABBTree for occlusion checking. Default it is false and therefore uses marching line of CubeExists checks, as opposed to running CubeExists on entire ship blocks and compiling an AABBTree. <True/False> (default: false)

OcclusionExtraClearance
Extra clearance in metres for all ship blocks when calculating self occlusion. <Number> (default: 0)

UseFourPointOcclusion
Force Occlusion Checker to check all four corners of the group of gatling guns, instead of just from the center.

By default the occlusion check is traced from center of the group of gatling guns. If the gatling guns are space wide apart, the occlusion may not stop guns from firing since center may have a clear shot but the gatling guns on the corners are actually hitting own ship.

This setting allows it to have tighter checks by checking all 4 corners instead of only from center. <True/False> (default: false)

OcclusionCheckerInitBlockLimit
Block limit for each tick when scanning through all ship blocks to compile the occlusion checker system. 0 means no limit, all blocks will be processed at one goal. This is solely to avoid hitting "Script too complex" error. <Integer> (default: 500)

62 Comments
Miracler 18 Nov, 2023 @ 12:30pm 
Sorry for asking, but do I need the Designator and Cameras for the PDC´s?
bsimp14 5 Oct, 2023 @ 12:18am 
dose this work with WC?
FreezingPanzer 19 Jul, 2023 @ 6:23pm 
i have the same problem where the missile wont launch a targets beyond 800 meters(max range of gatlin turret). is there a way that makes the missile fire distance longer than 800 meters? i know there is custom configuration, but i dont think its working
CRAM the indifferent 25 Sep, 2022 @ 12:24pm 
can this thing not target anything outside 800m or am i missing smth?
Lord Rapineur 18 Jan, 2022 @ 4:58am 
Hello , i have 12 turret on my ship , but the prog don't see them .
I used the same turret on another ship and the prog saw them .
I have recompil and remove the prog , he still not see them
ItsJustVirgil 16 Aug, 2021 @ 11:09pm 
Theoretically, the turrets would still work without guns, right? Like as long as I link it to a designator, it'll aim at that area?

I was thinking about spotlight turrets, and got curious.
Korban Dallas 31 Jul, 2021 @ 5:32am 
For those who have trouble with long distance manual locking. Try grouping your "DDS Aiming" cameras as "DDS Cameras" as well. Worked for me and can now shoot guided missiles 10km+ away
Nimkaru 12 Jun, 2021 @ 6:20am 
hi Alysius, is weaponcore support available (eighter direct or via Script from Sigmund Froid)? Or can it be made working with the custom data config for modded weapons?
Tactical Femboy 16 May, 2021 @ 9:33am 
I've somehow made them fire, are they supposed to spazz out when targeting and only burst fire?
Tactical Femboy 16 May, 2021 @ 1:11am 
I didn't add the raycast cameras and stuff because I don't use missiles, is that why my PDCs arent aquiring and firing? the interior turrets are set up as designators