Space Engineers

Space Engineers

Spug's Easy Auto-Docking 2
 This topic has been pinned, so it's probably important
Spug  [developer] 30 Jun, 2020 @ 6:07pm
Spug's Bugs
Any bugs? anything odd happening? post it here and it'll notify me.
It's best if you can replicate the issue so you can tell me the process/ship setup that caused it (helps me to narrow down the cause).
It's also super useful if you can tell me what the script is saying when the issue happened. Is it carrying on as normal? Is there some sort of error?

Commonly known issues:
- When a speed mod is installed, landing on moving ships that are 120m/s+ can cause the docking ship to dock ahead/behind the connector. This lead amount can be adjusted using the "high_speed_lead_amount" variable. Try 0.125 for example.
- There is an issue where ships travel slowly for no apparent reason. Raise the variable "add_acceleration" to a value such as 10.
- If you are getting an error/exception/script crash that says at the top something about "Only two viable thruster groups found" at the top of the error, this means something weird is going on with the SE physics. Perhaps it is a mod, or server lag. It can fix itself, try recompiling the script and moving the ship a little too. If it persists, try the same ship on a save with no mods. Or just try on a different ship to see if that's the issue.
Last edited by Spug; 4 Sep, 2020 @ 4:57pm
< >
Showing 1-15 of 145 comments
HaloSpartanCats 4 Jul, 2020 @ 11:00pm 
not really a bug, but how do i set this up?
Spug  [developer] 5 Jul, 2020 @ 2:58am 
Originally posted by johnraku:
not really a bug, but how do i set this up?
Hi johnraku, there's a section in the description labelled "How to use". Follow that and it should explain all that's required. If there's any specific parts of it you don't understand just ask.
usurpine 5 Jul, 2020 @ 1:02pm 
>> @usurpine, I believe this is down to specifically your ship setup.
My setup is nothing extraordinary. I show you a picture of it and you are also welcome to join my server, where i am playing this setup in my own world:
Mcserver
McWorld-Extrem Survival

I am building here my own ships under realistic environment in survival mode and greatly dehanced mods to make it more interesting and more realistic.
Here i undocked, did some work and came back and pressed the dock button. Then the ship flipped over and crashed.

https://zkmdnomdow9ccafi.myfritz.net:48116/nas/filelink.lua?id=d0300515767586aa

Spug  [developer] 5 Jul, 2020 @ 1:07pm 
Originally posted by usurpine:
>> @usurpine, I believe this is down to specifically your ship setup.
My setup is nothing extraordinary. I show you a picture of it and you are also welcome to join my server, where i am playing this setup in my own world:
Mcserver
McWorld-Extrem Survival

I am building here my own ships under realistic environment in survival mode and greatly dehanced mods to make it more interesting and more realistic.
Here i undocked, did some work and came back and pressed the dock button. Then the ship flipped over and crashed.

https://zkmdnomdow9ccafi.myfritz.net:48116/nas/filelink.lua?id=d0300515767586aa

Oh hmmm interesting. Your ship setup does look ok there to me. I would quite like to join and have a look myself if that's ok? I will add you on steam to make the process easier.
usurpine 5 Jul, 2020 @ 1:10pm 
Imho for planetary ships which are not able to fly upside down its essentiel that the pitch does not exceed a specific angel, because specially very heavy ships dont like to go out of the horizontal a lot, they go down and easily crash.
And the now necessary thruster which points down shouldnt be there, Most of my planetary ships dont have any thruster pointing down, because we have already have gravity.
Spug  [developer] 5 Jul, 2020 @ 1:16pm 
Originally posted by usurpine:
Imho for planetary ships which are not able to fly upside down its essentiel that the pitch does not exceed a specific angel, because specially very heavy ships dont like to go out of the horizontal a lot, they go down and easily crash.
And the now necessary thruster which points down shouldnt be there, Most of my planetary ships dont have any thruster pointing down, because we have already have gravity.
I do agree that there is a critical angle it shouldn't exceed when docking. The way I have programmed it (and looking at your setup), this shouldn't normally happen. I will see if this is a bug you are experiencing when I join.

Concerning the necessary thruster pointing down, I agree, it's an annoying limitation which I wish I didn't have to have. Sadly the fix will take a while.
Spug  [developer] 5 Jul, 2020 @ 3:13pm 
Originally posted by usurpine:
Imho for planetary ships which are not able to fly upside down its essentiel that the pitch does not exceed a specific angel, because specially very heavy ships dont like to go out of the horizontal a lot, they go down and easily crash.
And the now necessary thruster which points down shouldnt be there, Most of my planetary ships dont have any thruster pointing down, because we have already have gravity.
Here is a temporary fix to your issue. Rotating your connector 90 degrees around the "forward" axis will cause it to yaw instead of pitch:
https://github.com/ksqk34/Autodocking-2/blob/master/Autodocking%202/gifs/Docking%20fix.png
Last edited by Spug; 5 Jul, 2020 @ 3:14pm
usurpine 6 Jul, 2020 @ 1:33am 
yes, this is an easy solution and it worked fine.

I have made some more tests with this now working setup.
If you want to use automated docking you should put some love into your designs because just place a connector somewhere and people from random positions just press the dock button still will not always work well.
At least they should manually put their ship into a pretty near position next to the connector and then press the dock button.

If you dont do so, your ship can get severe damaging from the docking process, if it fails. In one case on my scenario i almost fully lost a big thruster with gazillions of motors and you dont want that in harsh environment ( although i am already using the physics fix mod, so steel is not behaving like glass).

So i will go on testing this and adapt my ship design to it. Keep up the good work !
ramakin 6 Jul, 2020 @ 8:44am 
you guys are having to much fun everyone back to work lol !!
Qarannia 17 Jul, 2020 @ 7:00am 
Hi Spug,

I don't believe your script is malfunctioning; I reckon it's doing exactly what it's supposed to. My setup in my ship may be causing some issues and if that's the case I will have to modify my ships accordingly.

So I have a big hangar about 5 large blocks high with 3 connectors on the wall at the far end and 3 in the floor on the approach to the far wall. My shuttle that will dock has 3 connectors on it; 1 on the back, 1 on the bottom and 1 on the top. I have set the shuttle up to dock at the wall using the back connector and dock on the floor with the bottom connector.

If i line the shuttle up nicely with the wall connector in the vertical and horizontal planes then the script will spin the ship 180 degrees and dock perfectly (although I did change the max speed to 5 because I found even 10 m/s was too quick). If I get the shuttle close enough, about 2 metres or so, from the floor connector it docks perfectly.

If I try to dock to the floor connector from further away than a couple of metres it will first make the ship go up until it hits the hangar ceiling, then it scrapes along the ceiling until it's overhead the connector, then it drops down and docks beautifully. Like I said, I reckon it's doing exactly what it's meant to. I had hoped that the vertical clearance variable (I can't remember it's name now) set to zero would stop it from doing that whole climbing thing but it didn't. Incidentally the same happens in reverse if you dock with the top connector to a connector in the ceiling of the hangar. Get close enough and the docking works fine but more than a few metres and the shuttle slams down into the hangar floor.

I won't pretend to understand the mechanics of your script but it seems like it's looking at the coordinates of the two connectors and trying to put X amount of vertical distance between then before it starts the approach. The SAM autopilot script does the same thing incidentally.

It also seems like too many connectors spaced too close together can upset things. As I mentioned in my comment a couple of days ago, if I put the ship in line with a different connector on the wall the script will happily dock to it. Put the shuttle between the two wall connectors, even some distance away, and it will just go to a point between them on the wall and try and dock with it. Again, I suspect this has something to do with the many connectors in my hangar.

I'm not going to argue that the script should take over all flying from me; I actually enjoy flying into a hangar to dock. It's those last few metres where the space is too confined and the exterior view pushes you back inside the cockpit so you can't see the connector anymore; that's the part that annoys me.

I can absolutely use your script as is; I just have to get close enough and lined up enough. not a problem.

One final question though. How do I clear the "memory" of the script on my shuttle, i.e. get rid of saved connectors? Did I miss something in the setup instructions?
Spug  [developer] 17 Jul, 2020 @ 7:24am 
Hey Qarannia,
I've allowed the connector clearance to be negative, if it is rising too much then you can make it something like -4 and it shouldn't rise at all (depending on what type of sized connector you use, might be a little trial and error).

Concerning multiple connectors, it shouldn't matter if any connectors are close UNLESS they actually become "connectable" during landing (a.k.a the ring becomes yellow and they're ready to lock together).
The script can only handle one of these occuring at a time. It will do unexpected behaviour if during docking, an unexpected connector becomes connectable. Maybe it will connect it, maybe it will set that as new home, maybe it will try to carry on yet go wrong etc.

If your ship does not connect to these other connectors during landing at all, and they're pretty much decoration (they have no relation to a landing sequence) then I wouldn't have thought their presence would effect the ship at all.

Similarly, if those other connectors are other home locations then I also wouldn't have thought they would cause issues - it would be the same as having saved connectors far apart from each other. Them being close shouldn't cause issues.

If none of these are the case... I'll probably need a diagram to understand the situation further.
Spug  [developer] 17 Jul, 2020 @ 7:27am 
Clearing the memory isn't a thing however you can of course do it by grinding the prog block down to the "hack" line then weld it up again. Or just delete then add it back in in creative.

An option I have just theorised now could also be to add a # in the name of an argument, that would make the argument corrupt and my script will likely delete the location when recompiling, to clear the corruption. No garuantee on that working though I haven't tried it haha. In theory it should
Qarannia 18 Jul, 2020 @ 6:12am 
Thanks Spug,

I've been replacing the PB to clear the memory; I just though there was maybe a "clear" command that I'd missed.

There isn't a problem with two connectors going yellow at once; they are spaced more than far enough apart to prevent that. One thing from your comments that caught my eye is that the other connectors weren't actually set as home connectors for the shuttle yet (I hadn't gotten that far) and so that might have confused things. I'll play with the connector clearance variable to see how that changes the shuttle handling.

I'll give you some feedback on how I get on.
Qarannia 18 Jul, 2020 @ 8:46am 
So the connector clearance worked like a charm. Just a little bit of trial and error to find the correct amount and now hangar docking works like a dream for connectors on the floor or ceiling.

Thanks for the change to that variable Spug, it's really made the difference.
Spug  [developer] 18 Jul, 2020 @ 11:04am 
Originally posted by Qarannia:
So the connector clearance worked like a charm. Just a little bit of trial and error to find the correct amount and now hangar docking works like a dream for connectors on the floor or ceiling.

Thanks for the change to that variable Spug, it's really made the difference.

No worries Qarannia!

Is the:

Originally posted by Qarannia:
Put the shuttle between the two wall connectors, even some distance away, and it will just go to a point between them on the wall and try and dock with it. Again, I suspect this has something to do with the many connectors in my hangar.

issue fixed now too?
Last edited by Spug; 18 Jul, 2020 @ 11:05am
< >
Showing 1-15 of 145 comments
Per page: 1530 50