Skip to content

Launcher Pad

Robin Seifert edited this page Jul 2, 2023 · 6 revisions

Launcher Pad

Launcher pad is a single block providing a place to load and fire missiles. On it's own it contains no way to trigger the launch or encode targeting information. In order to do this it needs to be connected to a launch network and controller.

Placement

Launchers can be placed on all 6 sides of a block as of v5.4.x. Allowing missiles be fired in different direction to better meeting base designs. Though this does come with considerations. Such as needing to account for turn angle of the missile. As well differences in flight time.

Launcher will rotate to match the face of the block it was placed onto. So if you click the north face it will place facing north. After placement there is no way to rotate the launcher.

Flight Logic

By default launchers will encode the missile with the following flight logic patterns:

  • Engine Warmup - simulation of engine starting it's burn process, causes a few ticks delay
  • Slow Climb - simulates missile overcoming gravity to climb, disabled if missile isn't aiming up
  • Lock Height - handled the lock height setting and will move in a set direction
  • Arc - actual ballistic flight calculations

For distances under 200m the missile will arc towards the target. For distances above it will flight strait up with a slight angle towards target. This is to assist the missile enter simulation mode. As longer distances result in strange math from the arc logic... are generally wasted since the simulation system ignores said math when spawning the missile back into the world.

Spawning

Missile will spawn above the launcher by 2.5m. Visually it will look to be in the exact spot. However, logically the hitbox and entity are at the warhead of the missile. This is important to understand when setting lock height and working with other mechanics. As this value is not subtracted during launcher. So assume top of missile as starting point for all interaction.

Missile Riding

Launcher pad does allow for player to ride the missile before launch. This can be used to create a taxi like service with the missiles. When doing so missiles will not enter simulation mode. Meaning they will try to fly the full distance to target. This may have unexpected behavior for longer distances. Use at your own risk... yes it does support non-players, even in simulation mode. Have fun figuring out how to do that.

GUI

Launcher pad GUI is used to configure per launcher settings. Such as lock height, firing delay, and grouping.

TODO insert picture of UI

Grouping

As of 5.4.x, grouping is not a completed feature. In the future it will allow controlling how missiles are used in firing solutions. Such as chain firing, batch firing, and delay ordering. How this will work is not yet finished, but can be used by other systems such as Computer Craft.

Group_id -> Group to join

Group_index -> placement inside of that group, can be thought of as priority since more than 1 launcher can share the same group

Lock Height

Distance to move after firing the missile before starting flight arc/path. Defaulted to 3 to prevent missile from slamming into the wall.

There will always be a minimal lock distance for launchers facing up. Which is controlled by the slow climb logic and is usually 2 meters. Slow climb distance is subtracted from this value to ensure consistency. Launchers fired down or sides will use the the full value.

Firing Delay

Time in ticks, 20 ticks a second, to add to targeting data before firing. This is not a constant and will increase if firing data included an additional delay. Server performance can impact number of ticks per second. So keep in mind the TPS of a server or local game.

Firing checks

Launcher will go through a series of checks to verify sanity of firing mission. This will include things like checking the missile, missile type, fuel, power, and range both min & max. See status codes section for a list of possible checks run and outputs they will give.

Min Range

Launchers check minimal range to keep the launcher from targeting itself. This is done using Manhattan distance with a double precision range of 10 meters (blocks). Any target under this range will be prevented from firing. Range is calculated from the center of the block.

Max Range

Works the same as min range check. Only checks that the target is under a max range of 10km. This can be adjusted in the configs to allow longer distance targeting by launchers.

Status Codes

Following is a list of checks that you might see:

Code Type English Translation Explanation
error.power Error Minimal power check failed, likely not enough to run the machine or power the missile. Most missiles use power as fuel
error.missile.empty Error Launcher detected an empty inventory slot where it expected a missile item to be inserted
error.missile.invalid Error Launcher detected an invalid inventory slot contents. Usually means the item isn't a missile or is missing code implementation to function with the given launcher. Not all items support the launcher and not all mods with missiles will work.
firing.delayed Status Notes that the missile currently has a configured delay before it will launch. Usually outputs the ticks left in the user message
error.target.null Error Launcher is missing targeting data or the targeting data lacks world positional data
error.range.min Error Target is too close to the launcher
error.range.max Error Target is too far for the given missile type
error.spawning Error Failed to spawn the missile into the game world. Usually means an event blocked the entity creation process
launched Status Missile was fired or soon will be fired by the launcher
ready Status Launcher has completed pre-flight checks and considers the launcher ready to fire. Doesn't mean it will... only that it can.
canceled Status Missile was prevented from being fired due to an event or other interaction unrelated to the launcher

As a note error codes are controlled per launcher. Meaning each launcher can have different codes regardless of missiles used. There is some attempt to recycle codes between launchers to better support mod compatibility. Such as with the Computer Craft addon.

Inaccuracy

Inaccuracy is distance and number of missiles launcher in a fire solution. This doesn't need calculated by hand as it shows in the launcher screen. In general firing fewer missiles and short distances ensures best hit on target. Even then distance itself is the lowest impact on inaccuracy. With default max being 10m at 10km. Launchers on the other hand add 1m of inaccuracy for each one added to a firing solution.

< TODO insert chart for default inaccuracy >

Servers and modpacks can change how inaccuracy works. Future version may also rebalance values to better handled mechanics.

Configs

File Name Default Value Usage
max_range 10_000 in meters/blocks as whole numbers, Limit of launcher range
min_inaccuracy_range 2.0 in meters/blocks, inaccuracy added by default before any other calculations
scaled_inaccuracy_range 10.0 in meters/blocks, inaccuracy at max range to apply. Will scale by distance_sq.
scaled_inaccuracy_per_launcher 1.0 in meters/blocks, inaccuracy to apply for each launcher added to a firing solution

Math

Following is the math used as of v5.4.0. See source for actual calculations in case results are inconsistent.

Each launcher pad will run the math on it's own. Meaning launchers will have different inaccuracies if distance between each other is higher. Launcher screens show the highest value detected when firing several missiles at once. Though at higher distances from target this is negligible.

Simple: with 'y' as inaccuracy, 'x' as distance squared(d_sq), 'l' as launcher count, 'M' as max_range, 'A' as distance_scale, 'B' aslauncher scale
y = (x / M^2) * A + l * B

example using defaults:

launcher = [10.5, 50.5, 20.5]
target = [1000.5, 70.5, 1000.5]
delta = launcher - target = [-990, -20, -980]
x = sq(delta) = -980^2 + -20^2 + -980^2 = 980_100 + 400 + 960_400 = 1_940_900 // If this was sqrt it would be 1_393.162 meters

l = (count - 1) = 1 - 1 = 0 // single launcher, l can be ignored
A = 10f // default distance scale
B = 1f // default launcher scale

y = (1_940_900 / 10_000^2) * 10 + 0 * 1
y = (1_940_900 / 100_000_000) * 10
y = 0.019409 * 10
y = 0.19409

Now if we did the above with 10 launchers

y = (1_940_900 / 10_000^2) * 10 + 9 * 1
y = (1_940_900 / 100_000_000) * 10 + 9
y = 0.019409 * 10 + 9
y = 0.19409 + 9
y = 9.19409

Sudo code:

 # static values from config
 min = CONFIG_VALUE("min_inaccuracy_range") default 2
 scale_distance = CONFIG_VALUE("scaled_inaccuracy_range") default 10f
 scale_launchers = CONFIG_VALUE("scaled_inaccuracy_per_launcher") default 1f
 range = CONFIG_VALUE("max_range") default 10km
 
 # calculation of inaccuracy
 inaccuracy = min

 distance = sq delta between target and launcher
 scaled = distance / range^2
 inaccuracy += scaled * scale_distance

 IF launcher_count > 0 then
   inaccuracy += (launcher_count - 1) * scale_launchers 

 # offset, this is computed as an xyz but shown as single line here
 Hit Offset = (inaccuracy * random(0.0, 1.0f)) * randomYawAngle(0.0, 360.0f);

Legacy

Launcher Multi-block

Launcher is comprised of 3 different components; screen, base, and frame. In order to launch a missile at minimal the base and screen need to be setup. To improve accuracy the frame can be included.

Inaccuracy Multi-block

Inaccuracy is based on tier of support frame. By default this is 30 meters without a support, 15 meters for tier 1, 7 meters for tier 2, and 1 meter for tier 3.

Calculation works as a normal distribution. So missiles are more likely to hit near the center than near the edge.

Hit Offset = (inaccuracy * random(0.0, 1.0f)) * randomYawAngle(0.0, 360.0f);

History

  • v5.4.x - Launchers gained the ability to rotate to face different directions. Allowing for missiles to fire sideways and event down
  • v5.x.x - Launchers were reworked to remove multi-block functionality and simplify the launcher to a single block. It still requires an external block to handle targeting but is self contained in all other ways. Allowing other mods and interaction to fire missiles. Without limiting the player to required visual only features such as supports.
Clone this wiki locally