Тёмный

Rendering Sprite Pixels in C++ 

The Cherno
Подписаться 657 тыс.
Просмотров 34 тыс.
50% 1

Опубликовано:

 

13 сен 2024

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 55   
@TheCherno
@TheCherno Год назад
Hope you're enjoying this series as much as I am! ❤(and don't worry, I haven't forgotten about the Ray Tracing series!) While you wait for the next episode, check out Brilliant's new 30-day free trial! Visit brilliant.org/thecherno - and also the first 200 of you will get 20% off Brilliant’s annual premium subscription!
@afterschool2594
@afterschool2594 Год назад
Love it thanks
@oamioxmocliox8082
@oamioxmocliox8082 Год назад
;))
@Alkanen
@Alkanen Год назад
I can't help but get the feeling you've forgotten about us raytracers =(
@sumikomei
@sumikomei Год назад
Considering there's no fading of alpha or otherwise in the sprite sheet, you could just replace the two magenta "alpha" colors with transparency and then of course use the alpha channel for the conditional draw. I'm sure you've already thought of that, I'm mostly just talking to myself lol
@aronseptianto8142
@aronseptianto8142 Год назад
i think the idea is that he have to use the exact png that was made before
@sumikomei
@sumikomei Год назад
@@aronseptianto8142 yeah probably, though still a harmless and easy change all things considered
@mkraulis
@mkraulis Год назад
Watching these tutorials is helping me understand the conceptual aspects of the overall framework, which are used in a game code, much better. Thanks. (Don't know if that made any sense)
@umairazfar
@umairazfar Год назад
I absolutely love how Cherno explains everything. I hope he creates a haskell series because Good tutorials on it are non existent
@kostiapereguda
@kostiapereguda Год назад
I don't think that even Cherno can fully understand Monads🤣🤣
@sandy__matt
@sandy__matt Год назад
great series. nested iterator scanline software rendering is brutal, but it clearly works.....ship it!
@vertexforger
@vertexforger Год назад
Hey Cherno, I am a newbie to C++ and I am curious about the usage of C-style casts vs Cpp-casts. For example, I see at 24:20 that you use a C-style cast (uint32_t*) instead of static_cast. Did you do that on purpose for some specific reason or is it just an old habit? Based on my limited reading I've gotten the impression that Cpp-style casts are better for readability and because cpp-style casts can be checked at compile time while C-style ones can fail at runtime. It's probably not a significant thing to point out in many cases, but as a beginner I am trying to build good habits from the start and thus why I mention it. Thanks in advance.
@firefly9899
@firefly9899 Год назад
static_cast is preferable because it is more explicit about what kind of casting you want to do. In this case though he is casting to a pointer, which means as long as that object can be coerced into a pointer, there is no error raised at compile time either way. (I think static_cast would raise a warning for undefined behavior though). Hope this helps.
@pxolqopt3597
@pxolqopt3597 Год назад
Static cast is very verbose, and after a while you get lazy and use C casts. Its not a big deal, chances are it won't crash.
@szaszm_
@szaszm_ Год назад
He's not following a lot of industry best practices. C++ style casts are somewhat safer, but it would be best to not cast it at all, just store the image as is. He didn't disable copy and move, so an accidental copy will result in double free. Constructors should throw an exception on error, not just write to the output. Raw pointers should not be owning. Using named algorithms would be nicer than raw for loops. If you want to write the best code, I suggest to read and follow the C++ Core Guidelines. You can use clang-tidy to enforce the rules and best practices.
@ultimatesoup
@ultimatesoup Год назад
You could also use constexpr with class templates to set all the solid properties of a tile class at compile time. I've been writing engines also 30 years so I'm very good at finding these types of optimizations
@nghiapham6000
@nghiapham6000 Год назад
Your videos cured my p*rn addiction, Cherno! Thanks
@MattGradwohl90
@MattGradwohl90 Год назад
I think you should make a helper class for sprites so the math isn't repeated all over the place. Also, I agree you don't want to do the subclass like you did in Java. I would consider making a simple spritesheet editor that let you add or edit sprites, save the image, but also save the aatributes per sprite in another file. e.g. it's position, size, and other attributes like "should be affected by lighting" or "is not passable" or "kills the player" or whatever. It could also include important things like the width and the height (for allocating the mem), the name of the sprite sheet, what color is alpha, blah blah.
@pxolqopt3597
@pxolqopt3597 Год назад
I think in this case since he is unlikely to add more sprites, i'd just hardcode the attributes of each sprite. It wouldn't be hard to hardcode attributes for sprites you add on later down the road.
@ultimatesoup
@ultimatesoup Год назад
If you really want to specifically get into graphics effects programming, there is a really good book called Real Time Rendering. It's not a coding book so there is no code in it, but it does a GREAT job of explaining the algorithms for 100s of different types of lighting and effects
@heitorfarhat5555
@heitorfarhat5555 Год назад
What s the name of the tool used to draw to the screen? Your presentation and deep dive looks great using it.
@jmcalcote
@jmcalcote Год назад
Hey Cherno. I watched your game programming in Java series a couple of years ago and really enjoyed it. It seems like you assumed a bit more experience there than you are here in this series. I guess I’m encouraging you to take it up a notch, please - unless a lot of other people need help with array indexing arithmetic, of course. Great job, as usual. Love your videos.
@MattieBW
@MattieBW Год назад
I think modifying Walnut would be good, things like a cpu only image are features that should be in the library anyways, so if you can get content and features at once then might as well do it
@tropicalbottle
@tropicalbottle Год назад
The colorscheme of your theme is jsut beautiful ! What's the name of the theme ? :O
@dinhnamlehoang33
@dinhnamlehoang33 26 дней назад
hi cherno, how can you zoom in so close to see pixel? i try to capture img by snipping tool, but still can't zoom in like you did.
@bfkmnemonic
@bfkmnemonic Год назад
It would be nice if you could have your key presses shown on the screen. Sometimes you are going really fast in Visual Studio.
@rittol2365
@rittol2365 Год назад
What app are you using to draw ln your screen, no matter what is open?
@matthewmurrian9584
@matthewmurrian9584 Год назад
You only have to break the sprite sheet into individual sprites once. Any why wouldn't you? You don't save memory keeping it in one sprite sheet. And with them all in one sprite sheet, your memory accesses are much more fragmented than they could be.
@kostiapereguda
@kostiapereguda Год назад
Is it ok to put const function implementations in the header files?
@kostiapereguda
@kostiapereguda Год назад
Yes, it is
@DRAGON_FullPower
@DRAGON_FullPower Год назад
Java Version: Around 700-800 fps Probably the c++ version will have like 2000 fps:)))
@ruiuniver4
@ruiuniver4 Год назад
what is ur computer setup?
@Spongman
@Spongman Год назад
auto sprite = spriteSheel.getSprite(2, 8); for... auto pixel = sprite.getPixel(x, y)
@Jorgen12
@Jorgen12 Год назад
Make a video about DirectX!
@vastaebeirnvalkier2804
@vastaebeirnvalkier2804 Год назад
Well done son!
@guilherme5094
@guilherme5094 Год назад
👍!
@oamioxmocliox8082
@oamioxmocliox8082 Год назад
;)
@_dekinci
@_dekinci Год назад
Honestly it's a bit too verbose for me, I would prefer to see more coding and less explanations at this point
@awsumturtle
@awsumturtle Год назад
that's the whole point of cherno, he actually knows what he's doing so he's explaining everything thoroughly. not like other coding tutorials
@fanisdeli
@fanisdeli Год назад
@@awsumturtle he did say that this series is made for beginners. There are other stuff he's done that are more complicated and less beginner friendly. As far as I understand, this series will be as beginner friendly as possible, and will only get to the "hard" stuff at the end, when he'll go one step further and implement all that stuff in vulkan.
@greg77389
@greg77389 Год назад
@@awsumturtle This isn't really a tutorial though. He's porting a very specific game that HE made. No one is going to try this themselves.
@awsumturtle
@awsumturtle Год назад
@@greg77389 Yeah but most of his tutorials I've seen have been very thoroughly explained.
@Jkauppa
@Jkauppa Год назад
if you need to learn, you are clearly lacking and not perfect, do you see the difference, between perfect and lacking/empty
@Jkauppa
@Jkauppa Год назад
I love perfect God given God's free gifts
@ДавидПлеван
@ДавидПлеван Год назад
Nobody asked to point out the obvious.
@Jkauppa
@Jkauppa Год назад
@@ДавидПлеван ?
@ДавидПлеван
@ДавидПлеван Год назад
@@Jkauppa "if you need to learn, you are clearly lacking and not perfect, do you see the difference, between perfect and lacking/empty" - why did you feel the need to point out that if someone needs to learn they're lacking and not perfect? This is obvious to anyone with a brain. And what human with a brain doesn't understand the difference between "lacking" and "perfect"? What is the point of your comment? Did you try to educate someone? Did you try to establish that you somehow posess forbidden knowledge that the "simpletons" don't realize?
@Jkauppa
@Jkauppa Год назад
@@ДавидПлеван ?
@blackimp4987
@blackimp4987 Год назад
next series... you port everything in assmbly. I know you can do it :D
Далее
to static, or not to static?
32:58
Просмотров 37 тыс.
GRASS RENDERING in OpenGL // Code Review
47:23
Просмотров 117 тыс.
НЕВОЗМОЖНЫЙ ЭКСПЕРИМЕНТ
00:39
Просмотров 74 тыс.
А ВЫ ЛЮБИТЕ ШКОЛУ?? #shorts
00:20
Просмотров 2,8 млн
To mahh too🫰🍅 #abirzkitchen #tomato
01:00
Просмотров 6 млн
Как подписать? 😂 #shorts
00:10
Просмотров 822 тыс.
What Is 𝓖𝓸𝓸𝓬𝓱 Shading?
7:07
Просмотров 88 тыс.
C++ vs Rust: which is faster?
21:15
Просмотров 393 тыс.
How to Debug Graphics Issues
29:32
Просмотров 44 тыс.
Every Programming Language Ever Explained in 15 Minutes
15:29
BEST WAY to read and understand code
17:24
Просмотров 157 тыс.
I Made a Graphics Engine
6:42
Просмотров 252 тыс.
BETTER Header Files and Preprocessor Debugging
24:26
Просмотров 71 тыс.
You Should Learn C++ (for hacking games)
6:11
Просмотров 459 тыс.
НЕВОЗМОЖНЫЙ ЭКСПЕРИМЕНТ
00:39
Просмотров 74 тыс.