The Diablo Source Code Is Pure Hell (and I am here for it)

Поделиться
HTML-код
  • Опубликовано: 4 фев 2025

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

  • @pioj
    @pioj 9 дней назад +125

    Most production code in commercials videogames are garbage (mine included!) , but it's often because of time constraints. You can't afford to gamble with the failure of the whole project and go refactoring every 3 months. Of course, there are a few rare exceptions where programmers excel at their best, like Mr. John Carmack.

    • @sothatwemaybefree330
      @sothatwemaybefree330 3 дня назад +19

      It's important to note that Carmack's best open sourced work is considered Doom BFG edition. However, by that time he had written multiple engines that produced very similar games. So, in a sense, he got better by rewriting the same systems over and over.

    • @monad_tcp
      @monad_tcp 3 дня назад +6

      Fair , but then imagine GTA for how many years they work on the same codebase? why would you ignore maintenance ?

    • @Lichtstrahl92
      @Lichtstrahl92 2 дня назад +1

      If you would like to see another exception to your point I suggest to look at what Mojang released publically from their Java Edition of Minecraft. I find it super clean and very well structured.

    • @captainnoyaux
      @captainnoyaux 2 дня назад

      @@Lichtstrahl92 do we still have the source somewhere ?

    • @JesusPlsSaveMe
      @JesusPlsSaveMe День назад

      ​@@sothatwemaybefree330
      *Revelation 3:20*
      Behold, I stand at the door, and knock: if any man hear my voice, and open the door, I will come in to him, and will sup with him, and he with me.
      HEY THERE 🤗 JESUS IS CALLING YOU TODAY. Turn away from your sins, confess, forsake them and live the victorious life. God bless.
      *Revelation 22:12-14*
      And, behold, I come quickly; and my reward is with me, to give every man according as his work shall be.
      I am Alpha and Omega, the beginning and the end, the first and the last.
      Blessed are they that do his commandments, that they may have right to the tree of life, and may enter in through the gates into the city.

  • @AJenbo
    @AJenbo 7 дней назад +38

    I believe they designed the level generation this way to ensure each level type feels distinct and unique.
    Regarding how the system works, I think you may have misunderstood some aspects. You expected it to be based on Perlin noise, but instead, it starts with a blank canvas and progressively applies finer random elements. This approach makes more sense for something resembling a building, whereas uniform noise is better suited for generating landscapes.
    Rather than randomly seeding tiles with values, the system creates rooms of varying sizes and then searches for good spots to place key elements, like lamps. This is why the search patterns mostly consist of the same number-it’s looking for blank spaces, not noise patterns.
    Additionally, the search pattern doesn’t check every tile individually; instead, it selects random spots and tests whether they’re viable locations.
    In the search-and-replace pattern, a 0 means "skip this tile," meaning it can have any value and won’t be replaced.
    Boris the Brave wrote an excellent article on how Dungeon Generation in Diablo 1 works, which might provide more insight.

    • @JesusPlsSaveMe
      @JesusPlsSaveMe День назад

      Where are you going after you die?
      What happens next? Have you ever thought about that?
      Repent today and give your life to Jesus Christ to obtain eternal salvation. Tomorrow may be too late my brethen😢.
      Hebrews 9:27 says "And as it is appointed unto man once to die, but after that the judgement

  • @AJenbo
    @AJenbo 7 дней назад +37

    The reason that there are files directly in the Source folder is that it's how it was structured in 90s by the Blizzard team. We are slowly re-organisering things.
    P.s. I don't have autism, and I do have friends. But thanks for the review any way.

    • @JesusPlsSaveMe
      @JesusPlsSaveMe День назад

      Jesus is the way, the truth and the life. Turn to him and repent from your sins today ❤️

  • @misharatkevich9808
    @misharatkevich9808 9 дней назад +29

    The big thing is that the original code was reverse engineered and EXCEPT for the intentional bugfixes and QoL improvements everything else is meant to be kept 100% compatible. Reverse-engineered code very rarely looks as nice as it was originally written, and the "100% compatibility aside from minor deviations" aspect means they'll be more reluctant to refactor anything that's NOT part of said deviations.
    Considering the type of herculean effort this was, I don't really expect it to look nice lol. (And "what's data vs what's not data" might legit be some janky Blizzard logic we don't know about.)

    • @AJenbo
      @AJenbo 7 дней назад +1

      The original author of Diablo's code has stated that the Devilution code looks very close to how they did it originally. It was not a thing of beauty. In fact one differences is that they used #define's instead of enums.

    • @misharatkevich9808
      @misharatkevich9808 7 дней назад +2

      ​@@AJenboEnums via defines? That sounds... ouchy.
      But it's pretty interesting that the original code is close to the reverse-engineered version -- means a lot more of the weird stuff comes from Blizz themselves. :P (Makes sense, since we know for a fact the development became rushed at some point)

    • @AJenbo
      @AJenbo 7 дней назад +1

      Yeah, they had a lot of bugs that could very easily have been avoided with better code structures. This was actually there first C/C++ project, prior to this they mostly wrote games in ASM for 16bit consoles.

    • @JesusPlsSaveMe
      @JesusPlsSaveMe День назад

      ​@@AJenbo
      *Revelation 3:20*
      Behold, I stand at the door, and knock: if any man hear my voice, and open the door, I will come in to him, and will sup with him, and he with me.
      HEY THERE 🤗 JESUS IS CALLING YOU TODAY. Turn away from your sins, confess, forsake them and live the victorious life. God bless.
      *Revelation 22:12-14*
      And, behold, I come quickly; and my reward is with me, to give every man according as his work shall be.
      I am Alpha and Omega, the beginning and the end, the first and the last.
      Blessed are they that do his commandments, that they may have right to the tree of life, and may enter in through the gates into the city.

  • @MichaelPohoreski
    @MichaelPohoreski 8 дней назад +37

    *Thumbnail and title is partial clickbait.*
    1. Diablo was written in C not C++.
    2. The source you are looking at is NOT the original Diablo Source Code but is the *reverse engineered* code. The title is mis-leading.
    3. Where is the link to Sourcetrail in the description?
    4. Sourcetrail is sadly abandoned.

    • @AJenbo
      @AJenbo 7 дней назад +8

      It was actually written in C++, They started out in pur C but switched to C++ later on. Some components like storm, the chat and diabloui are mostly written in C++.

    • @firstname4337
      @firstname4337 2 дня назад +1

      @@AJenbo so incorrect

  • @0x370c2de
    @0x370c2de 2 дня назад +3

    13:40 holy wall of text that guy must've been really mad for some reason lmao

  • @theoverdox
    @theoverdox 3 дня назад +5

    David Brevik does not like OOP, so the code being reverse engineered from D1, it makes sense that it is the way it is

    • @tlee656
      @tlee656 3 дня назад +3

      He and I share a loathing for OOP, although I understand the need for it in some instances.

  • @kamilkaya5367
    @kamilkaya5367 3 дня назад +8

    What is the program name that extracts the interface and all those flows in your video?

    • @jaygoogles
      @jaygoogles 2 дня назад +3

      sourcetrail 3:21

    • @JesusPlsSaveMe
      @JesusPlsSaveMe День назад

      ​@@jaygoogles
      Jesus loves you. Repent and turn away from your sins today 🤗

  • @skilz8098
    @skilz8098 8 дней назад +2

    I still have my copies of the original Diablo 1 for both Windows PC and for PS1.

  • @AstralNostalgia
    @AstralNostalgia 3 дня назад +1

    I created in the past a Stats system based on attribute, subattribtes and buff items! the mos difficult part to programming is DataStructure.

  • @RichardBejtlich
    @RichardBejtlich 9 дней назад +5

    Great video as always. Are you using the original Sourcetrail or a fork?

  • @krukoski
    @krukoski День назад +2

    What’s the name of that graph visualizer software?

  • @jkrigelman
    @jkrigelman 5 дней назад +2

    Salmon. The best fish to climb a mountain would probably be the salmon.

  • @Lolleka
    @Lolleka 2 дня назад +1

    Is L5 the secret cows level? That would explain it being mentioned in L1, perhaps

  • @gottoz4253
    @gottoz4253 2 дня назад +1

    It’s always someone who has never built anything using the word “garbage” about someone else’s project.

  • @cho4d
    @cho4d 9 дней назад +27

    as a software dev you should probably avoid making disparaging remarks about autism. you're basically alienating at minimum 50% of your co-workers/youtube audience.

  • @andtrixr3284
    @andtrixr3284 2 дня назад

    Sympathic intro what are devs used for?

  • @realkorgo
    @realkorgo 2 дня назад

    Very cool video! :)

  • @vicentegalvez1800
    @vicentegalvez1800 4 дня назад

    Didnt understand anything but liked the video.

  • @nottellinganyoneanything
    @nottellinganyoneanything 2 дня назад

    what is this tool that generates that visualization?

  • @Al1987ac
    @Al1987ac 9 дней назад +10

    3:19 What is this tool?

    • @phonomorgue.1372
      @phonomorgue.1372 9 дней назад +4

      Sourcetrail

    • @Al1987ac
      @Al1987ac 9 дней назад

      @@phonomorgue.1372 Thanks!
      Saw this, but thought it was the name of the project.

    • @user-93fekod1o
      @user-93fekod1o 9 дней назад +3

      it's literally in the titlebar

    • @Al1987ac
      @Al1987ac 9 дней назад

      @@phonomorgue.1372 Thanks!

    • @Al1987ac
      @Al1987ac 9 дней назад +1

      @@user-93fekod1o I know! I thought it's the name of the project.

  • @tsuhai5474
    @tsuhai5474 2 дня назад +1

    What is the purpose of this video? You neither learn about programming nor about Diablo's code. You just show random snippets of reverse engineered code.

  • @Dom-zy1qy
    @Dom-zy1qy 9 дней назад +3

    I am an avid Diablo Autism Pro player dude... wth

  • @zanagi
    @zanagi 2 дня назад

    500.000 lines of code holy shit

  • @Константин-ф6г9ж
    @Константин-ф6г9ж 3 дня назад

    Они не использовали Шум Перлина. Может быть ты найдёшь разгадку в книге Мартина Гарднера "Новые математические развлечения".

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

    3505 global variables, that's all you need to see :D

  • @jfsherazi5549
    @jfsherazi5549 20 часов назад

    "In case you have no hobbies..." hahaha

  • @alexstone691
    @alexstone691 8 дней назад

    Love the love for low GDP bros

  • @henrykkaufman1488
    @henrykkaufman1488 4 дня назад

    Would be best to name your programs instead of saying "let's start with this". Sourcetrail is a really interesting tool.

  • @921Ether
    @921Ether 5 дней назад

    damn is that sourcetrail. i know the people who made that program personally.

  • @michaelhawthorne5516
    @michaelhawthorne5516 2 дня назад +2

    If you think this is production code you are fooling yourself. This is the result of the efforts of the decompilation project, which very likely does not resemble the original code at all.
    The use of constexpr should be a big clue - it wasn't a part of the language until C++11 and I'm reasonably confident this version of C++ was not available to the developers of Diablo, since it was released 15 years after launch day.
    This is not a code review of the original code, it is a code review of the decompilation project contributors. The distinction between structs and classes, the organization of header files, the folder organization - this is all very likely made up by the decompilation team.

  • @kamiien887
    @kamiien887 5 дней назад

    maybe try reviewing leaked cs:go source code? if you can

  • @robeardo
    @robeardo 2 дня назад

    This code is reversed engineered. Its not at all the blizzard code.

  • @siderealvictor9813
    @siderealvictor9813 4 дня назад +2

    Is this even possible to learn this superpower, where you can understand such big companies code when you cant understand the code you wrote 5 days ago

  • @fornonplayers3668
    @fornonplayers3668 9 дней назад

    it does not run? will be nice to run it and debug it

    • @AJenbo
      @AJenbo 7 дней назад +1

      It runs perfectly fine and works with multiple debuggers.

  • @anon_y_mousse
    @anon_y_mousse 9 дней назад +9

    I'm not sure I get why you're talking the way you are, as though this is the original source code. Just because they had debug info to work off of doesn't mean it's 100% 1:1 the same as original. It's still just a decompilation project. I'd have to find the copy they were working from, but I doubt that the original code was actually written in C++ or at least not entirely in it even if any was. I'd bet good money, given the time period, that it was likely written mostly in C with some bits in assembly and if any C++ was used, it was likely just for the interface.
    The thing I really wonder, is did Blizzard save the original source code or is it lost to time leaving us with decompilation as the only option.

    • @kphoenix137
      @kphoenix137 7 дней назад

      Hellfire official source code was leaked and shows devilution is extremely accurate

    • @anon_y_mousse
      @anon_y_mousse 7 дней назад

      @@kphoenix137 You get that the original game isn't the extension, right? Also, I'm still going to count period written C++ as C if they use it in a C way, i.e. no classes. Although, without the original source code for the original game, I can't look at how it was written, but if the expansion pack is any indication, at most, actual C++ is just glue/interface code and not for functionality. Of course, this is pre-1998 standardization too, so technically one could say C++ didn't even exist as it was just C with classes.

    • @kphoenix137
      @kphoenix137 7 дней назад

      @@anon_y_mousse I'm well aware of the differences between hellfire and diablo. If you want to see the differences yourself, search for all the ifdefs for hellfire in devilution. The portions of code that remain unchanged from diablo to hellfire are what I'm saying are extremely accurate since we can observe that.

    • @AJenbo
      @AJenbo 7 дней назад

      @@anon_y_mousse It's not like the expansion was a total revolution that completely rewrote every aspect of the engine. They simply made the changes needed for adding the new content and called it a day. Which is also clear if you do a diff of the bineries.

    • @anon_y_mousse
      @anon_y_mousse 7 дней назад +1

      @@AJenbo If you're talking about from a functionality perspective, many different pieces of code can translate to the same binary output. I could use BASIC or Pascal and still get the same functionality if I wrote the code the right way. Doesn't actually mean they used those languages either, nor does it mean the source is exactly as they would've written it.

  • @mil_klover375
    @mil_klover375 8 дней назад

    bro are you hungarian?

  • @rogumann838
    @rogumann838 3 дня назад +2

    This is NOT the source code of Diablo. This is the worst type of clickbait, a complete lie.

  • @brain.yogurt.5.56
    @brain.yogurt.5.56 3 дня назад +1

    Seems like dat files are datamined from dat files of diablo and player and item files are their implementation of the engine. And there's nothing wrong with that. I don't know why the tone is so condescending, and the title is just clickbait, because the original codebase was never released to the public.
    OOP is great, but if you look at how it compiles, it wastes a lot of CPU cycles because of how classes use memory versus structs, often forcing the CPU to wait 300-400 cycles each time you trigger your strategies and observers. You made a good point when describing this "pure hell"-it all depends on what you're optimizing for. If it's performance, then your architecture needs to be based on CPU design, not on OOP-driven delusions about clean code.
    I would also like to say that the diagram bit was pointless, and explained nothing beyond the initial statement, just seems like you're farming for content length.
    Nice job farming the algorithm! Maybe insulting people's work will get you more views than putting effort into your English proficiency and intelligible speech.

  • @Mr7Shane
    @Mr7Shane 4 дня назад +5

    dumb code gawking video. "where are the classes" "I wouldn't write it like that"
    if you are having difficulty reading the code that's your own problem

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

      People like you are why people like me have to maintain horrible legacy garbage instead of actually doing something productive.