My Authors
Read all threads
The DooM-chip! It will run E1M1 till the end of times (or till power runs out, whichever comes first).
Algorithm is burned into wires, LUTs and flip-flops on an #FPGA: no CPU, no opcodes, no instruction counter.
Running on Altera CycloneV + SDRAM. (1/n)
Everything is described in a language I am working on: SDRAM controller, divider, BSP traversal, texture unit, etc.
Main renderer (w/o data) is 666 lines of code (!).
A great test case, made quite a few improvements, fixed some issues, learned a lot on CycloneV + Quartus.
(2/n)
Rendering uses the original BSP tree (of course!) but is modified to better fit a hardware implementation ; columns are raycast and drawn immediately front-to-back, stopping as soon as fully filled.
(3/n)

fabiensanglard.net/doomIphone/doo…
A nice property is that a column always grows from top and bottom towards its middle when drawn during front-to-back BSP traversal, until an opaque wall is reached.
(4/n)
Used several sources of information ; the excellent Doom black book by @fabynou (where I learned the colormap trick for lighting - so elegant!!), the Unofficial Doom Specs v1.666, and of course the original source code:
github.com/id-Software/DO…
(5/n)
Uses true game data ; the Lua preprocessor extracts the data from the Doom WAD during compilation, and writes tables and hardware for the level.
(6/n)
Getting floor and ceiling texturing right was not so simple, as the computations differ from walls. Here is a debug view of color coded distance from viewer, ensuring computations match for both.
(7/n)
Many things to improve + optimize: parallelize columns, hide latency between drawing, texture mapping and BSP traversal. Some textures misaligned, some glitches to fix (below: debug in progress). Also runs at 320x200 60Hz instead of 70Hz! (sorry @fabynou, not fixed yet!)
(8/n)
Doom was released as I was learning how to code graphics. It was, and remains, an immense inspiration and motivation boost. I spent countless hours making levels, hacking the game and hex dumps of doom.exe / doom.wad. This was a good opportunity to dive back into it!
(9/n)
Missing some Tweet in this thread? You can try to force a refresh.

Enjoying this thread?

Keep Current with Sylvain Lefebvre

Profile picture

Stay in touch and get notified when new unrolls are available from this author!

Read all threads

This Thread may be Removed Anytime!

Twitter may remove this content at anytime, convert it as a PDF, save and print for later use!

Try unrolling a thread yourself!

how to unroll video

1) Follow Thread Reader App on Twitter so you can easily mention us!

2) Go to a Twitter thread (series of Tweets by the same owner) and mention us with a keyword "unroll" @threadreaderapp unroll

You can practice here first or read more on our help page!

Follow Us on Twitter!

Did Thread Reader help you today?

Support us! We are indie developers!


This site is made by just two indie developers on a laptop doing marketing, support and development! Read more about the story.

Become a Premium Member ($3.00/month or $30.00/year) and get exclusive features!

Become Premium

Too expensive? Make a small donation by buying us coffee ($5) or help with server cost ($10)

Donate via Paypal Become our Patreon

Thank you for your support!