r/spaceengineers • u/Replicant-Oni Space Engineer • 10d ago
MEDIA Mining Take 2
Another stab at an autonomous miner. This one still needs some optimization to cut down on time, but its pretty close. The miner runs three Programable Block scripts: a mining script that governs its basic flight, a debugging script that tracks all of the grid's actions, and a emote script.
I don't write scripts and I haven't written a line of code in three decades. Instead I just told Claude what I wanted and ran iterations feeding the debug logs back to it with human language discussion about what I wanted. The emote script is kinda cute - i just told Claude to write a script that would let the emote block show me how the drone was feeling.
The drone flies to a designated waypoint above a known ore deposit. It terrain clears to the depth of the deposit using a canary box and then drills a horizontal spiral-cut that's approximately circular. The drone pushes the circle out whenever it finds ore. If it doesn't find ore at a particular point it stops extending that arc of the circle. Over time the spiral cut approximates the shape of the deposit.
When the drone can't find any more ore at a given depth it extends the initial vertical bore hole and repeats the process. Repeats until it can't find anymore ore. It takes breaks to drop of cargo, is mindful of its power levels, and remembers where it last left off.
Still needs optimization on where its wasting time, but the gaps at this point are pretty small. The logs track drilling rate and time between tasks, and that just feeds the next revision. I still need to implement a way to tell the drone if I actually want stone or ice (right now its chucks anything not ore during the horizontal drilling (but not vertical).
LLM driven scripting is a literal game-changer for this game. FWIW, I found the debug logs invaluable - not for me, but for the LLM. The Debug script writes the log into Custom Data on blocks that have the capacity. I started using LCDs for this, but Access Pannels work too and cost less PCU. Claude will read out the log directly from the blueprint file: copy the grid => replace the blueprint => drag and drop the file into Claude. With the Log, the LLM can effectively troubleshoot its own scripts (and can do the same thing with automation blocks generally).
9
u/Joker1212v Clang Worshipper 10d ago
Quick question regarding the build, are the miners connected via a rotor outsorce material to storage cobtainer? I ask because in SE 2 it is impossible to connected rotor, pistons and drills all in one conveyor line to storage
3
u/Replicant-Oni Space Engineer 10d ago edited 10d ago
There are two rotors between the drills and the cargo blocks (and one hinge between the one drill on the drill head and everything else).
Drill > ———|
Drill > ———|
Drill > hinge > rotor > canary box > rotor > cargo
5
u/rentaro-kirino Clang Worshipper 9d ago
As a fellow LLM scripter, I am happy your finding out how useful they are for SE specifically.
I've actually been chasing the LLM scripting route since maybe late 2023? One the MUCH earlier versions of CGPT. And I can confidently tell you, the leaps and bounds we have made since then is insane.
I used to have to request a script scenario from GPT, then feed back maybe 40-50 iterations of error codes from the compiler before I got a working script, and then another 15 or so afterwards to make changes. This truely sucked because at the time, we didn't yet have the text detection from the snipping tool, so I would manually type in hundreds of lines of code at a time.
Nowadays, you just use the snipping tool, analyze the image for the text, and copy and paste it all in sections from what you can see with the current scroll. Feed all that into the LLM, and boom.
(Let me preface this next part with the fact that I barely know any of this code. What I say is from literal years of fighting with LLM on these script) A constant issue I found to have with GPT and SE C#, are 2 things, which are almost immediately fixed by creating a project folder for all your SE codes, then inserting these issues/solutions into the project instructions. #1, GPT loves to stick 20 using clauses at the start. I found that they are likely pre-enabled, and are unneeded, and actually are the cause for all your errors when making code. #2 the SE C# code is a modified copy that runs off a canned set of commands/script. I direct the LLM to verify any used code follows the pre-established command listing, that you can find on the SE wiki.
Once I pre-informed GPT about those 2 problems, it wiped out about 70% of the compiler feedback I had to give. The only thing you truely have to look out for, is verifying with your LLM close to the final stages on the scripts memory usage and leak possibility. You can have a script that it built with normal function, but it might slowly be leaking memory from loops or other sources. I am sure you can understand the dangers there and how it compounds with multiple scripts.. so always instruct your LLM to verify script memory integrity and efficiency before you finalize.
Sorry for the book, but I will end with, half the time I post to the discord, you always have people screeching about AI this or AI that. Just look at it for the tool it is, which is allowing us non-coders to really take advantage of the full game. I have soooo many really cool and useful scripts made with GPT, and honestly have a lot of fun with the creation process with GPT. I may not be writing the code, but I am still engineering with all the debugging, corrections, and alterations to give me the exact final product I want. For example, 2 separate scripts I made, which are relatively simple, but also extremely cool, are an MFD for my fighters, which automatically catalogs all ordinance I have attached, and makes a 1 button press for dropping a predetermined type and quantity. Then another script I made, utilizes a hinged camera on a WWII style bomber to act as a bombsight on level and close level flights, which I have found to be +/-50 m accurate at 1k altitude. The possibilities are endless here. Go and do scripting good!
3
u/Replicant-Oni Space Engineer 9d ago
Appreciate the perspective. I had about three years of C++ back in the 90s. Definitely out of my depth at this point. So much of LLM output is predicated on understanding its limits. There's not a lot of casual conversation on how to use it, just binary its amazing/its end of world... I gave up on GPT. I don't think Claude as thrown a single compiler error.
1
u/rentaro-kirino Clang Worshipper 9d ago
Tbf, I rarely ever get comp errors these days anymore either. I can't tell you if it's due to the preface instructions I have setup with the experience gained prior, or if it's the newer model just being better. Likely both. But yeah the LLM's do a great job of doing what we have no clue to do
2
u/UniGodus Space Engineer 9d ago
How would you go about starting to script with LLM's in space engineers? I have open code set up, so, I wonder if it could automatically write and then set them up in game?
1
u/Replicant-Oni Space Engineer 9d ago
1.) setup a second programable block on the same grid you're working on. Label it something something Debug (for clarity). include access panels, LCDs or any block that holds custom data on the grid as well. (access panels are the cheapest). Name them something something [Log] for clarity. Tell your LLM of choice to write a script that logs the behavior of your grid for the purpose of debugging and stores that log in the blocks tagged with [Log]. After you've tested your script in game for a bit, copy the grid as a blueprint with a name you can easily remember (e.g. debug grid). Drag a copy of that blueprint into the LLM chat. The LLM will be able to read the blueprint and the log data stored in the access panels from the last time the blueprint was made. This is extremely valuable for getting the LLM to help you figure out what went wrong.
2.) The LLM is less likely to misunderstand what you want if you can use accurate mathematical terms to describe what you want. As an example: if you've built your grid and you know you want the hinge on the grid to move from the 90 degree postion to the 0 degree position, say that instead of saying "I want the hinge to move up." It can be helpful to state a general goal then follow with specifics: "I want the hinge on the drill head to move to the 45 degree position and back to the 90 degree position whenever the rotor arm rotates from the 0 degree position to the 90 degree position. Think of the LLM more as a translator for what you already know you want to do, not something that's going to give you the answer.
3.) start with a design doc - spell out what you want the grid to do and how you think it should do it. Claude at least will steer you toward a product design process if you let it. I've found that helpful.
4.) Claude knows more about scripting than I do. It also knows more about what's available through the various API. If I want to accomplish something with a script I state as clearly as I can in game terms what I want and ask what functions a script has that will give a solution, and what information is needed to get the script to work.
1
u/rentaro-kirino Clang Worshipper 9d ago
As far as what we are talking about, it's all about using a model of your choice. For example, OP uses Claude, I use GPT. Just create a new conversation, tell it you play SE, and want to make a script for it, and then work with everything it gives you. It will attempt to write the script for whatever you want, and you usually just copy and paste it into the programmable block. Be sure to include what blocks you need for the program to work, and what the name and/or type of blocks are.
1
2
3
u/Beansoverbitches Clang Worshipper 9d ago
Man I wanna get into this game but I don’t wanna spend years learning it
6
u/Replicant-Oni Space Engineer 9d ago
Totally sympathetic. I had the same response the first time I came across it. Steep learning curve, but once your'e over the hump...
2
u/Beansoverbitches Clang Worshipper 9d ago
Hell yea! That gives me some motivation. I’ve dealt with steep learning curves, I’ve had to teach myself A LOT of different things. A little help with YouTube and should be good eh?
1
u/Replicant-Oni Space Engineer 9d ago
youtube was a huge source of information. Also reddit. A little obsessive compulsive desire to solve problems helps too.
2
u/DooficusIdjit Clang Worshipper 9d ago
It’s not as deep as it seems. You can totally get up and running in a few days.
1
u/UPC13 Clang Worshipper 9d ago
Most of the stuff is pretty easy to pick up on. Controls are pretty straightforward and the premise is just build stuff. Most of the controls and settings for the mechanical pieces are simple, the hard part is doing the maths to find what values work for the applicatio. Trial and error is the easy way if you don't want to break out the calculator, just save often and record the big explosions to share.
117
u/KnightyEyes Klang Questioner 10d ago
18
u/rentaro-kirino Clang Worshipper 9d ago
SW still makes bullshittery videos to this day, and yet none are of modern SE 🥲
8
u/KnightyEyes Klang Questioner 9d ago
Is he? I mean he so rarely makes it It makes me say "Does he really does it?"
he's lazy xd
5
45
u/Rokathon Clang Worshipper 10d ago
Oh my god. Rotors on a hinge on a small flying grid!
SE has come sooooo far since i started playing. If i tried that in my last big save the ship would implode
5
u/CompetitiveMister Space Engineer 9d ago
My god, i want to build this and drive it in my survival game!
Please! Either make a video building it or put it in the workshop!
1
u/tracagnotto Space Engineer 10d ago
I made self assembly and disassembling drills. It basically uses merge blocks to hold pieces in mid air while the additional shafts gets printed and merged back. I digged 2km and it still held up. Didn't try to go farther. Needed to try it on a ship
1
u/Replicant-Oni Space Engineer 9d ago
WIP Drilling Rig : r/spaceengineers
I started of with static rigs. This is an early version. same basic concept: start with a known location of an ore. terrain clear using a leading drill as a feeder to a canary box to locate the actual ore, then horizontal drill out the area. This version used spokes, but he final spiral-cut the horizontal area. It looks like its klang-prone but it never had issues with klang. Over a hundred hours of activity and no klang-mishaps.
1
u/ColdDelicious1735 Klang Worshipper 9d ago
Looks awesome, so much klang potential
2
u/Replicant-Oni Space Engineer 9d ago
It’s actually really stable. One hinge gets locked in place, and the two rotors are pretty close to balanced (center of gravity over the rotor head)
3
3
u/JimKiDo Xboxgineer - ⚒️ -> 🚀 9d ago
Really well done. And I agree, using LLMs can really lower the bar of difficulty for the more advanced aspects of the game. I'm currently using similar techniques to figure out how to leverage the dedicated server to allow a console client similar access to in-game automation via server-side scripts, especially station& ship management scripts.
2
1
-10
u/mysticblanket Klang Worshipper 10d ago
"I just told Claude..." And I'm out
6
u/Dixie_Normoussss Space Engineer 10d ago
What's wrong with someone who has never written any code, asking an LLM to create said code for a script? All you virtue signaling mofos always on GPT and then you come here like you're some sort of saint. If what he's done is so bad, make a script without AI help, that does what OP wants and put it on the workshop.
3
u/vylseux Clang Worshipper 10d ago
Some people have never coded and don’t realize that even the greatest programmers use AI assisted programs to create the games and software they love.
1
u/GammaDie345 Clang Worshipper 6d ago •
![]()
that's different. if you learned to code before using AI it's a tool and not a shortcut
using AI without learning to code yourself is no different from paying someone to do your homework
0
0
u/mysticblanket Klang Worshipper 6d ago
I went to school for programming and then embedded engineering. AI is shit lmao
-7
u/Informal_Drawing Space Engineer 10d ago
Yup.
I cheated to win and now I'm holding this video to prove it.
Not impressing anybody.
2
u/RockRancher24 Klang Worshipper 10d ago
I'm impressed, because I actually understand what's going on from a real perspective instead of whatever the hell you're doing
2
u/Replicant-Oni Space Engineer 9d ago edited 9d ago
I’m fairly sympathetic to concerns about AI. In my real job AI is absolutely not ready for prime time, but in this niche it’s phenomenal. I’m not looking for credit or accolades here, I’m just amazed at the process. I’ve gone through two major design revisions on the basic grid, and iterated on about 50 revisions of the script logic. The logs and the LLMs review plus my description of what’s happening in game resembles self-learning. Error rate is low but consequential. Similar to my day job, you need to know enough about what you’re trying to do to recognize when the LLM is wrong. The thing that most excites me about this whole process (and why I posted) is this opens up a part of the game that used to be simply unaccessable without some fairly sophisticated knowledge of scripting, but it’s not like you can just tell Claude to go play the game for you. As a post script on the whole thing I’ll note that I started this project using Claud strictly to debug automation block logic. Updating the physical flow charts became too time consuming and error prone. The project changed when Claud pointed out the number of automation blocks needed was ridiculously high and that most of them could be replaced with a single programming block.
5
u/brandontaylor1 Klang Worshipper 9d ago
How do you cheat to win at a game with no end, or win conditions?
0
u/Informal_Drawing Space Engineer 9d ago
You're not an Engineer if somebody else does the Engineering.
1
u/brandontaylor1 Klang Worshipper 9d ago
Dude, I’m sorry to disappoint you, but playing this game doesn’t make you an engineer.
I use workshop scripts in my gameplay all the time. Do you think that’s “cheating” too?
Either way I don’t really care about your opinion or gameplay standards.
0
u/GammaDie345 Clang Worshipper 6d ago
why play a puzzle game if you Google all of the answers to the phzzles
1
u/brandontaylor1 Klang Worshipper 6d ago
It's not puzzle game, its a sandbox game. I think you might be in the wrong sub.
1
u/GammaDie345 Clang Worshipper 6d ago
It's a hypothetical
0
6d ago edited 6d ago
[removed] — view removed comment
1
u/spaceengineers-ModTeam Moderator 6d ago
Can we all please remember the rules: Be civil (No slurs, argue the point not the person).
0
u/CrazyFish1911 Klang Worshipper 6d ago
Why use a miner in SE when you have a hand drill? You're just taking the easy route.
-1
u/CrazyFish1911 Klang Worshipper 6d ago
Imagine gatekeeping the way someone else plays a video game? You didn't build SE yourself, can you even call yourself a gamer?
2
u/NomineNebula Clang Worshipper 9d ago
is it really winning or is it just having fun with the tools to our disposal, let me guess you dont drive because you want to win at walking too

23
u/Tettiah Clang Worshipper 10d ago
That’s ingenious! Do you have a workshop link?