Space Engineers

Space Engineers

89 ratings
Vector Thrust Documentation
By Vermillion
A more in-depth explanation of the features of Vector Thrust.

Ill be adding to this over time, if something isn't explained very well here, please tell me.
   
Award
Favorite
Favorited
Unfavorite
LCD
The LCD gives you information about the status of your ship.

Setup
To mark an LCD for use by the script, put this in its name:
%VectorLCD

As soon as the script runs with that LCD marked, it should control the LCD.
You might want to set font and font size for the LCD.

You can change the marking text in the code.

Spinner
At the top is a spinner. this indicates if the script is running. this will always update if the script gets run. if it is stationary, the programmable block is not running at all, and you will crash. if it stops spinning mid flight, either the script has gone into standby (which you will see displayed on the screen) or the script has crashed. if the script crashes, please tell me.

after the spinner is the time the script took to run the last time. in normal running, its very quick (less than 1ms on my computer). when the ships (dry) mass changes, or if the script gets compiled, this triggers a recaclulation of how the ship is structured, which takes much longer. but that does not happen in the normal running of the script.

Here is what is detailed on the screen:
Normal Running
* Xms Target Acceleration Thrusters Dampeners Cruise Active Nacelles

Standby Mode
* Xms Standing By
Standby
This is the safe method of stopping the script.
don't turn the programmable block off unless you are turning the whole ship off or otherwise resetting the thrusters and rotors.

When entering standby mode, the script will safely turn off all thrusters and rotors its controlling.

The script does not run when in standby mode, this is shown by the spinner.

If you have Control Module installed, it will still run when you press buttons or move the mouse, but this only updates the spinner and doesn't calculate anything.
Jetpack
This is like turning your suit jetpack on and off.

It will turn the engines on and off, but the script will still keep the engines facing the right way.

Control Module default: X
Dampeners
This is like inertia dampeners on a normal ship, or with your suit jetpack.

Control Module Default: Z

Lack of dampeners
When you turn dampeners off you will not fall, instead you will drift around like you are in space. I think this is more useful than the default behavior.

Here is a script that will do the same thing, but without Vector Thrust.
Cruise
Suggested by Raiteri
This modifies the Dampeners function.

In Cruise mode the ship will drift forwards, but apply dampeners in every other direction. If you point the nose up or down it will still drift like you are in space - it will not accelerate.

Control Module default: R

Airplane Behavior
suggested by Sergej515

You can change this value in the code:
cruisePlane
It is false by default.

When enabled this will make cruise mode act more like an airplane - if you tip the nose up or down, it will 'fall' similar to an airplane. If you keep the nose completely level, it will not fall or stall at low speeds.
Target Acceleration
Gravity

The target acceleration is measured in 'g'.
The script considers 1g being whatever gravity field it is experiencing at that time. Not nesicarily earths gravity.
This is so that wherever you are, if your target acceleration is set to 1g, going 'down' will make your engines cut out but not turn up-side-down to drive you downwards.

The Controls
the target acceleration is chosen by this equation:
targetAcceleration = currentGravity * defaultAccel * accelBase^X

- raiseAccel and lowerAccel will increase/decrease X by 1.
- resetAccel will set X to 0

you can set these values in the code:
accelBase defaultAccel
Buttons
You can setup your buttons

%dampeners %jetpack %cruise %standby %raiseAccel %lowerAccel %resetAccel %applyTags %removeTags

%dampeners, %jetpack, %cruise, and %standby will all toggle their respective funcitons.
%raiseAccel, %lowerAccel and %resetAccel will all affect the 'Target Acceleration' value.

%reset will force VT to update its recognised blocks again.

%applyTags and %removeTags - see tags section.
Control Module (Optional)
If you have a world with Control Module installed, you can use keys other than 0-9 to control it.

Pressing these buttons is like triggering the PB with their respective arguments:
X %dampeners Z %jetpack R %cruise + %raiseAccel - %lowerAccel 0 %resetAccel
You can set all of the above in the code.

You can't toggle standby with control module.

Finding Key Names
type this into your game chat:
/cm showinputs
note the s

now press the button you want to map, and it will show up the name on the screen
for example, if you hold your jetpack button, you will see this:
Keys: z Mouse: Gamepad: (not connected or enabled) Controls: c.thrusts
you could either enter "z" or "c.thrusts" and it would achive the same thing. except that if you change the key in your controls, "c.thrusts" will be on the new key, where "z" will still be on z
Boost
This feature is only available if you are using Control Module (see above)

Defaults
holding these buttons will temporarily swap out your target acceleration for their respective values:
shift 3g ctrl 0.3g

Customisation
you can change these values in the code, here are the default values:
public BA[] boosts = { new BA("c.sprint", 3f), new BA("ctrl", 0.3f) };
values higher in the list are prioritised before lower values.

if you want to add a new button, you would do this:
public BA[] boosts = { new BA("c.sprint", 3f), new BA("ctrl", 0.3f), new BA("c.rollleft", 20f) };
note, there is no comma after the last value

this will set your target acceleration to 20 while you are holding the roll left button.
Centre of Mass Issues
Unfortunately there seems to be a physics bug feature in space engineers at the moment which causes thrusters on rotors to spaz out in some situations. I have reproduced it on a ship without the script whatsoever, so its not my script doing it.

Keen seems to be adamant there is no way to fix this while fixing subgrid 'drag', so I don't think they are going to try.
I am going to call this 'KFT' for 'Keen Fantom Torque' ᵏᵖᵗ ᵈᵒᵉˢⁿ'ᵗ ʳᵒˡˡ ᵒᶠᶠ ᵗʰᵉ ᵗᵒⁿᵍᵘᵉ ᵃˢ ⁿⁱᶜᵉˡʸ
KFT Workaround
You could use this rotor strength mod (other mods are available) to overpower the phantom force.

OR

So far, I have narrowed it down to the rotors being in-line with the centre of mass... That's pretty ironic because a recent update is supposed to remove that requirement.

Just try to keep the rotors in-line with the centre of mass and it should be fine.
Values in Code
These are all options which you can change by editing some text at the top of the code, once you change them you have to press 'check code' and 'remember and exit' again.

Editing the Values
You don't need to know how to code to change these values, just remember a few simple rules:
* comments: these are lines with // at the start, they will be ignored by the program, so you can put whatever you want there.
* there should always be a semi-colon (;) after every line
* don't change anything before the = sign
* numbers with decimal points should always have a (f) after them

I recommend taking a copy of the whole program (ctrl+a to select all) before changing these if you already have settings that work, that way if you break something you can put your copy in with your changes and try again from there.

Explanations
I try to explain these with comments in the code (lines with // before them), so look there first.
If an option doesn't make sense, or you don't know what to put there, tell me and ill explain here.

--none yet--
Tags
Tags are used to limit a Vector Thrust program to certain blocks.
A tag looks like this:
|VT|

Quick start
Pass the '%applyTags' argument.

Greedy
By default, VT doesn't use tags. This is called 'greedy' mode - where it will try to control anything that looks like a nacelle. This is useful for building, or if you don't connect to other VT ships. If its in greedy mode, it will say so in the bottom right of the Programmable block screen.

These commands are useful for tags
%applyTags %removeTags %reset

Apply and remove tags do indeed apply and remove tags to the blocks which the programmable block is controlling. But they also turn the greedy mode on and off. If you just type the tags without using '%appyTags', it will still be in greedy mode and ignore the tags.

Changing Tags
You can change the tag of your ship by changing the 'myName' value in the code. This way you can give different tags to different ships, and not have them interfere with each-other when connected.

Changing Tags
Once you are out of greedy mode, you can change the tags to be on whatever blocks you like. But for the script to recognise it, you need to cause an update. For example, the script updates when the mass changes - thats how the building works. This isn't guaranteed to update everything though. The easiest way to cause a complete update is by passing the '%reset' argument.
Rotor Limits
Currently, The program ignores rotor limits - Although the limits will not break the program.

This means:
  • it will not change any limits you put in place
  • if you have the out-of-bounds section less than 180 degrees, the code that decides which direction to turn might still try to make it rotate past that area, if it thinks that direction is quicker.
  • the amount of thrust output by a thruster is dependent on how close the thruster is to the correct direction - so if it can't reach the correct direction, it will have little to no thrust.
This is a Script, not a Mod
If you put the script in the mod list for your server, it will break your server.

To use this, you need to use it in a Programmable Block.

For more Info, see this.
Future Plans
This is a passion project, I work on it when I have time. Unfortunately I don't have time for it at the moment, so don't expect updates any time soon.

When I do get back on the horse, Here are some of the plans:
Note: this is not an exhaustive list.
Features
Make it so that VT ships don't try to control other VT ships on the same base Add dynamic runtime so that the script doesn't crash on massive ships.
Fixes
Fix Limited Nacelles
Bugs
Limited Nacelles
the thrust of the more powerful nacelles will max out at the maximum thrust of the less powerful nacelles *in the same direction*. this is from when an uneven placement of thrust around the centre of mass would make your ship rotate. since that is no longer a feature of the game, it should be changed.

practically, it means if you have a nacelle with weak thrust output, it will limit the thrust of the more powerful nacelles, so try to avoid this.
62 Comments
Verlone 21 May, 2023 @ 8:47am 
Is there a mode in the script so that the engines turn in the direction I need and stay in it until I switch the mode to jetpack?
dan_siegel30 30 Mar, 2021 @ 4:53am 
"Apply and remove tags do indeed apply and remove tags to the blocks which the programmable block is controlling. But they also turn the greedy mode on and off. If you just type the tags without using '%appyTags', it will still be in greedy mode and ignore the tags." - Does this feature work? I can't get it to work. I want to stay in greedy but be able to add/remove various components while I fly. Basically, I want to disable my ions while in atmosphere when they have extremely poor efficiency and my atmos thrusters can handle the load.
APeiceOfChicken 23 Mar, 2021 @ 3:12pm 
is there a way to have the boost button work without the control module mod?
CZdigger146 18 Oct, 2020 @ 1:14am 
Hey man, is there a way to set up "local accelerations"? Right now the script has only that one acceleration limit (default is 1G) which applies to all movement directions. This way (on 1G) thrusters won't spasm out when landing but when you want to accelerate, the thrusters won't use all their power. But when set to higher values, it is basically impossible to land although you can accelerate very quickly

I'd like to set up something like 1G acceleration for DOWN (so thrusters will just turn off and don't rotate all the way like intended in the original script), 3G for UP, 5G for FORWARD, 5G for BACKWARD, 3G for LEFT/RIGHT or something like that

TLDR: I want go fast, don't want crash on landing. Is there a way to do that?
Project Cenix 6 Sep, 2020 @ 9:06am 
Work it with hinges?
DSiren 10 Aug, 2020 @ 8:15pm 
I think it has more to do with Trig and load bearing, since I imagine the script is struggling to calculate the correct angle for the rotor to both bear the load and propel in the intended direction, with a mix of the "non alligned" placement requiring a proportional torque to maintain the correct angle. Funnily enough, this might be better dealt with by putting gyros on the nacelles with the "gyro override" turned on.
Nobuddy 10 Aug, 2020 @ 6:22pm 
Food for thought. I just tried this and I see the "center of mass" issue mentioned above. Not sure if the author or anyone else has the desire to investigate but I want to say moments of inertia might be part of the solution to the "rotors spinning wildly" issue. That said, calculating a moment of inertia for an arbitrary shape requires calculus and it may not be doable in SE.
꧁꧂🅻🅴🅾꧁꧂ 21 Jul, 2020 @ 5:04am 
help when other players using his ship i can't take off with my vector ship
RoboWolf 20 Jul, 2020 @ 10:36pm 
is there a way to fix the dampeners when i get back in the game? (single player)
mad-rooky 7 Jun, 2020 @ 4:13am 
Am i blind or isn't there a way to exclude thruster from beeing used by the script? Want to exclude hydrogen thrusters.