In this tool-assisted education video I walk through the creation of a Duke Nukem 3D style (or Doom-style) software-rendering pseudo-3D engine from scratch. It supports non-Euclidean geometry. Topics such as vector rotation and portal rendering are at the core. SUBTITLES ARE AVAILABLE.
Patreon: https://patreon.com/Bisqwit (alternatives at https://iki.fi/bisqwit/donate.html)
Contribute subtitles: https://www.youtube.com/timedtext_video?vHQYsFshbkYw or: https://www.youtube.com/timedtext_cs_panel?c=UCKTehwyGCKF-b2wo0RKwrcg&tab=2
This homebrew software-rendering pseudo-3D engine bears many similarities to Duke Nukem 3D. The geometry can be tweaked at run time without performance penalties, to create things like ceiling crushers or rotating doors.
For rendering, it only supports single-color floors, walls and ceilings, with optional depth shading. Unlike Duke3D, it also requires that each sector is convex.
So far this engine does not support objects or sprites. It also does not support sloped surfaces or parallax ceilings.
SUPPORT / INSTRUCTIONS:
The C program must be compiled with a C compiler supporting the C99 standard. If you attempt to compile it as C++, errors will be produced. If you attempt to compile it on a C89 compiler, errors will be produced. You must compile it as C using C99 standard or newer (on GCC, use the commandline option: -std=c99 or -std=c11).
You also need libSDL 1.2. SDL 2.0 will not work. Add the options printed by pkg-config sdl --libs --cflags into your compiler commandline.
The BASIC program is ideally run in QBASIC or QuickBASIC 4.5. It will not work in QB64 without modifications, because QB64 does not support DEF FN. It will not work in GW-BASIC, because of the structural programming statements.
Music credits in order of appearance:
- Lunar: Silver Star Story - Lunar Traffic theme (Noriyuki Iwadare)
- Axelay - SPIDERS (Taro Kudou)
- Tales of Phantasia - Final Act (Motoi Sakuraba and Shinji Tamura)
- Tales of Phantasia - Ridge Racer (Shinji Hosoe)
All these video game songs have been transformed into OPL3 songs with homebrew tools and played through ADLMIDI.
Sorry about the fluctuating narration volume. I recorded pretty much every sentence separately over many days, and my microphone was positioned differently at different times, and sometimes it was day, sometimes night, sometimes I had morning voice, etc. I tried to compensate with both manual volume adjustment as well as running a compression filter over it all, but it was only after publication when I noticed how uneven it still is.
My typical workflow for recording the narration involves the following:
1. Watching some of the video
2. Writing into a text file what I would like to say (this file will also form the basis of closed-captioning later). Much of the text comes from the directing script that I wrote before I even began any video recording.
3. Speaking that dialog and recording using Audacity. I honestly try to speak as naturally as possible. If I stutter or mispronounce some part, as happens many _many_ MANY times with English (that whole language is a frigging tongue twister to me), I simply repeat the sentence or part of a sentence as many times as necessary until I get it right. Then I listen to it, and delete the flubbed parts until I have the best takes for that text. Typically this involves about two minutes of recording for every 40 seconds of narration. Sometimes I leave a particularly difficult part in out of spite even if it doesn't sound fluent. Unfortunately having to do the recording in this manner tends to kill natural prosody. I do not use voice synthesizers for reference.
4. If the dialog is shorter or longer than the section of video I was planning this to be narration over, adjust something. From here the editing may branch anywhere, including things like changing the text, or adjusting the playback speed/length/order for clips, or even changing the source code (which requires a new round of video recording).
5. Go ahead in the video with step 1
For the record, my native language is Finnish. It has a small set of phonemes similar to Spanish or ancient Greek, and a similar rhythm of vowels/consonants as Japanese. This background is quite a disadvantage for speaking English, considering that a person's ability to distinguish and to reproduce a language's defining traits, such as phonemes, rhythm, accent and intonation, is mostly determined by the languages they are exposed to as a toddler.
So, if my bad accent disturbs your harmony, I urge you to disable the sound and use the closed captions instead.