Crates.io | mc_sim |
lib.rs | mc_sim |
version | 0.1.0 |
source | src |
created_at | 2020-12-30 20:39:26.592433 |
updated_at | 2020-12-30 20:39:26.592433 |
description | A simulator for minecraft speed runs, as that pertains to the Dream cheating scandal. |
homepage | |
repository | https://github.com/alexei-b/mc_sim |
max_upload_size | |
id | 329394 |
size | 100,562 |
This library offers some basic tools for simulating the elements of Minecraft speed runs.
Specifically, Java edition 1.16.1 blaze fights and piglin barters.
The goal of this library is to help investigate the statistics of blaze fights and piglin barters
with respect to Dream's cheated 1.16.1 runs.
For more information, please read the paper.
I am not part of the Minecraft mod team, and they have not asked for, reviewed, or signed off on this code.
I have written this specifically out of my own interest and desire to verify or rebut their report.
I came at this with no expectation of the result, however, you can tell by the language above what my findings were.
You can use cargo-edit
to add the library from crates.io:
cargo add mc_sim
I recommend cloning this repo and running the examples to see the results for yourself.
# This example creates a CSV file that has both simulated blaze rod drops, as well as
# the expected blaze rod distribution so that they can be compared.
cargo run --release --example blaze_rod_distribution
# This example creates a CSV file that has both simulated barters, as well as
# the expected ender pearl distribution so that they can be compared.
cargo run --release --example ender_pearl_distribution
# -t can be used to set the thread count.
# -c can be used to set the target number of cycles.
# E.G: 32 threads for 1,000,000,000 cycles.
cargo run --release --example blaze_rod_distribution -- -t 32 -c 1000000000
# You can also pass --help for a print out of options.
cargo run --release --example simulate_streams_til_dreams -- --help
# This example attempts to simulate runs until you get as lucky as dream.
#
# This is not the fastest simulator, because it's designed for answering
# questions on statistics, modelling, and accuracy. There are faster simulators
# out there that take advantage of GPGPU to get tens of millions of simulations
# per second.
#
# However, Dream's cheating means that the luck you are going after is unachievable
# anyway, so this is not expected to terminate in a reasonable period of time.
# Good luck!
cargo run --release --example simulate_streams_til_dreams
The simulation in this library is based on the decompiled Minecraft code, using MCP Reborn.
I decompiled the code myself and came up with my own implementation, that is independent of
any other previous analysis. Drops are all uniform random with exactly the same odds as in Minecraft.
The distributions in this library are based on my best understanding of the statistics involved.
I am not a statistician and I don't have a relevant education. However, the paper provided a good
basis for creating these and the Minecraft speed running Discord has been very helpful in answering
my stats questions.
The purpose of these distributions is to compare how our expectations and modeling of minecraft stats
lines up with the simulated results. They are also used to quantify how lucky a run is during simulation.
100,000,000 samples, showing how the model and the simulator produce very similar results.
In blue are the samples from the simulator, in orange is the statistical model.
BlazeRodDistribution
uses a negative binomial that works over successful blaze fights out of total fights.
Specifically: n = Tr
-- p = 1 / 2
Where:
n
is the number of successes expected by the negative binomial distribution.p
is the probability of a successful fight (a fight that drops a blaze rod).Tr
is the target number of blaze rods that are required for all the runs in the simulation.1 / 2
is the odds of a blaze dropping a blaze rod.This distribution works with any configuration of target rods per run in the simulation with no appreciable
difference to large amounts of sampled data. This distribution produces exactly the same result as the
distribution used in the paper when fed the data from Dream's runs.
100,000,000 samples, showing how the model and the simulator produce very similar results.
In blue are the samples from the simulator, in orange is the statistical model.
EnderPearlDistribution
uses a negative binomial that works over successful barters out of the total barters.
Specifically: n = Tp / Rp * Mp
-- p = 20 / 423
Where:
n
is the number of successes expected by the negative binomial distribution.p
is the probability of a successful barter (a barter that drops pearls).Tp
is the total number of pearls required within the simulation that the distribution is being used for.Rp
is the number of pearls required per run within the simulation.Mp
is the average number of barters required to get to Rp
.20 / 423
is the odds of a barter dropping ender pearls in 1.16.1, verified from the minecraft jar data.The ender pearl distribution only works in the case where each run has the same target. This means that
it does not align well when you ask it to model simulations of runs with different target pearl counts.
This limitation means that the ender pearl distribution used does not produce the same result as the paper.
The paper worked over successful barters out of total barters, which is considerably easier to model.
Ultimately, I haven't done any better here. Indeed, this is a much less precise model for answering the
question of "how lucky did Dream get?"
This model is considerably more Dream favoured for two reasons:
Odds of Dream's blaze luck as per this model: 8.791412042796765e-12
Odds of Dream's ender pearl luck as per this model: 6.713608557973316e-10
This library is provided under the wtfpl, or MIT, or Apache 2.0.
Take your pick, see: LICENSE-WTFPL, LICENSE-MIT, and LICENSE-APACHE.