Creating a Doom-style 3D engine in C

preview_player
Показать описание
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.

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.

DOWNLOAD MATERIAL:

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.
Рекомендации по теме
Комментарии
Автор

For other humbled programmers that just watched this: "I designed and tested this program very carefully for days before I began recording the video, in order to avoid consuming video-time in debugging and in other uninteresting activities. Within the video, I just retrace the steps of creating the program in a natural and a structural manner, with mistakes mostly removed." - From a FAQ on one of his other videos. I'm still impressed, but I feel a lot less terrible about my own coding speed now. ;)

nthexwn
Автор

Bisqwit : Hello how's life?
Me : It's absolutlry terii-
Bisqwit : ah thats nice

blitzer
Автор

A reminder to everyone! If you post questions as comments to my YouTube videos, please make sure you have permitted replies to your comments. Otherwise you'll be an equine. The relevant privacy option is probably found somewhere within the Google+-YouTube frankenstein abomination monster.

Bisqwit
Автор

This level of programing is just magic to me but I absolutely love seeing someone understanding it and being so passionate about it.

hrnekbezucha
Автор

This channel is a very non-traditional channel and I have never seen anything quite like this. I like it. ;)

TheMarioFiles
Автор

so this black magic is just linear algebra right?

LBC_squared
Автор

you are like the bob ross of programing.

chava
Автор

"It seems to work right until it doesn't work right."
Perfect.

brendankehoe
Автор

I found this to be immensely humorous and informative. I could watch videos like this all day long. Keep it up.

"I have no idea why it works, but it does and that's the important thing."

schetle
Автор

It's funny how that guy recreated the evolution of almost 30 years of graphic programming and 3D rendering in one video.

blackcitadel
Автор

+Bisqwit: 15:30ish. Dude... dude... no one has EVER explained so perfectly why learning formulas in math class is important. Especially with Google these days it's NOT the formula itself. It's having done it so that when you run across a problem in the future you have the experience that says "ah-ha! It might be because you remember it from class. Equally important though I think is teachers giving real life examples like this video which, from my experience, they don't do often. I keep getting more and more in love with these videos, you really do a fantastic job!

LanIost
Автор

I learned quite recently that Ken Silverman wrote the original Build engine when he was just 17/18 years old! I find that to be amazing, I actually screamed "WHAT" when I found out. As a nineteen year old who started when he was 17, I cannot help but to feel jealous, yet inspired, of his talent.

Hopsonn
Автор

The above all, hands down, most important skill you should learn is the ability to identify the type of answer you are looking for, and then look for it" -Bisqwit


I like that quote, it's going to help me man. I've watched this video like 10 times now. I love the music and style of the video, it's perfect.

leeemattyrs
Автор

I love this video. The tone, the subject I love everything about it!

JeromeEtienne
Автор

Ok I have to say this. Even now, after 3 years this video is so amazing to me. You littelary made whole freakin' 3D graphics generation engine. Just big wow...

beProsto
Автор

This guy sounds like a text to speech.

LittleMikeStarCraft
Автор

Bisqwit: makes 3D Game Engine in 15 minutes


Me: finds out how to make cube move after 3 hours

dailydoseofeverything
Автор

Just discovered this channel a couple hours ago and already my favorite channel! Stay awesome.

crabbygrindall
Автор

You are getting so many brownie points from me just for all of the stuff you include in your Downloads page. I've got your sample code, the completed version, the text editor you used, the textures including their source and the license they were published under. I'm having such an easy time following along with this. You're getting a sub, sir.

and by the way your accent is amazing.

Crawldragon
Автор

"It seems to work alright until... well, it doesn't work right."

Love it.

saxxonpike