Let's Program Doom - Part 2

Поделиться
HTML-код
  • Опубликовано: 5 окт 2024
  • I might be the most excited about this video. I really wanted to learn how the original Doom game engine works. l spent a long time learning the basic concepts but created the code myself from scratch and how I wanted to design it. You can follow along or convert this code to any other programming language since I kept it simple in C that draws a pixel at x and y coordinates.
    Let me know if you enjoy this series! Thank you for all your great ideas and I hope to see what you make from this tutorial series. Send me a link so I can share it in part 3!
    Grid2D overview: 01:22
    Save textures: 02:52
    Texture walls: 5:41
    Shadow & tile: 11:32
    Floors: 12:53
    Texture surfaces: 17:41
    github code: github.com/3DS...
    Install OpenGL: • Install Dev C++ and Op...
    Part 1 tutorial: • Let's Program Doom - P...
    Game textures: poloviiinkin.i...
    Image converter: notisrac.githu...
    part 1 made by others
    • ps3uDo demo
    • DoomLikeRenderer demo
    • Porting @3DSage ‘s Doo...
  • ИгрыИгры

Комментарии • 276

  • @Ozzymand
    @Ozzymand Год назад +233

    I ain't gonna lie, I almost lost all hope thinking part 2 will never come. I am so happy now, literally out of this world, this is amazing.

    • @3DSage
      @3DSage  Год назад +48

      Never doubt the 3DSage! 😎👍

    • @GamerSaga
      @GamerSaga Год назад +6

      I really hope part 3 will not take to long to come out.

    • @SilverPro7773
      @SilverPro7773 Год назад

      @@3DSage i want the program and thanks for the tutorial

    • @SilverPro7773
      @SilverPro7773 Год назад

      the part 2 took a long time to come and now there it is

    • @TheLonerD
      @TheLonerD Год назад +1

      @@GamerSaga It should take another 8-9 months~

  • @cjdaylight3407
    @cjdaylight3407 Год назад +55

    I am waiting for part 3

  • @goldenguy_dev
    @goldenguy_dev Год назад +82

    Literally just watched part 1 yesterday, this is a miracle.

    • @earlOfCloves
      @earlOfCloves Год назад +1

      And when you are done with part 2, you shall be healed by the second miracle! Hallelujah! *places palm on forehead with gentle shove as you raise your arms to the heavens*

    • @livefreeprintguns
      @livefreeprintguns Год назад +1

      Luckily the RUclips algorithm blessed me, so thankfully I'm able to watch back-to-back.

    • @charlieborchardt2066
      @charlieborchardt2066 9 месяцев назад

      I waited so long for part two. I got to watch the ray caster tutorials back to back though.

  • @YaPhutYT
    @YaPhutYT Год назад +11

    Yesterday I was waiting for part 2, Now am i am waiting for part 3 already!

  • @rednibcoding3412
    @rednibcoding3412 Год назад +12

    This "Let's Program Doom" series is so awesome! Thank you a lot. Cant wait to see part 3.

  • @vakqdev
    @vakqdev Год назад +7

    my day has immediately become 5 times better

  • @javianmuniz
    @javianmuniz Год назад +14

    I'm going to watch it right now! First part was amazing. Thanks for sharing! 😊

  • @Afrotechmods
    @Afrotechmods Год назад +10

    It's like watching a Captain Disillusion video but for programming + cats

    • @3DSage
      @3DSage  Год назад +3

      Nice! I'll take that compliment! Great description and thank you for the nice comment. Btw, I like your great electric channel!

  • @Komanturne
    @Komanturne Год назад +12

    I lost hope 6 months ago when you didn't upload anything. This is an absolute miracle!

    • @3DSage
      @3DSage  Год назад +7

      I'm glad you still believe in me and I believe in you to program it!

  • @Apotheker.
    @Apotheker. Год назад +8

    Wow! We need part 3!

  • @TeslabladePlaysMC
    @TeslabladePlaysMC Год назад +63

    18:41 Is it any coincidence that the multiplier you used is so close to 2pi or tau? with the amount of sin and cos functions used, I wouldn't be surprised to see pi crop up here!

    • @kbsanders
      @kbsanders Год назад +2

      I was thinking that as well. Can anyone confirm?

    • @frognik79
      @frognik79 Год назад +3

      First thing I thought of too. Guessing 6.28 would be a better approximation.

    • @DBGabriele
      @DBGabriele Год назад +2

      No, it is just FOV / UPDOWN "factor" (the same constant used to compute wz)

    • @charlieborchardt2066
      @charlieborchardt2066 6 месяцев назад

      I thought is was the golden ratio for a sec.

  • @reddz_
    @reddz_ 20 дней назад

    this tutorial series has genuinely helped with my c and 3d rendering comprehension, thank you king
    ,,,obligatory part 3 request

  • @thecout3170
    @thecout3170 Год назад +4

    Omg, i can't believe this video just released! Im waiting for this for sooooo long, more than half a year

  • @nicholasharding8817
    @nicholasharding8817 3 дня назад

    I'm loving this (and the raycaster tutorials previously)... You have managed to pack so much info into a short time, and its nice to see performant code/methods that can be run/ported onto minspec stuff! Looking forward to part 3.

  • @LuigiElettrico
    @LuigiElettrico Год назад +5

    That sure was revolutionary back in the 90's... still amazing how simple it is. I'm glad I foud someone explaining it with the only and best C language :D

  • @trenthm
    @trenthm Год назад +5

    I haven’t started the video yet but wanted to say I haven’t been this excited about a new RUclips video in a while!! Thanks for making a part 2! Love your channel btw. A gem of RUclips

    • @3DSage
      @3DSage  Год назад +3

      Wow that really means a lot to me so thank you so much for the nice comment! :)

    • @robsku1
      @robsku1 Год назад

      @@3DSage Truly, I don't think trenthm and I are the only ones who feel the same - I've wished for something like this since the mid-90's, but never believed that it could be done in such easy to understand way. You really have skills for "tutorializing" stuff like this, I'm quite pleasantly surprised, and I'm glad to hear it means a lot to you (I have the audacity to believe it applies to my comment as well, but not because I want to feel good about myself, but because you truly do deserve it!).

  • @solodevinc
    @solodevinc Год назад +1

    really cool seeing how such common concepts nowadays are programmed from scratch

  • @branpod
    @branpod Год назад +5

    I've been looking forward to this with an unreasonable level of excitement! Keep up the amazing work

  • @antmoundsock1122
    @antmoundsock1122 Год назад +2

    I've been looking forward to this for months!

  • @xmoex6393
    @xmoex6393 9 месяцев назад +3

    wow! i learned a lot today! I'm still at 50% Raycaster 3 but I'm really really looking forward to this series! I'm especially interested in the BSP stuff (especially how to generate the tree for the level data), it always fascinated me...

    • @3DSage
      @3DSage  9 месяцев назад +3

      This made my day! Thank you for saying that and I will continue these series! :)

  • @sajberkg
    @sajberkg Год назад +3

    this is awesome, so much cool stuff in here! Can't wait for part 3!

  • @tetris450
    @tetris450 Год назад +1

    This is one of the best, most fun learning channels on youtube

  • @PCgameandgamer
    @PCgameandgamer Год назад +3

    THIS LOOKS AMAZING, I haven't finished my game boy game but I'm really twitching to start a Gameboy advance game with this engine

  • @jacopobuttiglieri8598
    @jacopobuttiglieri8598 Год назад +13

    Great! I feel that this part 2 will be a tougher one to convert in Java... 😅

    • @3DSage
      @3DSage  Год назад +7

      Hey man! I believe in you! I hope you can do it! :) If not, just thanks for watching!

  • @Sinn0100
    @Sinn0100 5 месяцев назад

    I think it's wild you have the level move around the player. That's just so cool.

  • @otistically
    @otistically Год назад +4

    At this point, you've just made Duke Nukem 3D lol.

    • @3DSage
      @3DSage  Год назад +6

      It's time to program 3D and chew bubblegum, and I'm all out of gum 😎

    • @trenthm
      @trenthm Год назад

      @@3DSage 😂

  • @Logicatube
    @Logicatube Год назад +1

    I looked from start to finish, with your help I was able to create an engine). waiting for part 3

  • @ranonrat6164
    @ranonrat6164 Год назад +2

    this is actually really cool and useful, i will share it with my friends

    • @3DSage
      @3DSage  Год назад +1

      thank you! :)

  • @Nietzscheboy1
    @Nietzscheboy1 Год назад +2

    Nice! I've been waiting for part two. Thanks, good job 👍

  • @zilog1
    @zilog1 Год назад +3

    yo sick i love your videos. i love love love your simple computer build with the counter IC. thats so cool that you can actually make a basic computer/cpu out of just those chips

  • @SirCat07
    @SirCat07 10 месяцев назад

    this video is amazing! i wanted to make a doom-like 3d game
    after being subjected to 3 days of working with raycasters this being so simple is such a relief

  • @octopro8937
    @octopro8937 Год назад +2

    THANK YOU SO MUCH I HAVE BEEN WAITING FOR THIS!!!!

  • @tehaxor69
    @tehaxor69 Год назад +7

    I believe that 6.2 number you came up with is pi * 2 or acos(-1) * 2

  • @jakecomay9138
    @jakecomay9138 Год назад +3

    Nice tutorial man but my god you need install a formater because your code looks like minimized javascript

  • @szkockibandyta2419
    @szkockibandyta2419 Год назад +3

    very nice, love this series so far

  • @windwalkerrangerdm
    @windwalkerrangerdm Год назад

    One of the awesomest things on the internetz. Thank you. Didn't start on this yet, very busy with a project, but as soon as it finishes I'm going to dive into this and make stuff.

  • @greenstonegecko
    @greenstonegecko Год назад +5

    Twitter mad? I sleep
    RUclipsr cancelled? I sleep
    3DSage uploaded? **Real $h!t?**

  • @coderflowerdev
    @coderflowerdev 11 месяцев назад +1

    Please make a part 3!

  • @thelanguagegeek6207
    @thelanguagegeek6207 Год назад +2

    OH MY GOODNES ITS FINALY OUT!!!

  • @ashisharky
    @ashisharky 7 месяцев назад

    I ended up programming my own level editor and save load system for my gamemaker port I did for fun.
    I also modified how the level data works, I swapped to using points, walls, and sectors rather than just walls and sectors. That way I can draw points however I want in the editor as walls are composed of two points, texture data, and color data.
    This also brings my port closer to how doom actually acts as doom uses vertices, linedefs (and sidedefs), and sectors

  • @OfficialGoldenLeaf
    @OfficialGoldenLeaf 8 месяцев назад

    This is amazing! Things like this take alot of time so take all the time you need to finish the other parts

  • @Zeropointill
    @Zeropointill Год назад +21

    Can't wait to see if you continue your raycaster engine. I tried making the maps bigger but i ended up having a procedurally generated hellscape that went to infinite somehow.

    • @robsku1
      @robsku1 Год назад

      I would be even more interested in seeing a tutorial like this, but on creating a *raytracing* engine (in software), even if it's not practical for real-time 3D action (or just plain real-time) game rendering and ends up being much lower res or detail to be useful for more rendering in game (as opposed to pre-rendering stuff, which I wouldn't feel that interested in coding myself).
      If that has any practical use - I have lacking understanding of how much can be achieved with modern PC's and real time ray-tracing in software.
      But if it's possible to do something useful that way, I would just murder my family for it. I really would, I'm cereal!

  • @notSoAnonyymus
    @notSoAnonyymus 11 месяцев назад +1

    I'm ready for part 3 haha!

  • @bank8489
    @bank8489 Год назад +1

    YES I WAS SO EXCITED FOR THIS OH MY GOD

  • @loganjorgensen
    @loganjorgensen Год назад

    I like the in-engine editor, a great condensed minimalist display bar. Nice to see the faux view pitching technique get some love. That fog like gradient was something else, very approximate to polygon fog clipping.🙂

  • @autodidact7127
    @autodidact7127 Год назад

    OH MY GOD IT CAME OUT AND I MISSED IT! THANK YOU!
    I cant believe how cool the stuff you make is! WOW!

  • @democracy_enjoyer
    @democracy_enjoyer Год назад +2

    you got something wrong, the textures in id tech 1 repeat and not stretch, qlso would be great if yiu could make the resolution bigger

  • @glyphic1219
    @glyphic1219 Год назад +2

    Your so awesome man I've been watching you since your gba vids

  • @colek8990
    @colek8990 10 месяцев назад

    Currently stuck trying to get my textures to not look like TV static when i put them on the walls XD Hope there will be a part three by the time I finish, if its too much work though I understand and am still super thankful for this awesome 2 part series. Forreal best tutorial on RUclips.

  • @jhhoward
    @jhhoward Год назад +2

    Great video! Really fun to follow along as you build this. From your texture mapping code it looks like you are linearly interpolating on the X axis which will cause it to be non-perspective correct. Maybe you could update this to perspective correct texture mapping in your next video :)

  • @clongoram
    @clongoram Год назад +1

    Awesome video! Thanks for this series. It is one of the best on the subject.

    • @3DSage
      @3DSage  Год назад

      That means a lot to me so thank you!

  • @lead1320
    @lead1320 9 месяцев назад

    Thanks for this video! I just finished the first one and made a glitchy hexagon prism.

  • @HE360
    @HE360 Год назад +1

    Gosh, I've been seeing this channel for a while and I thought I was subscribed to it. But, now I am. This channel has been having some great game development content.

    • @3DSage
      @3DSage  Год назад +1

      Thank you for the sub! More great videos coming soon!

  • @technomological
    @technomological Год назад +1

    Can't wait for part 3

  • @SANDRAGALLARDO-g7p
    @SANDRAGALLARDO-g7p 6 месяцев назад

    legend says that never its going to be part 3 im coming from the future

  • @pineapplepie4929
    @pineapplepie4929 Год назад +1

    cant wait for the quake series

  • @Godmil
    @Godmil Год назад +1

    Omg, thanks so much for making pt2

  • @cromo5641
    @cromo5641 Год назад

    Cats + programming + DOOM = Perfection

  • @SpartanDude_325
    @SpartanDude_325 8 месяцев назад

    Its insane of what these programming language's can do.

  • @clearz3600
    @clearz3600 Год назад

    Ooooh part 2 is out. Nice!

  • @XXIstCenturyBoy
    @XXIstCenturyBoy Год назад

    I gave you my thanks. This is awesome content! Edit: There is a small bug in the texture mapping, if you check around 14:47, the texture's "dirt boulders" stays the same width on the whole width of the wall, with no perspective applied to the hstep. The more distant the texture should have thinner boulder, the hstep needs to take the wall height ratio in account...

  • @10x-developer
    @10x-developer Год назад +2

    Hey, another amazing video, and t is really easy to follow, just please add some visual indications around 10:45 when the cut is a bit too late, and those casts to (int) appear late and is easy to miss out. I got my video stopped at a bit earlier point while re -typing and when i tested it it was not working, because I missed the cast.

    • @Annatar3019
      @Annatar3019 Год назад

      I did the same thing lol, spent like an hour going over the video and different parts of the code to figure out what I'm missing.

  • @4KbShort
    @4KbShort 9 месяцев назад +1

    I think I found your "Really nice formula" for calculating the surface tile placement and it's basically yours with the last two variables changed:
    for "rx =" and "ry =" just change your last two variables to the following:
    (P.y/yo*tile) and (P.x/yo*tile)
    Or as it looks in my LUA version:
    rx=fx*math.sin(math.rad(pA))-fy*math.cos(math.rad(pA))+(pY/yo*tile)
    ry=fx*math.cos(math.rad(pA))+fy*math.sin(math.rad(pA))-(pX/yo*tile)
    The (pY/yo*tile) and (pX/yo*tile) works to lock the surface textures in place even while moving. I don't know how as I was just poking the code until it did what I wanted.
    I'm sure you've probably hashed this one out (or someone already mentioned it) and I look forward to the next tutorial!

    • @3DSage
      @3DSage  9 месяцев назад +4

      Thank you for adding this for people to see! That is a great update. I will be making several little updates in the next tutorial and adding a lot more too! :)

  • @BAMBAM3316
    @BAMBAM3316 7 месяцев назад

    I should've paid attention is school. My brain is gonna 'splode watching this math stuff.

  • @Jalechah
    @Jalechah Год назад +1

    amazing video! love the editor and I cant wait for Part 3 :D

    • @3DSage
      @3DSage  Год назад +4

      I'm completely a one man show so thank you for the editing compliment! I have a lot of fun ideas for part 3.

    • @Andrew-cc6hx
      @Andrew-cc6hx 5 месяцев назад

      @@3DSage how much longer until part 3

  • @AndersonReis42
    @AndersonReis42 8 месяцев назад

    I'm making a raycaster in lua using the love2d framework, finally managed to make a single ray shoot! I'm already looking foward the BSP

  • @MrBrax
    @MrBrax Год назад +3

    Oh god no ide refactoring and that code formatting, good job tho

  • @majokuhn
    @majokuhn Год назад +1

    Thanks for this second part it is so amazing like the first ❤

  • @GuildOfCalamity
    @GuildOfCalamity Год назад

    The single space indenting is a baller move.

  • @electronscape
    @electronscape Год назад

    OMG life made easier!!! im so loving these tutorials!! (does mean im going to have to feature creep on a project tho! LOL -- this is amazing!)

  • @loganjorgensen
    @loganjorgensen Год назад

    Oh yeah that was something I wanted to suggest for any new sector based engines, 2D approximated leaning in FPP. Kind of like faux pitching but I think it uses column shifting of the whole window to approximate camera tilt, OG Star Fox was a pretty good example.😉

  • @SomeBlokeOrWhatever
    @SomeBlokeOrWhatever Год назад

    Me, a drop-out from CompSci who chanced into these videos while wandering around the internet and only understands about half of it: Hmmmm. _Fascinating._
    I am, however, a doom mapper in my spare time, and at the end of the video you did ask for suggestions, so I have three:
    * The map editor doesn't seem to have a way to set different textures for floor/ceiling on the sectors or specific textures for individual wall lines within a sector. This is a feature of the og doom engine that goes a long way into making maps varied and interesting and since you managed to get the hard part (actually drawing stuff with texture mapping) down, it could elevate your engine as well.
    * Light levels! Doom had you set a lighting level per sector, with 255 being max and 0 being minimum. Fairly sure it just darkened all the pixels inside that sector by the reverse of that. Also something that makes maps more varied. Later you can even make light levels that change on the fly, for like flashing or flickering lights and such.
    * The little fade you did when you were demonstrating the floor rendering with flat colours. You could probably achieve a similar effect by applying a similar formula but to all three colour elements of the pixel while you are drawing the texture, since that, too, is just plotting colour pixels on the screen. If you really wanted to go all out, you could make these controllable parameters stored in the sector array, thus giving the map designer customisation over the fog within a sector, which can make maps more moody. Then again this would probably also call for doing the same to wall textures and we start getting even more complexity.

  • @TheMasonX23
    @TheMasonX23 11 месяцев назад

    Looking forward to part 3!

  • @ShotgunLlama
    @ShotgunLlama Год назад +5

    It looks like you're linearly interpolating the texture horizontal coordinates on walls. Won't that look wrong for walls viewed at angle, like the wall of a long hallway, where the halfway point of the texture really should be more than halfway along its length? Or are you just not concerned with that?
    And for floors, have you thought about using rows of pixels instead of columns so you don't need to make as many divisions?

    • @3DSage
      @3DSage  Год назад +5

      You are correct. Planning out a video like this is very tricky and I leave a few things on the cutting room floor but those issues will be brought up in the next part.

  • @meerjel0120
    @meerjel0120 5 месяцев назад

    Idea:
    Use in-facing sectors as rooms, and out-facing sectors as brushes.

  • @KoshcheyUO
    @KoshcheyUO Год назад +4

    hi 3DSage, one of my dreams is for you to make a GBA game with an open world, could you do it?)

    • @3DSage
      @3DSage  Год назад +3

      I have that dream too! Really. I feel the GBA can be pushed to do so much more and I hope to be apart of that.

  • @TomasRay
    @TomasRay Год назад +3

    First! let's go boiiiiis

  • @EvilErwin23
    @EvilErwin23 Год назад +1

    Great video.
    Could you add voxel objects in a later video?
    Similar to voxel objects in the Build-Engine.
    I'm curious how they stored the objects and how the software renderer for those worked.

    • @3DSage
      @3DSage  Год назад +1

      I would like to touch on that topic so I will keep that in mind!

  • @laz3664
    @laz3664 Год назад +3

    YES

  • @octopro8937
    @octopro8937 Год назад +1

    PART 3 PLEASE

  • @CC-1.
    @CC-1. Год назад +1

    You inspired me but I'm already making a 4D game engine which rendering takes too much time

  • @Console.Log01
    @Console.Log01 Год назад

    Cant wait to get home and get lost within the first 2 minutes of the first video!

  • @harsimransinghbatth5032
    @harsimransinghbatth5032 Год назад

    Hello, would you mind covering the Grid2D programming in a future video? Covering as in coding it along with explanation, it would be really helpful!
    Thanks for all the hardwork, I wish this stuff was taught in schools.

  • @DBGabriele
    @DBGabriele Год назад

    @3DSage, 6.2 is not as accurate as 6.67. I've observed that using FOV/UPDOWN_FACTOR (which, in this case, is 30, the same value used when computing the wz of the wall) is the correct way to calculate it. Additionally, P.x/60. and P.y/60. are related to the window size, specifically the SH2. You can experiment with adjusting these constants and then make changes to the resolution accordingly!

  • @goawayinternet
    @goawayinternet Год назад +2

    very freakin cool

  • @SilverPro7773
    @SilverPro7773 Год назад +1

    this is a nice tutorial also about your computer that you made does it have an microproccesor

  • @JamesTDG
    @JamesTDG Год назад +1

    Ayy, it's finally back! Now when part 3?

  • @dvince6678
    @dvince6678 Год назад

    Hey man really love the content! Hoping one day i could get the level where you are at making 3D projects in the GBA :D

  • @IAMMAT87
    @IAMMAT87 3 месяца назад +1

    Would love to do this tutorial, but sadly it only has 2 episodes. please make more or consider a paid one. I WOULD BUY IT :)

  • @THE16THPHANTOM
    @THE16THPHANTOM Год назад

    nice to know there are fellow java try hards/stubborn people in the comments who keep insisting on making things like this in java no matter how much they get discouraged and get weird looks.

  • @godfather00cz
    @godfather00cz 11 месяцев назад

    excellent series! part 3 please...?

  • @Davi_Dash
    @Davi_Dash Год назад +3

    let's fucking goooooooooo

  • @PomoiniyYenot
    @PomoiniyYenot Год назад +1

    О боги это просто потрясающая проделанная работа, огромное спасибо за такую работу. Просто нет слов...

  • @hungariannerd8445
    @hungariannerd8445 Год назад

    incredible man. doing gods work

  • @EmiTheLoomistar
    @EmiTheLoomistar Год назад

    Thanks so much!! It would be awesome if you could cover the quake engine one day :D

  • @TyGadzislawieTy
    @TyGadzislawieTy Год назад

    Damn, nice job! I will download your engine and try to build simple game on it! :D

  • @Pablo4949
    @Pablo4949 Год назад

    I kept forgetting to share the port I did in python lol. I figured out texturing on my own, but I never figured out how to get floor texturing to be performant, so instead I did solid color floors for sectors and did some level trickery to make it look better.
    I used Tiled to make my level editor, instead of writing my own (I did the same trick where you have to draw the polygons a certain direction because I didn't want to write code to check it lol). Didn't bother doing BSP or portals, so I just designed a level that didn't obviously break as much. No proper collision detection, but just enough to let you walk up stairs.

  • @Fezezen
    @Fezezen Год назад +1

    It's interesting that your sectors are kind of the opposite of what sectors are in Doom/Build. Instead of sectors being interiors (walls are rendered inward), they're just exteriors. More like usual 3d models.

    • @MyArtificialNostalgia
      @MyArtificialNostalgia 10 месяцев назад

      I believe that sectors can actually be used in both ways, but with doom engine, its more optimized for rendering interiors. I don't know this for a fact, but I am just guessing

  • @2dapoint424
    @2dapoint424 Год назад +1

    Thanks for uploading !! Super awesome tutorial! Where can I get Grid2D from?

  • @ELV13S
    @ELV13S Год назад +1

    this god..i mean guy can probably make gba studio if he wanted too, yknow, like gb studio but for gba