Difference between revisions of "Crate probability"

From Worms Knowledge Base

Jump to: navigation, search
(*Phew* That should be everything. It certainly took a while.)
 
m (Added info about the 100 size array and externally editing scheme files)
Line 19: Line 19:
  
 
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. This was briefly changed during the v3.5 Beta 1 update mentioned above, but was reverted back again by v3.6.26.4
 
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. This was briefly changed during the v3.5 Beta 1 update mentioned above, but was reverted back again by v3.6.26.4
 +
 +
In order to determine which 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==
 
==Crate Contents==
Line 41: Line 43:
  
 
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.
 
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%

Revision as of 13:51, 3 May 2007

(Up to Game logic)

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. When only 1 type of crate has a value larger than 0, this value is multiplied by 10 to give the % chance of that crate spawning at the start of a turn. So a value of 3 will result in a 30% chance of a crate spawning.

When 2 crates have a value greater than 0, then their respective values are multiplied by 5 to give the % chance of that crate type spawning at the start of a turn. So if one has a value of 4, and another a value of 5, then the first will have a 20% chance of spawning, and the other a 25% chance of spawning. This gives a total chance of 45% that a crate will spawn that turn.

Similarly, when all 3 crate types have non-zero values, those probabilities are multiplied by 3.3 to give the % chance of that crate type spawning. So values of 4, 5 and 8 give respective probabilities of 13.2%, 16.5% and 26.4%, with a 56.1% total chance of a crate spawning that turn.

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, 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 update algorithm does not allow for these bevels and assumes a rectangular shape instead.

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. This was briefly changed during the v3.5 Beta 1 update mentioned above, but was reverted back again by v3.6.26.4

In order to determine which 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

The amount of health inside a health crate depends upon it's value in the scheme settings. This can be altered externally to any value between 1 and 256.

The chance of a particular utility appearing inside a utility crate is equal for each utility. So they usually all have a 1 in 9 chance of appearing. When one of the 5 collectable utilities is given infinite ammo, it can no longer appear in a utility crate, and so the chance of theother utilities appear is increased to compensate. This is the only way to prevent certain utilities appearing inside a utility crate.

Each weapon can be given a value between 0 and 5 ingame which determines the probabiltiy that a weapon will fall. All of these values are added up, and then each weapon has it's value divided by the total in order to determine it's probability. So if in total 35 "values" were assigned to weapons, and a particular weapon had a value of 4, then it would have a 4 in 35 chance of appearing in a weapon crate. Weapons that have infinite ammo have their values ignored. When the scheme option for each team to use it's own special weapon is enabled, these weapons are assigned a value of 1. Also, weapons will not appear if they are not available due to the delay settings of that weapon.

In addition to the above, the Select Worm weapon always has a respective value of 0.5 assigned to it, which messes up the calculations somewhat. This means that if weapon crates are assigned to spawn, and no normal weapon can appear, then the crate will contain a Select Worm instead.

The contents of the crates spawned by a crate shower are completely random, and each weapon has an equal chance of appearing, regardlees of whether or not you have infinite ammo. 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