Love these videos. I enjoy seeing your thought process and how everything is being done on the fly. Very educational! I would love to see your key presses on screen. You work so efficiently, and it would be beyond helpful to learn what shortcuts you're using to speed up your workflow.
Something's with audio, i think it started near the end, or at least I didn't notice it until the last third of the video. Sounds as if mic recording is layered on top of webcam audio recording or there's some band-pass echo effect.
Great video! The mic sounds great, however around 23:00 your voice seems kinda doubled, as if you were using both your microphone and the camera microphone at once.
You can just put the m_imageData in a unique_ptr too. Saves you the hassle with delete and the destructor. std::unique_ptr bla = new uint32_t[200]; works just fine.
@@justonefra It would be helpful, because the vector can manage resizes for you. The thing about vector is that it often keeps more memory than it needs, so Cherno could avoid most of the reallocations from the resizing and vector never shrinks when you remove items. Whenever he goes onto a new size, he can just call clear() on the vector and then insert the number of items needed. He can then pass the vector's internal array to the Image object via the vector's data() function.
I don’t know if my message will reach your eyes , but thank you very much for content and c++ lessons ! When I started with C++ many years ago I was struggling so much with be able learn only from books …
I think you writing your code how you would now would be much more interesting and useful than an almost straight copy+paste, half of what interested me about this series is hearing you take a "what would I do now?" approach
1. Why didn't you kept the sprites in a map with the enum as key? I guess it would look not so terrible. 2. Loop with setting value to ImageBuffer in Renderer::Clear function: for (uint32_t i = 0; i < m_Width * m_Height; i++) m_ImageBuffer[i] = clearColor; can be changed to single call from standard library: memset(m_ImageBuffer, clearColor, m_Width * m_Height * sizeof(uint32_t)); which is faster since it uses SSE/AVX optimizations (you'll need only to align the buffer on recreation).
1. We're just getting started with the sprites API and won't keep it like this 2. Can't use memset here because we're trying to set uint32_t's and not bytes - for eg. Clear(0xffff00ff) won't work with a memset (not to mention the for loop is more than fast enough and will also be optimized)
As the variable clearColor is just a normal parameter the compiler likely is smart enough to convert it to movdqu or other larger instructions. Just for readability though i would suggest using std::fill - tells you that the memory is filled with that value. (well, a C++-version of memset would be nice - one that can be used with other things then char* ).
I think you should make spritesheet ignored color as alpha 0 from pink as a little challange (not as a some part of project, just as a temp code for this task) It could be very good for learning more stuff
god, I wish cherno used something like SDL or SFML for this one. It'd have been a thousand times much more interesting. Looking at him code in an API that I have absolutely no experience with just doesn't hit the same :(
learn you should probably go back to Java if you want to maintain sanity, or learn you should have never learned java if you want something that runs fast
Cpp and java are fairly similar. I believe Java was inspired by C++; the folks at Oracle wanted a more controlled and simplistic language so that “Everyone could code.” The main difference between C++ and Java is that in C++ you manage your own memory. All objects in Java are passed by reference, and the task of freeing memory is managed by the garbage collector (which is pretty well optimized these days in Java - and is probably not your performance bottleneck). In C++, you can choose to pass by value or by reference, and can even choose whether to free your own memory or have it be garbage collected. The goal of C++ is choice. The transition isn’t hard if you know Java already, but beware of using C++ specific features like smart pointers or operator overloading at the start. You can get sucked down a rabbit hole with feature creep. Like I said, C++ is about choice and freedom, but you can only really appreciate those tools after you understand the essence of the language. Otherwise it’s super easy to dig yourself in a really deep hole.
I would start by saying that there's more to the difference between the two than just that you "manage your own memory" with C++. And I'd say in modern C++, memory management is less important than in determining ownership of pointers. That is, determining who is responsible for cleaning up the mess afterward. That's the point of unique_ptr and shared_ptr. (And you can still pass the pointer to functions if you use unique_ptr by calling its get() function; you do this when you don't intend to pass ownership to the function, when it just needs to access it.) Other considerations would be don't declare stuff as pointers or references if you don't have to. In C++, objects (and this concept has a very broad definition in C++) are by default value types, and you should take advantage of that. In addition, you should make heavy use of the standard library, which is designed to be efficient. Cherno above should have put the data in a vector, for example. There are various highly useful algorithms you can use to simplify the layout of your code. More tips can be found in the ISO C++ FAQ and the C++ Core Guidelines.
Module support is very, very spotty right now. Visual C++ is the only compiler with module support that you could reasonably call production ready, and I think even that is a stretch, not to mention that build tool support is almost nonexistent. Maybe using modules will be worth it in a year or two when things have become more stable, but not yet.
As someone using modules in some small projects (in scope to his engine stuff) while great, they have a big drawback in tooling support. Visual Studio has the best support, but it's still really spotty. I personally have encountered broken intellisense (though it has gotten better over time), and syntax highlighting is also busted because of it from time to time. The parser just gets confused with the "import" statements or something.
@@ChrisCarlos64 Yeah it's definitely buggy, IntelliSense doesn't work for me either and have had to include std headers in the global module. Still for me I think it's worth it.
@@FirstLast-bo7ef Also helps when people actually know where to find such a lecture. Just mentioning it but not bothering to provide a link doesn't really help.
Okay, genuine question: Why do you always look depressed in your thumbnails? Not trying to sound rude, but I do want to remind you that you have a great engine, a following, and a really great amount of skills that give you a bunch of avenues in life. Love your channel and hope that you are doing alright in your life!
Love these videos. I enjoy seeing your thought process and how everything is being done on the fly. Very educational!
I would love to see your key presses on screen. You work so efficiently, and it would be beyond helpful to learn what shortcuts you're using to speed up your workflow.
Something's with audio, i think it started near the end, or at least I didn't notice it until the last third of the video.
Sounds as if mic recording is layered on top of webcam audio recording or there's some band-pass echo effect.
Great video! The mic sounds great, however around 23:00 your voice seems kinda doubled, as if you were using both your microphone and the camera microphone at once.
the audio sounds like there are two vocal tracks on top of each other with a little delay
You can just put the m_imageData in a unique_ptr too. Saves you the hassle with delete and the destructor.
std::unique_ptr bla = new uint32_t[200]; works just fine.
Or just use std::vector..
@@paulredmond6467 That is unnecessary as the size is constant between frames (except for when resizing) and wouldn't help much
@@justonefra It would be helpful, because the vector can manage resizes for you. The thing about vector is that it often keeps more memory than it needs, so Cherno could avoid most of the reallocations from the resizing and vector never shrinks when you remove items. Whenever he goes onto a new size, he can just call clear() on the vector and then insert the number of items needed.
He can then pass the vector's internal array to the Image object via the vector's data() function.
I don’t know if my message will reach your eyes , but thank you very much for content and c++ lessons ! When I started with C++ many years ago I was struggling so much with be able learn only from books …
I think you writing your code how you would now would be much more interesting and useful than an almost straight copy+paste, half of what interested me about this series is hearing you take a "what would I do now?" approach
Audio plosives and S are a bit hard maybe consider a pop filter - and boost a bit the sound. Quality is good as your content in general
i do my includes in the opposite order and change it until it compiles if necessary
1. Why didn't you kept the sprites in a map with the enum as key? I guess it would look not so terrible.
2. Loop with setting value to ImageBuffer in Renderer::Clear function:
for (uint32_t i = 0; i < m_Width * m_Height; i++)
m_ImageBuffer[i] = clearColor;
can be changed to single call from standard library:
memset(m_ImageBuffer, clearColor, m_Width * m_Height * sizeof(uint32_t));
which is faster since it uses SSE/AVX optimizations (you'll need only to align the buffer on recreation).
1. We're just getting started with the sprites API and won't keep it like this
2. Can't use memset here because we're trying to set uint32_t's and not bytes - for eg. Clear(0xffff00ff) won't work with a memset (not to mention the for loop is more than fast enough and will also be optimized)
As the variable clearColor is just a normal parameter the compiler likely is smart enough to convert it to movdqu or other larger instructions. Just for readability though i would suggest using std::fill - tells you that the memory is filled with that value. (well, a C++-version of memset would be nice - one that can be used with other things then char* ).
So much for being there
I think you should make spritesheet ignored color as alpha 0 from pink as a little challange (not as a some part of project, just as a temp code for this task)
It could be very good for learning more stuff
Great series! : D
Why not to use std::vector for imageBuffer or unique_ptr ?
god, I wish cherno used something like SDL or SFML for this one. It'd have been a thousand times much more interesting. Looking at him code in an API that I have absolutely no experience with just doesn't hit the same :(
I wish SDL had a consistent wiki that is at least half as detailed as Unity's wiki :(
It's really a mess and some things don't even have a wiki page.
Any tips for learning cpp coming from a Java background
learn you should probably go back to Java if you want to maintain sanity, or learn you should have never learned java if you want something that runs fast
Cpp and java are fairly similar. I believe Java was inspired by C++; the folks at Oracle wanted a more controlled and simplistic language so that “Everyone could code.”
The main difference between C++ and Java is that in C++ you manage your own memory. All objects in Java are passed by reference, and the task of freeing memory is managed by the garbage collector (which is pretty well optimized these days in Java - and is probably not your performance bottleneck). In C++, you can choose to pass by value or by reference, and can even choose whether to free your own memory or have it be garbage collected. The goal of C++ is choice.
The transition isn’t hard if you know Java already, but beware of using C++ specific features like smart pointers or operator overloading at the start. You can get sucked down a rabbit hole with feature creep. Like I said, C++ is about choice and freedom, but you can only really appreciate those tools after you understand the essence of the language. Otherwise it’s super easy to dig yourself in a really deep hole.
I would start by saying that there's more to the difference between the two than just that you "manage your own memory" with C++. And I'd say in modern C++, memory management is less important than in determining ownership of pointers. That is, determining who is responsible for cleaning up the mess afterward. That's the point of unique_ptr and shared_ptr. (And you can still pass the pointer to functions if you use unique_ptr by calling its get() function; you do this when you don't intend to pass ownership to the function, when it just needs to access it.)
Other considerations would be don't declare stuff as pointers or references if you don't have to. In C++, objects (and this concept has a very broad definition in C++) are by default value types, and you should take advantage of that.
In addition, you should make heavy use of the standard library, which is designed to be efficient. Cherno above should have put the data in a vector, for example. There are various highly useful algorithms you can use to simplify the layout of your code.
More tips can be found in the ISO C++ FAQ and the C++ Core Guidelines.
@TheCherno. Hey Yan! Nice videos! Sound is very deep now, I like it. by the way, what keyboard do you use?
C++ is not complicated, it's just confusing
Why not using modules?
Module support is very, very spotty right now. Visual C++ is the only compiler with module support that you could reasonably call production ready, and I think even that is a stretch, not to mention that build tool support is almost nonexistent. Maybe using modules will be worth it in a year or two when things have become more stable, but not yet.
As someone using modules in some small projects (in scope to his engine stuff) while great, they have a big drawback in tooling support. Visual Studio has the best support, but it's still really spotty. I personally have encountered broken intellisense (though it has gotten better over time), and syntax highlighting is also busted because of it from time to time. The parser just gets confused with the "import" statements or something.
@@ChrisCarlos64 Yeah it's definitely buggy, IntelliSense doesn't work for me either and have had to include std headers in the global module. Still for me I think it's worth it.
Hey, Cherno! Awesome video and series!
How did you set those not equal symbols in VS?
What's your opinion on Rust? A video comparing C++ to Rust would be cool.
Screw Rust, let’s hear about Carbon!
Screw Carbon, let's hear about Zig!
Screw all these, let's hear about Html
Screw all let's discuss porm
I love youtube comments
Hi, Cherno. Do you recommend any book or other resource for a beginner in c++ for windows (with GUI)?
There's a beautiful Harvard CS50 lecture on yt. 25h total and much of it in C++. Why book?
@RyNiuu some people learn better from reading than videos, each people are different
@@FirstLast-bo7ef Also helps when people actually know where to find such a lecture. Just mentioning it but not bothering to provide a link doesn't really help.
@@AliceErishech I guess he means this /watch?v=IDDmrzzB14M&list=PLhQjrBD2T380F_inVRXMIHCqLaNUd7bN4
no idea how much does this go into GUI tho
I think you should go with the sm7b! If output is the issue just get a fethead with it. Great content otherwise
Fits his voice and the youtube-vibe more than the tlm102, I agree.
microphone was good enough.
Hi cherno, Can we connect once.
I wanna get some valuable knowledge from you.
He has a patreon
Please make a DirectX video!
maybe a puff filter
languages: k.i.s.s.
Okay, genuine question: Why do you always look depressed in your thumbnails?
Not trying to sound rude, but I do want to remind you that you have a great engine, a following, and a really great amount of skills that give you a bunch of avenues in life. Love your channel and hope that you are doing alright in your life!
hi (ayo im fourth comment)
bad idea: make a ‘renderer’ responsible for resizing… … 🤦♂️🤦♂️🤦♂️ .. seriously?!
First
Making your first game? Lol we are not kids
Do you ever consider making mathematics videos? Mathematics that would be used in rendering? Ray tracing and so on?
He did some in the Raytracing series