Space Engineers

Space Engineers

[Obsolete] Bumblebee Script
Alysius  [developer] Oct 10, 2015 @ 12:23pm
Bumblebee Script Documentation
Script to control your disposable drone swarm. Currently is experimental and does not have collision detection built-in. This script is meant to control cheap and disposable fast moving drones for disruption and sensor detection purposes.

This is a vanilla script. No mods are required.

Note: Script is highly experimental with no collision detection yet. Many navigation and coverage issues are yet to be resolved. One script controls one drone and one drone only.


Key Uses

This script is designed purely to do 2 things:

1) Control a swarm of fast moving cheap drones to distupt and confusing enemy AI turrets by flying erratically around them and turning decoys on and off.
2) Transport the Sensor to be used by Ansible Dispatcher Script, for detecting a large group of enemy ships.


Dispatch Mode

Dispatch mode is used for multiple bumblebee configuration. Bumblebee will listen on a Dispatch Text Panel (default CMD) for the name of the actual Text Panel containing the orbit coordinates. This allows selection of different orbit points (coordinates in different Text Panel).

Typically the same bumblebee will be duplicated using projector blueprints or copy and paste. This results in the same script and same set of names which confuses the script. Dispatch mode solves this by separating the bumblebee from ship grid using the closest merge block or rotor detach with respect to the programmable block, before initializing the reference blocks.


Notes

- If Drift Function is used and your vectorPointMid is far off from center of mass, use "midToCenterOfMassDist" to compensate. See below or screenshot for more information.


Required Setup

- A reference block named V_MID in the middle.
- A reference block named V_FRONT in front of V_MID.
- A reference block named V_TOP on top of V_MID. Latest update: If left blank, it will randomly select a top point.
- At least one gyroscope on the ship. You can save it under group named GYROS if you want script to use specific set of gyroscopes, otherwise group its optional.
- At least one thruster facing backward relative to the ship. If no such thrusters are found, script will not activate any thrusters. Manual activation will be required in this case.
- A Text Panel named CMD for inputing targeting command.
- (Optional) A sensor named LSENSOR. This sensor is used to detect ships to orbit. Initially a fixed point is chosen to orbit. When the sensor detects a ship, it switches to that ship instead.
- (Optional) A remote control named LREMOTE. This remote control is used for additional target finding via the built-in GetFreeDestination function.
- (Optional) A decoy named DECOYS or a set of decoys with group named DECOYS. This decoy will be turned on and off randomly.


Additional Setup For Dispatch Mode

- A set of Targeting Text Panels with unique names of your choice, for input targeting command. The original CMD Text Panel's Public Title will instead be used to select the required target by inputting one of the Targeting Text Panel's name.
- A group of Merge Blocks, Rotors or Advanced Rotors named DISPATCH. This group can be a mix and match of Merge Blocks, Rotors or Advanced Rotors. When the bumblebee received targeting command from the specified Targeting Text Panel, it will separate itself from the ship grid using the Merge Block, Rotor or Advanced Rotor within the DISPATCH group that is the closest to the programmable block running this script.

Dispatch Mode Bumblebee Scattering On Launch

As multiple bumblebee can be launched using this mode, there is a high chance of collision within the bumblebees. You can use random launch delays to stagger the launch. There are 2 types of random stagger:

[RSL:<Min>:<Max>]

The bumblebee will launch and travel straight ahead for a time period before turning towards target. A random amount of time is selected from "Min" to "Max". The values are specified in seconds.

[RSD:<Min>:<Max>]

The bumblebee will stay attached and not move for a time period before launching. A random amount of time is selected from "Min" to "Max". The values are specified in seconds.


Orbiting Procedures

Enter target point to orbit into the CMD Text Panel's Public Title field (If Dispatch Mode is used, this should be the Targeting Text Panel). The format is:

[T:<X>:<Y>:<Z>]

Where X, Y and Z is the coordinate to orbit. You can set the script to randomly choose a distance to orbit between a specified minimum and maximum distance in metres using:

[T:<X>:<Y>:<Z>:<Min Dist>:<Max Dist>]

Note that the distance is not guaranteed.

If a sensor is specified using strGridSensor, the bumblebee will orbit the sensor detected ship as soon as the sensor detects it (provided the ship fulfils the minimum size requirement and distance away from origin). The bumblebee will randomly decides to switch to a newly detected ship.


Sensor Detection For Orbiting Ship

You can specify a sensor using strGridSensor to use for detecting ships to orbit. Script will initially start by orbiting a fixed location, then switch to orbit the ship when sensor detects them. Script will constantly evaluate new ships to orbit to maximise randomness.


Unique Command Locking

If you specify a number in front of the command:

100[T:10:10:10]

The script will only read the command once until the number "100" is changed to a different number.
To allow the script to read the next command again, you will specify 101[T:10:10:10] and so on.


Demo Worlds And Other Links

The following demonstration world and blueprint uses the Bumblebee Script:
http://steamcommunity.com/sharedfiles/filedetails/?id=533481166
http://steamcommunity.com/sharedfiles/filedetails/?id=533479304

See video attached for the script in action.


Special Settings

boolDrift - Can be set to true to force over-steering. This is used to compensate for the lack of side thrusters, if your bumblebee design is as such. (def: true)
boolDispatchMode - Can be set to true to enable dispatch mode. (def: true)
driftVectorReduction - For Drift mode only. Larger value results in smaller drift, smaller value results in more aggressive drifting. Do not reduce to less than 1. (def: 1.5)
approachSpeedLimit - Speed limit when bumblebee approaches a target point. Zero means no limit. Note: speed limit is not guaranteed. (def: 0)
defaultLaunchSeconds - The default launch time in seconds if not specified when entering command. (def: 1)
defaultMinSensorGridSize - When sensor detects a ship, the ship's diagonal size must be larger than this value in metres. (def: 25)
defaultMaxSensorDistFromOrigin - When sensor detects a ship, the ship must not be more than this distance in metres away from the last set orbit point using [T:<X>:<Y>:<Z>] command. (def: 1000)
orbitSensorGridMinDist - When sensor detects a ship to orbit, it selects a random point on the bounding cylinder of the ship. This value adds an additional distance in metres away from the ship. (def: 50)
useDampenerBraking - Use dampener for faster braking when ship is facing a reverse direction. (def: true)
oneTimeCommand - Dispatch Mode only. The one time command to be injected during dispatch mode initialization. Must start and end with square brackets "[" and "]".


Runtime Parameters

List of values (Set via Public Title of command Text Panel. All values are case sensitive):

[<CMD1>:<PARAMS1>,<CMD2>:<PARAMS2>,<CMD3>:<PARAMS3>]

All the possible CMD is listed below:

1) T (e.g. [T:10:20:30], [T:10:20:30:100:120])
> [Decimal:Decimal:Decimal] = The target point to orbit around.
> [Decimal:Decimal:Decimal:Decimal] = The first 3 number forms the target point to orbit around. The 4th number is the distance from the point that it will try to orbit. Note: Distance is not guaranteed.
> [Decimal:Decimal:Decimal:Decimal:Decimal] = The first 3 number forms the target point to orbit around. The distance to orbit is randomly selected between the 4th and 5th number specified. Note: Distance is not guaranteed.

2) H (e.g. [H:10:20])
> [Decimal] = Decoy will toggle on and off for the specifed time in seconds.
> [Decimal:Decimal] = Decoy will toggle on and off with a random time chosen between the 2 values specified, in seconds.

3) L (e.g. [L:3])
> [Decimal] = Idle for the specified seconds before making first move. This is for bumblebee to clear the launch pad.

4) D (e.g. [D:TRUE])
> [TRUE,FALSE] = Whether bumblebee should drift to compensate for the lack of side thrusters.

5) OI (e.g. [OI:5])
> [Decimal] = Set the time interval in seconds for switching to the next randomly selected position.

6) OS (e.g. [OS:50])
> [Decimal] = Set the speed limit. Note: Speed limit not guaranteed.

7) SG (e.g. [SG:10])
> [Decimal] = Set the minimum grid size in metres for switching to the sensor detected grid.

8) SO (e.g. [SO:1000])
[Decimal] = Set the maximum distance in metres away from the origin point set in [T:<X>,<Y>,<Z>] to consider whether to orbit any sensor detected grid.

9) SD (e.g. [SD:50])
> [Decimal] = Set the minimum distance in metres away from the bounding cylinder for sensor detected grids, when evaluating new random point to fly to.

10) SU (e.g. [SU])
> Reset the sensor detected grid information and go back to orbit last [T:<X>,<Y>,<Z>] input to script.

11) RSL (e.g. [RSL:1:5])
> [Decimal:Decimal] = The bumblebee will launch and travel straight ahead for a time period before turning towards target. A random amount of time is selected from "Min" to "Max". The values are specified in seconds.

12) RSD (e.g. [RSD:1:5])
> [Decimal:Decimal] = The bumblebee will stay attached and not move for a time period before launching. A random amount of time is selected from "Min" to "Max". The values are specified in seconds.

13) ACTB (e.g. [ACTB:Warhead:Detonate])
> [BlockName:ActionName] Triggers the specified action on the block.

14) ACTG (e.g. [ACTG:THRUSTERS:OnOff_Off])
> [GroupName:ActionName] Triggers the specified action for all blocks in the group.

15) SPIN (e.g. [SPIN:30])
> (Optional) [Integer] Spins the bumblebee by the RPM specified. If no RPM specified, it will spin at maximum speed.

16) CUT (e.g. [CUT])
> Blocks the script from receiving any further commands. Script will continue to operate based on last command received.

17) WEAP (e.g. [WEAP:TRUE])
> [TRUE,FALSE] If configured, whether to allow weapons to be fired.

18) TERM (e.g. [TERM])
> Instantly terminates the bumblebee script. Bumblebee will drift through space according to the last momentum.
Last edited by Alysius; Oct 17, 2015 @ 12:16pm