Game Engine Black Book: Wolfenstein 3D
fabiensanglard.net
fabiensanglard.net
https://books.google.com/books/about/Tricks_of_the_Game_prog...
What I never managed to understand was how they managed to get the performance they did out of the hardware. Mine crawled at a miserable 8fps at 640x480 on a 2GHz Core 2 Duo iMac.
Performance is where the magic in this really is! Can't wait for the book.
SDL is great but it’s not in the same league as the hand-rolled & optimized code they used.
Different goals.
Great job tho! That’s not an easy project!
The only extra indirection SDL adds is that you write directly to system memory instead, and then SDL copies that to video memory for you when you swap buffers.
Like the person you're replying to, I've also never seen how copying 640x480 bytes from system memory to video memory can introduce such a bottleneck. What's the bandwidth between the two? 10 Gbps or something?
There must be more to it than SDL overheads.
Then graphics drivers stopped hardware-accelerating 2D graphics(?), and the same game turned into a CPU hog that performed much worse even on much more recent hardware.
This thread is vaguely about the same issue: https://www.reddit.com/r/gamedev/comments/1rpwig/sdl_blit_is...
A. It's terrific to see people really dig into some of these early technical achievements while they're still fresh in our collective memory - limitations tend to inspire creativity, and I think we all like reading about those creative solutions.
B. Modern embedded systems like Cortex-M processors can probably take some design hints from these projects which were developed on/for machines with very limited resources. I was thinking of looking into writing a simple emulator on one, maybe for the [S]NES or an early Gameboy (if anyone knows a good resource...?). It'll be super cool to get an in-depth window into how "3D" was managed without niceties like a programmable shader pipeline. The best that ARM-M chips seem to get is a dedicated memory controller for LCD interfacing, some SIMD operations, 2MB of 'bitband' memory that is rapidly addressable on a bitwise basis, and sometimes a display accelerator for single-cycle pixel operations in higher-end models.
Working around that with a fisheye projection has other issues, like straight lines in 3D ending up curved on the screen, and is a bit more computationally expensive, though not too bad these days. It's free in Wolfenstein-style 2.5D though (although Doom chose not to do it).
and don't miss the explanatory part further down: http://shaunlebron.github.io/visualizing-projections/