7:00 they are using bitfields so each :1 is one bit of a single shared uint32, and each group of 8 is one byte of that uint32. It's not to enforce 32 bits per bool, it's probably so that the whole thing can be accessed as one uint32 or 4x uint8 for serialization and deserialization, but individual flags can be accessed without having to do bitwise logic See also, the comment on line 113.
Came here to say this, spot on! The groupings have 8 flags each, and it looks like there are 4 groups, so it's safe to say that they're grouped by the bytes of a `uint32_t`.
I wish more people did this, it would save so much memory. It works in basically every language, even JS. Great for storing a bunch of booleans or whatever.
I do this exact thing all the time: union { uint8_t flagsByte; struct { uint8_t flag0 : 1; uint8_t flag1 : 1; ... ... uint8_t flag7 : 1; } flags; } flags; Now I can access the flags as an 8 bit byte via flags.flagsByte (useful for sending across a network connection, or serialising) or i can access each flag individually (flags.flags.flag6). The compiler does the rest.
its really interesting to see how professionals write code for games, or even just in general. in my head i expect it to be some unnatural voodoo but its so simple, but i suppose that's what makes it good. especially with inheritance ive both seen and written some absolute garbage OOP. personally i find enum/struct/buffer relationships easier to reason about for games though. good video as always :)
U moje vreme ucilo se iz Quake source code. Bilo je dosta komplikovano jer je pisan u C, ne C++. Tesko je upasti u veliki projekat i snaci se, ali ako je covek placen tok to radi onda je ok.
What would you reccommend to a person trying to learn from source code? I've gone trough all the basics but I still don't have a clue on how people make all of these complex functions or how they know what they need to make in order to have a game run... I've tried reading Quake source code but I just don't even know where to begin... I'd love to program games one day, I've tried everything but can't even make a simple pop-up. I also want to insanely thank you for your videos, you explain stuff very simply and nicely, they helped me a lot.
Let’s start with this: Understanding the Quake source code in a short time frame can be very difficult even for experienced programmers. So, don’t beat yourself if you couldn’t understand it and remake your own quake game. Now, if you are interested in game development, or any other type of programming for that sake, you need to start with something basic. Want to make a game? Start with a 2D game. Once that’s done, raise the complexity of your task. But your main goal should be mastering the fundamentals, for example you have to learn how to break down the problem properly in smaller achievable tasks. In my video „Want to start coding?“ I provided a link for project based learning, its a huge free collection of resources with small projects. You can also find there how to create a doom like game in C++, its called „486 lines of C++“. It also contains projects in many other languages. I hope this helps and I am glad you like my content!
@Tariq10x Thank you for your reply. I've tried many things but I still struggle to see how basic data types like numbers and strings, arithmetic operations, etc... end up creating stuff like renderers or whatever else. I just don't know how to tackle stuff on my own from scratch, I don't understand the (software design? architecture?) side of things and the problem solving, like how can I use an array for something?
I see. Now, the reality is most people get their inspiration from other projects, so rarely will someone start coding a renderer without knowing how the logic of a renderer works. Creating a renderer from scratch would be a non-trivial task to begin with. First learn how something is supposed to work, look at how other people did it, try to understand their reasoning behind their decisions. And then you can try to recreate it, improve it, or even come with a completely different unorthodox approach on how to solve the problem. This goes for anything. So, don't expect to know how to create a renderer because you know how arrays work. You need to understand how renderers work, and then, how you can make one with the tools you have (programming language, standard libraries, third party libraries). If you have the chance to get a software internship somewhere, I would highly recommend it. The guys at my first internship taught me more about practical software knowledge than my university degree.
Learning to code by reading the Quake source code is like reading the Bible by learning Aramaic first 💀 Start with something simple and manageable like Unity, and then work your way down. Also, don't forget that old games had to do unholy hacks to work around hardware limitations, so there's a lot of "noise" in the way of the signal you're looking for, which is algorithms and data structures for video games.
9:38 Treadable means that the building or object can have paths for cars to drive on. Helpful when you have objects like bridges or parking garages in the game. The asset logic would be included in the main.scm file and controlled by using the pickup system in Pickups.cpp.
nobody is going to cover that for legal reasons. But if that's something you really want to figure out, it's possible even if you know nothing as long as you have enough dedication!
@@kneesnap1041 oh but some guy almost did it (only portion if comments tho), but forgot the name of the video, but I guess you'll manage to find it, if dedication is there 😀
Depends on what you want to code and what is your background. If you are going in completely blind with no CS background, I would start by watching a Python tutorial and giving yourself a goal of completing 10 very easy programs. Once you complete that, you can decide what to do next. Note down any specific questions you have and ask ChatGPT about them, but try not to use the code it provides and instead write everything yourself, so that you get comfortable with coming up with solutions.
As Martin pointed out, it depends on your background and what you want to do. A codebase like this is not something you would do as your first project. I made a video „want to start coding?“ for beginners which is full with learning material, so you can take a look there. If you are someone studying CS or something similar I would highly recommend to get an Internship as early as possible. If you are still in school, then going for a CS degree is a good base. If none of this applies, then go watch my video and go through the resources there, there’s a lot of self taught people working in software, but it’s important to note that it is getting harder for anyone without professional experience to get a job in the last few years.
How did they reverse engineer this? Did the game ship with debug symbols? Otherwise they'd have to guess every single identifier which sounds really, really hard
I am at my second semester of my CS degree. I have just completed java oop. How much more do I need to learn to understand all these stuffs? (C++ Language is not a problem to me)
I dont like OOP and dont use it so from a Go perspective where i use structs for inheritance, when you define something like type Player struct { Name string X-Position float64 Y-Position float64 } (idk game programming), it makes it easier to just call Player.X-Position and adjust it without any of the headaches involved, im not very good at explaining but im sure it makes sense when you look at it and think about it
@@criptych Async is great. I work with it all the time in C#. It basically synchronizes asynchronous code. So if you have one microservice sending messages to the other, you can write code that basically says “once you get a message, I want you to do this.” Doing that without async is usually done with callbacks, which do not compose well. But async composes as well as regular variables do. It basically completely abstracts away the fact that the data is not there yet. Also none of those languages you mentioned have inheritance at all either lol.
Hell nah, oop makes stuff work seemingly by magic, it's impossible to see how the underlying thing Is working, and you usually need to dig through like 4-8 classes to understand the object fully.
In "98%" of use cases it's the wrong choice. There's places where it's usable or maybe even preferred, but it should not be the only tool in your toolbox. What's actually useful about OOP is the concepts of abstraction, encapsulation and so on. But while OOP does give you these it also has many drawbacks. You can get these out of other programming models/techniques without getting the same drawbacks.
7:00 they are using bitfields so each :1 is one bit of a single shared uint32, and each group of 8 is one byte of that uint32. It's not to enforce 32 bits per bool, it's probably so that the whole thing can be accessed as one uint32 or 4x uint8 for serialization and deserialization, but individual flags can be accessed without having to do bitwise logic
See also, the comment on line 113.
Came here to say this, spot on! The groupings have 8 flags each, and it looks like there are 4 groups, so it's safe to say that they're grouped by the bytes of a `uint32_t`.
I wish more people did this, it would save so much memory. It works in basically every language, even JS. Great for storing a bunch of booleans or whatever.
John, saving memory and Js devs so t happening anytime soon 😂
Ain't*
I do this exact thing all the time:
union
{
uint8_t flagsByte;
struct
{
uint8_t flag0 : 1;
uint8_t flag1 : 1;
...
...
uint8_t flag7 : 1;
} flags;
} flags;
Now I can access the flags as an 8 bit byte via flags.flagsByte (useful for sending across a network connection, or serialising) or i can access each flag individually (flags.flags.flag6). The compiler does the rest.
not being able to buy a house and talk to women is a pretty accurate simulation of things i wish to do in real life but can only do in gta 😂
🤣😂🤣
its really interesting to see how professionals write code for games, or even just in general. in my head i expect it to be some unnatural voodoo but its so simple, but i suppose that's what makes it good. especially with inheritance ive both seen and written some absolute garbage OOP. personally i find enum/struct/buffer relationships easier to reason about for games though. good video as always :)
"Cars have colors, extras (whatever extras are)"
Extras are Optional parts like the teddy on gang burrito, or taxi light on taxi / cab.
Video title: GTA Vice City Source Code
Actual video: Ofcourse, it's not the GTA VC source code
Would also be cool to see a class diagram where all of this was designed! Great job 🙂
Low gdp country accent - lmao, such a clever line.
U moje vreme ucilo se iz Quake source code. Bilo je dosta komplikovano jer je pisan u C, ne C++. Tesko je upasti u veliki projekat i snaci se, ali ako je covek placen tok to radi onda je ok.
>tariq
>low gdp country accent
>still sounds german
>potatofication.jpg
Got a house, talked to a woman. I must be in game real life. 0:12
Sir, you are in the top 0.00001% of all CS guys.
What would you reccommend to a person trying to learn from source code? I've gone trough all the basics but I still don't have a clue on how people make all of these complex functions or how they know what they need to make in order to have a game run... I've tried reading Quake source code but I just don't even know where to begin... I'd love to program games one day, I've tried everything but can't even make a simple pop-up.
I also want to insanely thank you for your videos, you explain stuff very simply and nicely, they helped me a lot.
Let’s start with this: Understanding the Quake source code in a short time frame can be very difficult even for experienced programmers. So, don’t beat yourself if you couldn’t understand it and remake your own quake game.
Now, if you are interested in game development, or any other type of programming for that sake, you need to start with something basic. Want to make a game? Start with a 2D game. Once that’s done, raise the complexity of your task. But your main goal should be mastering the fundamentals, for example you have to learn how to break down the problem properly in smaller achievable tasks. In my video „Want to start coding?“ I provided a link for project based learning, its a huge free collection of resources with small projects. You can also find there how to create a doom like game in C++, its called „486 lines of C++“. It also contains projects in many other languages. I hope this helps and I am glad you like my content!
@Tariq10x Thank you for your reply. I've tried many things but I still struggle to see how basic data types like numbers and strings, arithmetic operations, etc... end up creating stuff like renderers or whatever else. I just don't know how to tackle stuff on my own from scratch, I don't understand the (software design? architecture?) side of things and the problem solving, like how can I use an array for something?
I see. Now, the reality is most people get their inspiration from other projects, so rarely will someone start coding a renderer without knowing how the logic of a renderer works. Creating a renderer from scratch would be a non-trivial task to begin with. First learn how something is supposed to work, look at how other people did it, try to understand their reasoning behind their decisions. And then you can try to recreate it, improve it, or even come with a completely different unorthodox approach on how to solve the problem. This goes for anything. So, don't expect to know how to create a renderer because you know how arrays work. You need to understand how renderers work, and then, how you can make one with the tools you have (programming language, standard libraries, third party libraries).
If you have the chance to get a software internship somewhere, I would highly recommend it. The guys at my first internship taught me more about practical software knowledge than my university degree.
start programming first with opengl, directx11
Learning to code by reading the Quake source code is like reading the Bible by learning Aramaic first 💀
Start with something simple and manageable like Unity, and then work your way down. Also, don't forget that old games had to do unholy hacks to work around hardware limitations, so there's a lot of "noise" in the way of the signal you're looking for, which is algorithms and data structures for video games.
Ma man Tariq strikes again. I enjoy those types of videos. And other ones as well. Keep it up bruh, continue to spill truths.
Nask0x out.
Got nothing but love for you bro
@@Tariq10x me too for you my Balkan brother
9:38 Treadable means that the building or object can have paths for cars to drive on. Helpful when you have objects like bridges or parking garages in the game. The asset logic would be included in the main.scm file and controlled by using the pickup system in Pickups.cpp.
You are absolutely right👌
1:25 low GDP country accent 😂 made me lol
What country that is I don't get it 😂
Bro the vscode folder has nothing related to gta
The only GTA that I remember All part of the map, I don't even need the mini map when play this game. 😅
I am waiting to see the GTA6 code :D
void FuckCarCompletly(void) in the DamageManager class at 15:40 was funny
Still waiting video like this to Official GTA V Source Code :(
nobody is going to cover that for legal reasons. But if that's something you really want to figure out, it's possible even if you know nothing as long as you have enough dedication!
@@kneesnap1041 oh but some guy almost did it (only portion if comments tho), but forgot the name of the video, but I guess you'll manage to find it, if dedication is there 😀
What does it say about me, watching a low gdp country guy explaining some code to me I will never look at 😅.
Enjoyed that. Keep it up
Low gdp country accent went crazy
🔥
It's my own damn copy of the repository, and I'll refactor it if I wanna
I really like this kind of thing but I dont understand anything, but I would love to learn how to code. Any advice for how I can start learning?
Depends on what you want to code and what is your background. If you are going in completely blind with no CS background, I would start by watching a Python tutorial and giving yourself a goal of completing 10 very easy programs. Once you complete that, you can decide what to do next. Note down any specific questions you have and ask ChatGPT about them, but try not to use the code it provides and instead write everything yourself, so that you get comfortable with coming up with solutions.
As Martin pointed out, it depends on your background and what you want to do. A codebase like this is not something you would do as your first project. I made a video „want to start coding?“ for beginners which is full with learning material, so you can take a look there. If you are someone studying CS or something similar I would highly recommend to get an Internship as early as possible. If you are still in school, then going for a CS degree is a good base. If none of this applies, then go watch my video and go through the resources there, there’s a lot of self taught people working in software, but it’s important to note that it is getting harder for anyone without professional experience to get a job in the last few years.
As someone who is self taught. Martin is spot on!
That **is** the easiest and most effective way to do it.
1:25 man you killed me 😂😂😂
💥🔫🔫
How did they reverse engineer this? Did the game ship with debug symbols? Otherwise they'd have to guess every single identifier which sounds really, really hard
I am at my second semester of my CS degree. I have just completed java oop. How much more do I need to learn to understand all these stuffs? (C++ Language is not a problem to me)
a lot more!
You need to practice, a lot of practice
Make a source code review of blue sky social. It’s a twitter alternetive.
Buy house 💀
Talk to girls ☠️
Great video !
IMO not being able to read and understand properly named code without comments is a skill issue.
whats the link of the code?
please, do the leaked source code of first FarCry game
your comment on third world country accent made me subscribe
The start😅
😎😎😎👌👌👌
What do you mean when you said " Only and Only for educational purposes, what were you thinking we would do ? "
🤯🤯🤯🤯
Inheritance? Why does everyone have an inheritance fetish?
I dont like OOP and dont use it so from a Go perspective where i use structs for inheritance, when you define something like type Player struct { Name string X-Position float64 Y-Position float64 } (idk game programming), it makes it easier to just call Player.X-Position and adjust it without any of the headaches involved, im not very good at explaining but im sure it makes sense when you look at it and think about it
Inheritance is great, but not the java-style inheritance, that shit belongs to hell
@@arjix8738 Why is inheritance great? Languages like Haskell, F#, Rust don’t have it at all. Proof that it’s not even necessary.
@@steven1671 Why is async great? Languages like C, Fortan, COBOL, don't have it at all. Proof that it's not even necessary.
@@criptych Async is great. I work with it all the time in C#. It basically synchronizes asynchronous code. So if you have one microservice sending messages to the other, you can write code that basically says “once you get a message, I want you to do this.” Doing that without async is usually done with callbacks, which do not compose well. But async composes as well as regular variables do. It basically completely abstracts away the fact that the data is not there yet. Also none of those languages you mentioned have inheritance at all either lol.
"Object oriented programming has its place" What?!?! It does not only have its place its in 98% of usecases the best usecase
Hell nah, oop makes stuff work seemingly by magic, it's impossible to see how the underlying thing Is working, and you usually need to dig through like 4-8 classes to understand the object fully.
In "98%" of use cases it's the wrong choice. There's places where it's usable or maybe even preferred, but it should not be the only tool in your toolbox.
What's actually useful about OOP is the concepts of abstraction, encapsulation and so on. But while OOP does give you these it also has many drawbacks. You can get these out of other programming models/techniques without getting the same drawbacks.
777 Views, ❤
This was personal @ 0:06 🥲
LoL the starting was fure 🤣🤌