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.
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.
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.
@@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.
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.
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
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.
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.)
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.
@@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)
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.
@@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.
*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.
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++.
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.
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.
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.
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
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 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.
@@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.
@@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.
@@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.
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.
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.
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.
Fair , but then imagine GTA for how many years they work on the same codebase? why would you ignore maintenance ?
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.
@@Lichtstrahl92 do we still have the source somewhere ?
@@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.
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.
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
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.
Jesus is the way, the truth and the life. Turn to him and repent from your sins today ❤️
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.)
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.
@@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)
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.
@@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.
*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.
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++.
@@AJenbo so incorrect
13:40 holy wall of text that guy must've been really mad for some reason lmao
David Brevik does not like OOP, so the code being reverse engineered from D1, it makes sense that it is the way it is
He and I share a loathing for OOP, although I understand the need for it in some instances.
What is the program name that extracts the interface and all those flows in your video?
sourcetrail 3:21
@@jaygoogles
Jesus loves you. Repent and turn away from your sins today 🤗
I still have my copies of the original Diablo 1 for both Windows PC and for PS1.
I created in the past a Stats system based on attribute, subattribtes and buff items! the mos difficult part to programming is DataStructure.
Great video as always. Are you using the original Sourcetrail or a fork?
What’s the name of that graph visualizer software?
Salmon. The best fish to climb a mountain would probably be the salmon.
Is L5 the secret cows level? That would explain it being mentioned in L1, perhaps
It’s always someone who has never built anything using the word “garbage” about someone else’s project.
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.
Sympathic intro what are devs used for?
Very cool video! :)
Didnt understand anything but liked the video.
what is this tool that generates that visualization?
3:19 What is this tool?
Sourcetrail
@@phonomorgue.1372 Thanks!
Saw this, but thought it was the name of the project.
it's literally in the titlebar
@@phonomorgue.1372 Thanks!
@@user-93fekod1o I know! I thought it's the name of the project.
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.
I am an avid Diablo Autism Pro player dude... wth
500.000 lines of code holy shit
Они не использовали Шум Перлина. Может быть ты найдёшь разгадку в книге Мартина Гарднера "Новые математические развлечения".
3505 global variables, that's all you need to see :D
"In case you have no hobbies..." hahaha
Love the love for low GDP bros
Would be best to name your programs instead of saying "let's start with this". Sourcetrail is a really interesting tool.
damn is that sourcetrail. i know the people who made that program personally.
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.
maybe try reviewing leaked cs:go source code? if you can
This code is reversed engineered. Its not at all the blizzard code.
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
it does not run? will be nice to run it and debug it
It runs perfectly fine and works with multiple debuggers.
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.
Hellfire official source code was leaked and shows devilution is extremely accurate
@@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.
@@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.
@@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.
@@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.
bro are you hungarian?
This is NOT the source code of Diablo. This is the worst type of clickbait, a complete lie.
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.
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
People like you are why people like me have to maintain horrible legacy garbage instead of actually doing something productive.