The Sun and The Air

Speedrunning - A Matter of Time

In speedrunning, there's a common routine where the runner is focused less on improving skill and consistency and more on beating the Law of Large Numbers.

At times it can feel like the payoff of "more practice" is just less than the benefit of "just do some runs." When does that happen, and when it does what does it look like?

If a perfect run of a hypothetical game is 58 minutes, and I have a 50% chance of losing 5s every minute, how long will it take to get a sub-1-hour time? I think the answer is "about 20-25 attempts."1 Do be aware that it's been decades since I've had to do this kind of calculation, so I might be getting something wrong, but the overall ratios should be correct.

This is a gross oversimplification of a model of course - very rarely does a run have nice evenly distributed coin-flip risks - but it's a good model to demonstrate some principles.

The maths on this are really rough, as it's all about expectation and likelihoods. The specifics aren't the focus of this post, but the general idea is that while we're absolutely trying to roll good dice with random elements in any game we play, we're also rolling dice against our own ability to maintain pace. I've included some of the maths in the aside above, but the main thing to understand is that we have a couple of parameters to work with:

  1. Probability of losing time
  2. Amount of time lost
  3. Number of times we risk losing time
  4. Just go faster lol

The goal of practice and preparation is to improve these factors as much as possible, but how much impact do they have?

  1. If our probability is 45%, we reduce the expected runs to 11 attempts. If it goes up to 55% chance of error the expected runs is 82.
  2. If instead of 5s we lose 4.5s each time, we can afford a couple of extra errors per run and this means our expected runs is again around 11. If we lose 5.5s per mistake, we'd expect it to take around 51 runs.
  3. Suppose we manage to reduce our opportunities for error to 55 from 58 - this reduces the number of expected runs to around 14. Increasing it to 60 moves the expected attempts to around 32.
  4. Suppose we can go fast enough that the "perfect" time is actually a little quicker, a 57:30 - this reduces the expected runs to 10. Going slower such that a perfect run is merely 58:15 yields an expected attempt count of 86.

Every attempt takes some amount of time, and not all will last the full duration. I'm not going to model this fully, I'm just going to estimate based on experience that runs tend to end early, and say that an "average" run is about 1/4 the length of the full thing - not because a run becomes mathematically unrecoverable in the first quarter on average, but because it become statistically unrecoverable to an experienced eye.

With that, we can say that each run is costing about 15 minutes, so in some cases we're describing the difference between a grind on the order of 2-3 hours vs one lasting 10+ hours. And this is with a very forgiving set of parameters! But it illustrates a key fact of speedrunning - time spent learning, reducing variance, and increasing speed is rewarded with a shorter grind.

Oftentimes, the time spent practicing and improving these parameters is worth more than the grind itself - 2 hours of practising a new trick to get a new PB 6 hours earlier.

But what do you do when you have no risk left to reduce? You're as consistent as you'll ever be at every trick, you can't apply any faster strategies, and you've cut all the risky tricks that you can without losing time.

Suppose those lower-case parameters (45% chance of losing time, 4.5s loss on a mistake, 55 chances for error, perfect pace of 57:30) are the collective best you can do, but your target has evolved - now you're aiming for a target of sub-59? With all those advantages, you'd expect to get it within roughty 5 hours of grinding.

Buoyed on by this success, you aim further - a 58:30. Surely it won't be too hard - surely a mere 7 fewer errors won't take too much longer than that?

It would take over 30 times longer. This is what happens when you try to beat the Law of Large Numbers. This is why people will spend hundreds of hours streaming attempts, relentless grinding to a new target time. It's because while 180 hours is a long time, it's not impossible. 1 in 726 is a small chance, but it's not zero, and if you can just keep throwing attempts at it then it just becomes a matter of time.

Eventually, if you just flip enough coins, you'll get enough Heads to beat the odds.


Addendum

The reality of speedrunning is that we don't have these numbers. We don't have precise figures for how likely a given trick is to fail, a simple binary "lost 0 or 5s on it", or the exact number of places we might fail. Any part of a run risks a mistake or random time loss.

What I've described above is a sort of thesis on time-efficiency in a hobby known for an extreme lack thereof, but I am interested in applying it to something more concrete, more personal to myself.

The thing that spurred this post was my recent 35 hour grind to improve the WR on a 35s speedrun by less than a second.

While that grind started because I was playing casually and got a run within 0.1s of WR without trying very hard, and felt improving the record must be easy - which it kind of was. Within a few days I took 0.08 off it using new faster-but-riskier strategies, but with the "perfect" pace now improved I found myself staring down the Law of Large Numbers.

A grind like that includes a lot of idle thinking while going through the motions of the early game, and with such a short run you can really feel the probabilities at play.

In the end I got a run 0.64s faster than the starting WR, imperfect but good enough for now.

A 35 hour grind on a 35s level is around 12000 attempts if an average attempt lasts about 10 seconds - I want to make some estimates and model this run to see if I can spot some "easy" ways to make improvement happen sooner, as I don't really fancy a hundred hour grind for 34.xx.

  1. With a uniform 50% per minute then you expect to lose 58*0.5*5 = 145s on an average run - you'd need to lose <120s to get a sub-hour. A run which loses less than 120s has to lose 24 or less of the 58 coinflips - for this toy example it's a simple binomial distribution thing where the calculation is:

    (nk)pk(1p)nk

    Where here n=58, k = 244, p=0.5, and the bracket notation is "n choose k," a probability function that gets really big when k is close to n/2 and n is large. The result of this calculation here is about 4.4%, so the expected value of "number of attempts to get sub-1-hour" is 1/0.044 or about 22 attempts.

#blog #speedrunning