Crate probability

From Worms Knowledge Base

(Redirected from Crate Probability)
Jump to: navigation, search
(Up to Game logic)
In other languages: English (en) • français (fr) • +/-

The worms games have a large section of their scheme options dedicated to crates and their contents, allowing for quite a large degree of customisability.

Crate Spawns

In Worms Armageddon and Worms World Party, the respective probabilities for each crate type spawning at the start of a turn are shown as values from 0 - 10 in game. You can work out how to determine the true crate probabilities as follows:

Multiply each of these values by 10, then divide each one by the number of crate types which have a non-zero value. This will give you the probability of each crate spawning each turn.

An example:

  • In-game values
  • Weapon crate = 3
  • Health crate = 6
  • Utility crate = 0

Multiply by 10 then divide by 2

  • Probabilities:
  • Weapon crate = 15%
  • Health crate = 30%
  • Utility crate = 0%
  • No crate = 55%

Another example:

  • In-game values
  • Weapon crate = 9
  • Health crate = 4
  • Utility crate = 7

Multiply by 10 then divide by 3

  • Probabilities:
  • Weapon crate = 30%
  • Health crate = 13%
  • Utility crate = 23%
  • No crate = 34%

This means that it is not possible to have more than one type of crate in the scheme where one has a higher chance of spawning than another and have a crate spawn every turn.

In addition, only 5 crates can be present on the landscape at any one time. No more crates will spawn until some of them are removed (collected, destroyed, or sunk).

During Sudden Death, health crates will no longer spawn.

When a crate is spawned in v3.0, 75 locations around the landscape will be randomly chosen to see if there is a place available for it to appear. If no suitable position is found during these attempts, it will not appear. In the Worms Armageddon beta update v3.5 Beta 1, this was changed to a new method which scans every location on the map for a suitable position, in order to allow crates to fall in a crowded terrain. The location in which it will appear must be large enough to fit the crate's collision mask, which is 24x29 pixels large, with a single pixel bevel in each corner. The v3.5 Beta 1 updated algorithm does not account for these bevels and assumes a rectangular shape instead (accounting for the bevels while preserving the algorithm schema would take a disproportionate amount of extra CPU and memory).

Crates will not spawn near other objects (worms, mines, oil drums and other crates). This is determined by checking the area around the potential crate spawn by using a diamond shape with a radius of 64 pixels. If any object is within this area, it will not spawn there. This was inadvertently changed during the v3.5 Beta 1 update (to a square encompassing the original diamond), making crate spawning theoretically twice as picky about nearby objects; this mistake was reverted in v3.6.26.4.

In order to determine which type of crate will fall in a turn, the game uses an array of size 100. Each % chance of a weapon type spawning is added into this array, so the array is filled with values representing "weapon crate", "health crate", "utility crate" and "no crate". The number of times each value appears in the array is equal to the % chance of that type spawning. As crates spawn (or the "no crate" is activated) each turn, one of the appropriate values is removed from the array. When the array is emptied, it is reset. This method guarantees that the correct crates will fall over 100 turns, but it also means that a player could work out which crate is mostly to fall next if he keeps check of these values. It is unknown if this is still affected if a crate cannot possibly spawn.

Crate contents

Health crates

The amount of health provided by a health crate is controlled by the scheme settings. The values available are 25, 50, 100, 150, 200, and 250, but an external editor can set it to any value from 1 to 256.

Utility crates

If a utility is set to have infinite ammunition, the probability that it will appear in a utility crate is set to zero. The probabilities are: fastwalk 20, laser sight 10, double damage 15, invisibility 5 (0 if all players are local), low gravity 10, crate spy 15, jetpack 10, double turn 15, crateshower 5 (total: 105 or 100).

Weapon crates

Through the in-game weapons editor, each weapon can be given an integer value from 0 to 5 which determines the relative probability that that weapon will appear in a crate. The exact probability of a weapon appearing in a crate is given by the quotient of the weapon's value divided by the total of all the weapons' values (for example, if the values assigned to weapons added up to 35, and a particular weapon had a value of 4, then that weapon would have a 4 in 35 chance of appearing in a weapon crate).

An external editor can be used to edit these values with greater versatility (see table, right).

Weapons that have infinite ammunition have zero probability of appearing in crates. If they have been given a non-zero relative probability setting, it is ignored in the calculation described above.

When the "special weapons" option is enabled, these weapons are assigned a value of 1.

The Select Worm weapon always has a value of 0.5 assigned to it. As a consequence, crates will always contain a Select Worm if the relative probabilities for all other weapons are set to zero.

If a weapon is under the effect of a delay setting, it will have zero probability of appearing in a crate until that delay expires.

The contents of the crates spawned by a Crate Shower are completely random, and every weapon has an equal chance of appearing. Even Skip Go and Surrender may appear.


Super Weapons

Super weapons are very strange in that their probability for appearing inside a crate depends upon a large number of factors.

  • Super weapons must be enabled in the scheme options.
  • At least 5 times as many crates containing standard weapons must have spawned than crates containing a super weapon.
  • At least 3 minutes must have passed since the last super weapon appeared.

Once the above 3 conditions are met, a weapon crate will have a 1 in 8 chance of containing a super weapon. The super weapon is chosen randomly from the available ones, and they will not appear if you have infinite amounts of ammo for that weapon.

External Editing of Scheme Files for Altering Crate Probabilities

Scheme files can be externally edited in order to have more control over the crate probabilities.

Each of the crate spawn values are assigned byte values of 10, so a value of 3 in-game would be a value of 30 inside the scheme file. It is possible to raise the values above 100, up to a maximum of 127. Any values higher than this can cause the game to crash. After adding up the values and dividing them by the number of non-zero entries, it is possible to have the total probability over 100%. If this occurs, the extra probability is removed from the utility crates, followed by the health crates if the utility crate value is zero.

For example:

 scheme:
 Weapon Crate = 127%
 Health Crate = 127%
 Utility Crate = 127%

Each one is divided by 3:

 Weapon Crate = 42%
 Health Crate = 42%
 Utility Crate = 42%

But, 42+42+42=126, which is greater than 100. So what actually happens is this:

 result:
 Weapon Crate = 42%
 Health Crate = 42%
 Utility Crate = 16% (100-42-42=16)
 No Crate = 0%
Personal tools