Question
I've seen images of charged creepers but I would like to know what the chances are of just stumbling upon one. Or how often you would find one if you were looking for one.
Answer
This is not easily answerable and depends on a number of factors.
Firstly, I'm going to assume that you're playing unmodded, vanilla, single-player Minecraft. It doesn't matter if you're playing in creative or survival mode. I'm also going to assume a 90 degree FOV and normal render distance, just to make the numbers easier. If you increase or decrease either, the chances of seeing a charged creeper will increase or decrease as well.
Then, there are the requirements:
- You must be playing on Easy or higher.
- Creepers must have spawned (i.e., at least one night cycle must have started where creepers spawned)
- The creepers must be on the surface (lightning can't strike underground)
- At least one rain cycle must have started after creepers have spawned.
If any of these conditions aren't met, the chance of encountering a charged creeper is zero.
So assuming the conditions are met, let's look at the probabilities.
One creeper, one chunk
Creepers, like all mobs, immediately despawn if they leave a 128-block radius area centered around the player. So if there's a creeper around, it's somewhere in that area.
Now, if you deobfuscate Minecraft 1.2.5 using MCP 6.2, World::tickBlocksAndAmbiance()
indicates Lightning has a 1:100,000 chance of hitting one block in any specific chunk. And if lightning does hit a specific chunk, the game randomly selects one block within that chunk to get the lightning entity.
A chunk contains 162 (or 256) blocks so given any specific block, there's a 1:25,600,000 chance of a lightning strike. Since creepers only take up one block and—once spawned—have no block restrictions, there's a 1:25,600,000 chance of a creeper getting charged.
One creeper, all loaded chunks
Since lightning is calculated independently per chunk, we need to account for all loaded chunks. At a normal render distance, a radius of 16 chunks are loaded, for a total of 206. Given the probability of a chunk getting hit by lightning is 1:100,000, that means the probability of at least one chunk getting hit by lightning is 1:485. Multiply that by the chance the creeper is in that chunk (1:206) and the block the creeper is on is hit (1:256), the probability of the creeper being hit by lightning is 1:25,626,249.
One creeper, all chunks, over time
This is only after one lightning strike, and lightning strikes are calculated once per tick. A tick is 1/20 a second, and according to World::updateWeather()
, lightning storms can last for 3,600–15,600 ticks or 3–13 minutes.
So, over time, the probability of that creeper getting struck by lightning is 1:7,118 at 3 minutes and 1:1,643 at 13 minutes.
Encountering the charged creeper
But you want to know what the chances are of encountering a charged creeper are, not the chances of whether one will exist. Since encounter can mean a lot of things, I'm going to use the most liberal definition, which is seeing a charged creeper. At a normal render distance, you can see 128 blocks out, which corresponds nicely to the allowable radius of the creeper. And at a 90 degree FOV, you should be able to see 1/4 of the possible render area. If a creeper is on the surface, you have a 1/4 chance of actually looking in the right direction to see said creeper.
It's way too complex to try and figure out what happens if the creeper moves and you move or you're not looking in the right direction, so I'm going to ignore that and assume you and the creeper aren't moving, but you're actively looking for it by rotating your field of view 360 degrees. Thus, the probability of encountering a charged creeper should be the same as the creeper existing.
More creepers, more fun
Now, if there are more creepers on the field, you have a better chance of finding a charged creeper. There are way too many different combinations and scenarios to list out, but here are two idealized scenarios:
There's a creeper in every block. After one tick, the chances of finding a charged creeper is 1:485. After 3,600 ticks, there's a ~99.93% chance of encountering a charged creeper. After 15,600 sicks, the probability is effectively 100%.
There's exactly one creeper in every chunk. After one tick, the chances of finding a charged creeper is 1:124,399. After 3,600 ticks, it's 1:35. After 15,600 ticks, it's 1:8.5.
Check more discussion of this question.
No comments:
Post a Comment