Space Engineers

Space Engineers

[SCAM] Simple Concurrent Adaptive Min3r
 This topic has been pinned, so it's probably important
cheerkin  [developer] May 5, 2022 @ 4:21am
Set-up guide
Quickstart
Watch the quickstart video guide (first one).
https://www.youtube.com/watch?v=n0Cbl-Pv-Qc

Take a look at this world upload with all three drones and dispatcher ready.

Dispatcher (base)
Prepare the carrier. This can be either mobile rover/carrier or station.
  1. Build PB, antenna, power source
  2. Build connectors that face upwards (drones would descend and dock using their bottom connector). Connectors should contain "docka-min3r" in their names (this tag can be changed on the top of the code).
  3. Get Dispatcher boot command batch from the main page and place it into PBs' Custom Data.
  4. Get the code into the PB editor, recompile.
  5. Optional: build two Wide LCDs and put their names into the add-panel and add-logger CustomData lines. Alternatively, name those screens so they have "scam-log-panel" and "scam-gui-panel" in their names
  6. Optional: build control seat in front of your "scam-gui-panel" and name it to match the "command:add-gui-controller:scam-controller" line.

Agents (drones)
  1. Get the min3r of choice or build your own (guide on how actually to would be added later).
  2. UPDATE the code in the drones' PB, make sure Dispatcher and all Agents run the same version. I re-upload blueprints far less often that the SCAM script itself (this workshop item).
  3. Check the Agent boot command batch from this page. It may be more up-to-date than the one inside.

After you have Dispatcher and Agents up, make sure they are linked together. Agent PB should show DispatcherID in it, and Dispatcher PB should list all active Agents (subordinates).

I recommend starting with a command:create-task from an Agent. Fly it manually to the point of mining, place it above with some spare altitude (not lower than terrain slopes around you). If you are on planet, running command:create-task would start a mining task centered on that point, and shafts would be aligned with gravity (exactly downwards). If you are in space, then the Agent orientation would determine that mining direction, so align it accordingly. Do not use the system for a asteroid mining inside planetary gravity area - it would consider this planetary mining and would mess everything up.

The Dispatcher would accept the task and broadcast mining command to all active drones, respecting the group-constraint (see script arg reference discussion).

If you take a look at the logging panel (or Dispatcher PB screen if you don't have one) you'd see GPS points that describe your mining task. They can be used later using command:create-task-gps (see script arg reference discussion).

Having a camera on an Agent or Dispatcher would allow you to designate a mining task using command:create-task-raycast. Point a camera to the ground, and run that command while still looking through that camera. If you are on planet, avoid using that on terrain slopes - in that case it's better to drive a drone there and do old-fashioned command:create-task.


Drone building guidelines

Before making the drone of your own, take a look at stock models.

Flight control code is based on AutoPillock core and supports all types of thrust, including gravity drive.

Required blocks

  • PB for SCAM code.
  • Connector facing down.
  • Gyroscope named "forward-gyro" (can be changed in the code - ForwardGyroTag). The gyro should look forward the drills and connector, i.e. down to the mining area.
  • Remote control
  • Antenna with enough broadcasting range
  • At least one thruster in every direction.
  • Drills facing downward. They can have connector between them in a chessboard pattern.

Reference gyro orientation

The drone considers it's forward direction based on how you placed forward-gyro. It would align itself with gravity or mining plane based on gyro orientation, and it would mine forward.

When mining or travelling around, the drone considers the forward-gyro position the pivot point of the drone. It is recommended to place the forward-gyro as close as possible to the middle rotation axis of the drone (ideally, when you roll-override the gyro, the gyro should stay in the same world space spot).

Drill placement

The code would attempt to estimate the "circular-pattern-shaft-radius" value automatically based on drill positions. If you want to override it, just place command:set-value:circular-pattern-shaft-radius:{value} below the set-role command in Custom Data boot batch.

Thrusters

The drone needs enough thrusters to support itself on max load in the highest G environment you want it to operate in. That is absolutely required for bottom-facing thrusters that would do the most weight-lifting.

You need some side-facing thrust too. If the drone tilts in G-environment, side thrusters would contribute more to the total lift, while downward thrusters would reduce their contribution. At high angles the drone can find itself being unable to support itself, in this case the code stops, releases control and turns vanilla dampeners on (the drone would probably float to the ground and crash unless you save it with manual rotation adjustments).

You need at least one thruster facing upwards, even if you don't expect the drone to fly tilted so much.

Timer triggers

You can add timer following naming convention
{MinerState}.OnExit
{MinerState}.OnEnter

Where MinerState is
[Disabled, Idle, GoingToEntry, Drilling, GettingOutTheShaft, GoingToUnload, WaitingForDocking, Docking, ReturningToShaft, WaitingForLockInShaft, ChangingShaft, Maintenance, ForceFinish]

The code would try to run appropriate timer when it changes state. For example, you can have Maintenance.OnEnter timer turning a sound block on, then Maintenance.OnExit timer do the opposite.
Last edited by cheerkin; Jun 16, 2024 @ 1:26pm
< >
Showing 1-15 of 32 comments
cheerkin  [developer] May 5, 2022 @ 4:56am 
Marredone May 5, 2022 @ 2:09pm 
Thank you!
bosselorentzon May 23, 2022 @ 12:16am 
Thx and y did a realy good job:)
cheerkin  [developer] May 23, 2022 @ 1:26am 
Another one by Pro100tv. Shows a lot about adaptive mining feature, how it works and how to activate it:
https://www.youtube.com/watch?v=ftAl8DTeXQ4
2yysforu Oct 15, 2022 @ 10:45am 
Unfortunately I'm unable to get them to work, unless it's flat ground where the pickup spot is other than that they just crash continuously.
PlasturdPanda Jan 5, 2024 @ 3:27pm 
Mine gets stuck waiting to dock, idk why
nathanaguiar Feb 18, 2024 @ 9:01am 
what is "Dispatcher boot command batch" not very clear instructions as to what or where it is
cheerkin  [developer] Feb 18, 2024 @ 1:28pm 
"Get Dispatcher boot command batch from this page and place it into PBs' Custom Data."
I think its kinda clear, you know what Custom Data is, right? You go to the main page and get Custom Data text for Distpatcher and copy it there. I'm afraid if you are stuck at this point you will have very hard times with this script.
Jack Schitt Jun 16, 2024 @ 10:14am 
Originally posted by cheerkin:
You go to the main page and get Custom Data text for Distpatcher and copy it there.
The code you use in the setup video isn't anywhere on any of the pages related to this script. Was it removed or something? Please repost it.
cheerkin  [developer] Jun 16, 2024 @ 1:21pm 
The video says: "get this stuff from WS page of the script". Is this not clear somehow? There is a script, and it is published to workshop, thus having a workshop page. When you subscribe to a script, you are on that page. And CD contents are there, as said in the guide.
cheerkin  [developer] Jun 16, 2024 @ 1:25pm 
The code you pasted (in the message you deleted later) is correct - I won't re-make video every time there is a new command. I will rephrase that part of this guide to avoid confusion (from this page -> from main page).
Jack Schitt Jun 16, 2024 @ 1:34pm 
Cheerkin,

The code you use in the video is not anywhere on any of the pages related to this script.
The code you use in the video has 'public int's at the end of it.

Your instructions contradict the video.
Originally posted by Cheerkin:
Get Dispatcher boot command batch from this page and place it into PBs' Custom Data.

- That code is NOT in the description text. LOOK...lol
- The code I'm asking about (in the video) was pasted into the Code Editor of the PB, not the Custom Data, as the instructions say.

Your instructions are not clear.

Looks like an awesome script! Where's the code to get it going?
Last edited by Jack Schitt; Jun 16, 2024 @ 1:42pm
cheerkin  [developer] Jun 16, 2024 @ 1:42pm 
Ah, the code itself? Is it your first experience of using WS scripts? You get the code using game interface, click a button to browse your subscribed scripts and get it into editor. The code may look not exactly like it does in the video, it does not matter.
Jack Schitt Jun 16, 2024 @ 1:45pm 
For all that's holy, Cheerkin. Read your own instructions. The code you use in the video is not on any of these pages.

I may be blind but I'm not an idiot. English is my language and I've been coding since 1982.
I've been using scripts in this game since 2013.

the code you use IN THE VIDEO is not on the page
cheerkin  [developer] Jun 16, 2024 @ 1:56pm 
There are two things you need:
1. The script code. It is distributed via steam, as other scripts do, it goes into PB code editor, and apparently it is not found on any of pages here.
2. The custom data batch. It is found on the main page.
< >
Showing 1-15 of 32 comments
Per page: 1530 50