Meteor Defence

From Space Exploration
Jump to navigation Jump to search

First, about Meteors[edit]

The game will spawn a meteor shower every 1-30 minutes for every world you have mapped. You can tweak this to 1-2880 minutes in the mod settings. Meteors will pass through orbit first; any meteors that do not hit an object in orbit (or are shot down while approaching orbit) will reach the surface about half a minute later. Before they reach orbit, and again before they reach the surface, the game will check if there are any applicable defenses, and allow each of them to fire one after the other, until either all meteors are destroyed or there are no more guns ready to fire. Only then will the remaining meteors even appear. At this moment, you will receive a notification with map coordinates: if you click it quickly enough, you can watch the meteors fall.

Meteors cause damage where they fall, including some splash damage for a few tiles around. Direct hits can take out warehouses and nuclear reactors.

Meteors are somewhat biased to hit your factory; still, you can expect most of them to fall somewhere in the countryside where it don't matter.

Meteor Defenses[edit]

All meteor defenses need ammunition and power. They need to charge up before they can fire. While charging the energy requirement is increased. When fully charged there is a passive power draw to keep it ready. Meteor defenses show "Disabled by script" until a meteor enters their range, only then will they become active.

The Meteor Point Defense will charge power for four rounds that can be fired in quick succession, each with a 50% chance to intercept a meteor. It has a limited area of coverage that extends for 64 tiles around the cannon. This means that you will need to place several, potentially many, in order to cover your whole factory. The upside is that they won't waste ammunition on meteors that fall somewhere in the wilderness. As a matter of fact, the chances for a meteor to fall in the area of any individual point defense are so small, you can expect a stack of ammunition to be good for days.

The Point Defense can be toggled to quick-firing mode, visibly changing it's color. In that mode, it will recharge so quickly that it can keep firing, until it either runs out of targets, out of ammo, or out of power. A well-provisioned point defense provides perfect safety within it's area of coverage. While the nominal power requirement is 10GW, a mere 1.5GW will suffice to sustain quick firing.

Meteor Defense Installations will each only have one shot ready, but with an 80% to hit chance. They have unlimited range, covering the entire world and it's orbit too. It doesn't matter whether you place them on the surface or in orbit, they will cover both either way. They will try to intercept every incoming meteor, regardless of whether it would damage your installations or not. If you have enough guns to shoot down virtually every incoming meteor, you can expect to consume about 10 rounds per hour (on default meteor frequency). Meteor Defense Installations are very power hungry, with a 5MW passive draw and 20MW when charging. It takes them about 133 seconds to recharge, while the minimum interval between two meteor showers is a mere 60 seconds: So every once in a while, the next meteor shower will arrive before they have recovered their strength.

There is no Perfect Safety[edit]

Meteor showers can be very large. 30 meteors in one shower are incredibly rare, but possible. In the same vein, all of your defenses may miss. The odds of this happening my be astronomically low, but they are not zero. So, no matter how many defenses you build, there always will be some residual risk of a meteor getting through despite your efforts.

With this understanding, the question now becomes: how many defenses do you need to build to feel reasonably safe?

Installation Confidence[edit]

Since there is a geometrically-decreasing chance of large meteor showers, installation effectiveness also drops off. However, since each installation does not have a guaranteed hit a certain buffer is sensible. To this end, here is a table that shows how confident you can be that a given number of installations will COMPLETELY block all meteors in a shower.


Meteor advanced[edit]

The below are for calculations of meteor time interval and meteor defence installations.

Meteor Shower Frequency[edit]

A meteor shower spawns after a timer with a random duration expires. The timer is reset each time there is a meteor shower. The timer duration is a random number between 1 and whatever the meteor frequency mod setting is (defaults to 30).

The random time between showers means you can't always be sure that your defences will be recharged before the next one. Although it can be good to have backup defences you need to factor that risk against the constant power draw.

Currently all (occupied) surfaces have meteor showers simultaneously, but this is planned to change.

Meteor Count[edit]

The number of meteors is geometrically distributed with parameter 50%, so you have a 50% chance for 1 meteor, 25% for 2 and so on.

The probabilities for each number of meteors are:

  1. 50%
  2. 25%
  3. 12.5%
  4. 6.25%
  5. 3.125%
  6. 1.5625%
  7. 0.78125%
  8. 0.390625%
  9. 0.1953125%
  10. 0.09765625%
  • The probability of getting 11 or more meteors is 0.09765625% = (1 - 0.5)10


Percent of meteor showers completely destroyed by installations
Installation Count % Meteor showers eliminated
1 40%
2 64%
3 78.4%
4 87%
5 92.22%
6 95.33%
7 97.2%
8 98.32%
9 98.99%
10 99.4%
11 99.64%
12 99.78%
13 99.87%
14 99.92%
15 99.95%
16 99.97%
17 99.98%
18 99.99%
19 99.99%
20 ~100%

Python code[edit]

from scipy.special import comb

installations = list(range(1, 21))

print("Installation Count\tDefense Chance")
print("========================================")

for installation in installations:
    # Can defend against up to "installation" meteors, after that chance is zero
    possible_meteors = list(range(1, installation + 1))

    # Defense chance is all the ways the given number of installations
    # can destroy up to the given number of meteors
    # Since meteor count is strictly equal to or less than the number of installations,
    # if there are excess meteors those will get through, so this will never return 100%
    defense_chance = 0
    for meteor in possible_meteors:
        # Chance of this many meteors is 50% per meteor, geometrically
        meteor_swarm_chance = 0.5 ** meteor
        # Installation hits must cover at least the number of meteors, up to the maximum
        # of "installation" available - this assumes each installation can destroy at most one meteor
        hits = list(range(meteor, installation + 1))
        for hit in hits:
            # How many ways can this many installations have this many hits,
            # assuming at most one meteor hit per installation (binomial coefficient)
            combinations = comb(installation, hit)
            # Chance of successful defense is chance of this many meteors times
            # count of ways to have enough installations hit a meteor, while the rest miss
            #print(f"Installations: {installation} with {hit} hits has combinations {combinations}, given {meteor} meteor(s) with swarm chance {meteor_swarm_chance}")
            #print(round(100 * meteor_swarm_chance * combinations * (0.8 ** hit) * (0.2 ** (installation - hit)), 2))
            defense_chance += meteor_swarm_chance * combinations * (0.8 ** hit) * (0.2 ** (installation - hit))
    print(f"{installation}\t\t\t{round(defense_chance * 100, 2)}%")

Explanation[edit]

The chance for a given number of installations to destroy some number of meteors is given by:

Sum of (chance of meteors) x (chance of all meteors being destroyed), for any number of meteors up to the number of installations present

Variables:
- I = number of installations
- M = number of meteors
- H = number of hits (can exceed number of meteors, but not number of installations)

The chance for all meteors being destroyed is equal to summing the following:
For M = 1 to I meteors in the storm
    For H = M to I hits on the meteors
        (chance of meteors) * (# ways can we have H hits on I installations) * (chance to hit) * (chance of misses)

Reasoning/details:

M = 1 to I:
Since each installation can only shoot down one meteor, the probability of completely destroying meteors beyond I is 0

H = M to I:
All meteors are required to be destroyed, so the lowest possible hits is equal to the number of meteors
Since mathematically every installation has a chance of hitting even though the meteors are already destroyed, the maximum is the number of installations
This is required for the binomial distribution to evaluate correctly even though it doesn't make "real-world sense"; if you have three coins and want two heads, statistically you can't ignore the third result just because the first two came up heads.

Chance of meteors    = 0.5^M (as explained above)
# ways to get H hits = I choose H - binomial coefficient
                       E.g. 3 installations, two meteors + two hits could result in 3 ways those two meteors are shot down
                       3 choose 2 = [1 2] [2 3] [1 3]
                      (Since hits are summed from M to I, in the possibility all 3 installations hit the two meteors is also included)
Chance to hit        = 80%^H
Chance of misses     = 80%^(I-H)