Slime was first introduced in Boulder Dash 2, caves E and M. It looks similar to amoeba, although it does not produce any sound.
A boulder or diamond lying on a piece of slime might fall through it, with a certain probability, provided that there is empty space directly below the slime.
A cave setting called ‘slime permeability’ determines the probability that a slime will be activated during a cave scan, meaning that any boulder/diamond will fall through it, if it can.
In BD2 Cave E, slime is used to produce a seemingly “random” rain of boulders and diamonds. Here, the slime permeability is a probability of 0.125 (=1/8 ). It therefore takes some time before all boulders/diamonds have fallen down through the slime.
In BD2 Cave M, the slime permeability is set to a probability of 1, so any boulder/diamond will immediately fall through the slime, as soon as Rockford clears the dirt below a piece of slime. This creates a puzzle where Rockford must prepare his path to the exit through a series of mixed boulder/diamond-columns.
How does the random number generator work for slime?
Every frame, when a slime-item is scanned, a random number between 0 and 255 is drawn. Depending on this number and the slime permeability setting, the slime is activated or not. When it is “active”, any boulder/diamond will fall through provided that there is empty space below the slime. Note that this generation of a random number happens irrespective of whether a boulder/diamond is carried by the slime and it could fall through it. It just happens for each slime which is scanned during a full cave scan. If there are x slimes in a cave, then x numbers are generated during a cave scan.
In the BD2 engine, the random numbers for the slime activation are generated by the same pseudo-random number generator (RNG) as used for filling the cave-map with random items. More info about this random generator here:
https://www.boulder-dash.nl/forum/viewtopic.php?t=647
Note that the first random value for the first slime is generated after the cave filling has taken place. So, the first 21*40 = 840 draws are used for the cave filling, and the 841st draw is used for the first slime in the first frame, and so on. The behavior of slime therefore also depends on the initial seed value of the cave.
In the PLCK engine, there is no random cave filling, yet the same RNG is used, always with initial seed value 30.
Krissz’ site (speaking of September 2021) is compatible with the PLCK engine concerning slime. This implies that the remake-version of a cave like BD2 Cave E on Krissz’ site is NOT compatible with the original (for all 5 levels). That is, the cave and solution are similar, but the exact slime behavior (i.e. the timing of falling boulders/diamonds) is different.
Impermeable slimes - How does this happen?
It is possible that a slime, from a certain moment onwards, no longer swallows any boulder/diamond.
This is visible, for example in BD2 Cave E, when Rockford is killed by a boulder/diamond and 3 pieces of slime are destroyed by the explosion (observed by Dustin).
How does this work?
As explained in the aforementioned tread about the RNG, any random generation consists of a combination of two numbers (seed1 and seed2), where seed1 is used to determine the slime behavior. Seed2 contains a repetitive cycle of 73 numbers. The combination (seed1, seed2) still gets different pair-values, until the 73-pattern has been run for 13 times. So a the RNG has a repetitive cycle of 13*73 = 949 random numbers.
Now suppose that the amount of slimes in a cave is a multiple of either 13 or 73. Then for each slime, a limited set of random numbers will be checked. For instance, when 2*73 = 146 slimes are present, only 13 different numbers will be checked, since after 13 frames there are 13*146 = 1898 slimes scanned, which is then a multiple of 949 for the first time. Possibly, this limited set of 13 random numbers is such that, depending on the slime permeability setting, the slime is never activated. This is what we call an impermeable slime: it never lets a boulder/diamond through!
As an example, in BD2 Cave E, there are 4 rows of 19 slimes present, so the total number of slimes is 76. When Rockford is killed by a boulder/diamond, while standing along the bottom line of slime, this may reduce the amount of slimes with 3, so there are exactly 73 slimes present! When this happens, impermeable slimes become visible.
Note that the numbers 13 and 73 also form the prime factor decomposition of 949. Therefore, impermeable slimes are possible if and only if the number of slimes is a multiple of 13 or 73.
As of September 2021, the Construction Kit at Krissz’ site features the option ‘show impermeable slimes’, which shows which slimes on the cave-map are permeable (marked green) and which are impermeable (marked red) from the start of the cave onwards.
Of course, while playing a cave, it is possible to change the (im)permeability behavior of slime by destroying slimes, thereby changing the total number of slimes in a cave. This way, it is possible to make a permeable slime impermeable, or vice versa. And yes, there are several caves based on this idea, which were recently created at Krissz’ site! I’d like to provide some youtube-links here when I have the videos ready.
This is it for now, feel free to provide any additions or corrections to this topic!
