9 ms·
> the more red pixels you have on the screen already, the less likely is that you hit a new yet-not-red pixel, so the final pixels take forever to turn red Thi
by psyklic 9y ago
> the more red pixels you have on the screen already, the less likely is that you hit a new yet-not-red pixel, so the final pixels take forever to turn red
This would be true when using the built-in random number generator, modding the result to a pixel on the screen.
However, this is not how the "maximum-length" LFSR proposed in the original article works. It visits each pixel exactly once, and turns the screen completely red in a deterministic amount of time. (Just see the screenshot here: http://fabiensanglard.net/fizzlefade/die.gif http://fabiensanglard.net/fizzlefade/die.gif)
This behavior is indicated from the stopping condition in the Wolf3D asm code alone -- the seed starts at 1. It terminates when the random number returns to 1, completing the cycle through the number space.
- Vendan 9y ago> You may wonder why the original code used a LFSR or why I'm proposing a different approach, instead of the vanilla setPixel(rand(),rand()): doing this with a pseudo random generator, as noted in the blog post, is slow He was pointing out that the naive method is slow, not saying that that's how Wolfenstein 3D did it, and quite clearly stated that the original code used an LFSR