I just wanted to give an extra call out to this lecture in particular. It took me a bit to wrap my head around initially, but after studying the code and re-watching this particular lecture again it is much clearer to me now. Absolutely brilliant explanation.
As an interesting side note, the ‘replay’ method described in this section seems very similar to the algorithm employed in the GGPO system which is designed for arcade/fighting games. Instead of simulating physics the system tries to predict move sequences and then replays them once the actual input data arrives.