4 ms·
Stupid question: Why can't you just take an array of all the pixels, randomize it and then iterate it to draw?
by Kiro 9y ago
Stupid question: Why can't you just take an array of all the pixels, randomize it and then iterate it to draw?
- bkanber 9y agoThis was written in assembly and to do that you'd have to make a new register of all the references while randomizing. Your approach works great in modern, high level languages where there's no issue copying an array in memory and calling array_shuffle or something, and doubling the memory requirement for the effect is no problem. This approach however seems to only require 17 bits of additional memory.
- bombela 9y agobecause this would take a huge amount of memory. something like xy(sizeof x + sizeof y). not only memory wasn't available cheaply at the time. it would be slow to generate, write to memory, then fetch back to draw.
- gall_anonim 9y agoBecause with ideal packing it would take 150 kB (320·240·log2(320·240)/8). Wolf3d needed 640 kB of RAM and using quarter of it just to display death animation wouldn't be a good idea.
- et1337 9y ago1) That's a lot of memory 2) Accessing memory is the slowest thing you can possibly do on a computer, other than IO