Making a PARTICLE SYSTEM in ONE HOUR! (NO ENGINES)
Vložit
- čas přidán 5. 09. 2024
- Get Surfshark VPN at Surfshark.deal... - Enter promo code CHERNO for 83% off and 1 extra month FREE!
Code ► github.com/The...
Patreon ► / thecherno
Instagram ► / thecherno
Twitter ► / thecherno
Discord ► thecherno.com/...
Series Playlist ► thecherno.com/...
This video is sponsored by Surfshark.
That's really cool, good job man!
Dani!
@Dani Why you are not adding videos anymore
Better than unity’s particles system?
*Wow..That's really cool. lol.. Dani is looking kinda ...THIICCC*
Hazel's particle system goes brrrrrr
I would like very much a particle system mini-series
Lets go!
Me too! :)
Definitely
Definitely would like to see that too!
Seconded
**Uses surfshark to block ads on this video**
Cherno: wait! That's illegal
About 'random.h' class: if you use 'inline static' instead of 'static' you can remove 'random.cpp'. It works exactly the same way but you don't have to declare static variables outside class marker :)
Assuming you're working with C++17 no?
Hey i've got a question:
Could you also just use a namespace "Random" with an anonymous namespace in it to hide the details? Then there would be no class at all.
24:34 it's soooo true.
What I really like in your videos and you as an youtuber is humility. There is huge lack of humility in software engineering. You are aware of weaknesses of the particle system you built, but you emphasise that IT IS SUFFICIENT for now. Your approach to problems shows me at every turn that you work in industry and you want to finish your projects - not only to polish them to the end of the world. Universities teach exactly the opposite.
I didn't personally see humility in that particular statement. Although I do think that Cherno is a humble dude. But I think he was referencing how a lot of people make overly complicated code that does not necessarily perform better, probably to look cool.
"There is huge lack of humility in software engineering." In all of history, this might be one of the truest statements ever. The tech fields in general have a humility deficit. If you ever want to see arrogance on full display go talk to a Network Engineer.
As a programmer who loves maths and physics, I would love to see a physics engine series from you!
At 13:16, unless I'm missing something, that will not wrap around to the max size of the vector. This due to uint32_t rolling around to its max value when subtracting one from zero. And then you get (2^32 - 1) % 1000 which is 295.
Holy crap, I thought I was going crazy; I even wrote some code to try to prove this didn't make sense. The "wrap point" varies based on the size, in his code. Definitely couldn't've been using the whole pool.
I have just been sat here with calculator open trying to work out how this was working. At least I'm not the only one thinking I was crazy.
@@TheJames12112 I actually wrote a small program to prove it to myself. Thanks for the sanity check, guys.
what's the solution?
@@chrisball249 start at zero and increment instead of going from the end and decrementing, otherwise the same
I can't wait for a model rendering system with Assimp! I've tried following a lot of guides but nobody explains exactly the exact structure of an Assimp data tree and how exactly to deal with different kind of models which have a different amount of diffuse and specular textures. Even coping pasting code from other people, these model systems always break on different types of model extensions.
The boolean `Active` is not necessary, you could simply check for `m_LifeRemaining
This Video just saved me so much time. Im currently working on a React Application and constantly thinking about improving my Components.. my Functions, etc..
They all work great and better than they should but this thinking is slowing me down.. but that just made me thinking "Hm.. its fine as it is and i dont need that complicated stuff when its that easy"
So helpful and nice Video!.. Thank you very much
ECS series please! i'm implementing ECS currently myself and struggling a bit to keep it clean, so i would like to see your "way" of tackling it :)
I'm glad to see that you're finally getting some sponsors c:
There is uniform_real_distribution you can use instead of casting to float.
Hey Cherno, awesome video ! loved it, that little app seems like a lot of fun to play around with and code. Definitly want to see a particle system series !
At 4:20 (heyyyyeee) i noticed that your random number generator is mt19937, which is absolutely awesome in terms of giving quote unquote good random numbers. but is also quite slow.
you shoudl look up the Lehmer Random number generator technique, its based on some prime number and is extreeemeely fast and also reliable as a good RNG. It will require 2 minutes of coding but will be infinitly worth it in terms of performance.
seems like someone's been watching some olc videos
Overengineering...
@@bigboiblue1925 how is it over-engineering to use a technique that litterally takes about 10 lines of code to implement and has performance benefits ?
Sure, now it doesnt matter, but latter on with thousands of sprites rendered every frame with possibly all their own particle systems (hundreds of additional sprite per entity, do the math), saving milliseconds on Rng for every particles is critical....so no, with all due respect, i dont agree it is over-engineering
@@oblivionronin Any experienced programmer knows that you can take hours writing 10 lines of code...
Lehmers algorithm would have been implemented multiple times is the past anyway, so learning about it and implementing it again is a waste of time, time that could have been spent developing other features.
But if your hellbent on optimising the fuck out of your code, why not just add the pre-implemented version present in the boost library.
I don't feel optimisation should be considered so early on in development. You could spend all year optimising a module of a system, however, you wont get much done beyond that. Sometimes you have to prioritise workflow in order to actually end up with an end product. Overengineering and perfectionism are dangerous things. I know this because I commonly fall into this trap myself.
@@bigboiblue1925 Thanks. I'll stop trying to optimize my renderer for now after reading this! I can feel myself slipping into that rabbit hole.
I would love a particle system series!
this hour will take me a full week.
Perfect entry point for going into GPU instancing and render millions of particles at once :-)
2:54 Hair changes between cuts lmao
If you can manage to explain "State Machine" with enums
you talked about in one of your videos; I would be thankful.
You were talking about using it to eliminate lots of if-else with bool variables in (space invader video)
14:54, question instead of 2 conditionals that lead to a continue statement, why not just check 'lifeRemaining' only? I imagine the compiler would easily devolve a "< 0" comparison to a plain integer comparison during optimisation stage, leaving a much quicker handling than what 2 conditionals would bring.
Still waiting for the Particle System miniseries :)
hi :D what books/sources would you recommend for learning about game programming and graphics? (I mean other than your wonderful videos ;D)
Pretty much any "starting with OpenGL" book is a good way to get into CG
What book you take depends on what style of learning you prefer but overall books are great to learn things even in todays time where everything is fast pace, digital and most times just not as compressed as in books/e-books
@@BossBeneBaby yeah, I also like learning things through books. Thanks for the advice (as general as it is)
That was really interesting :) I would love a particle mini series 👍🏻
yes plz make a particle series
*Ur logo made me remember Portal. Idk why but its trippy.*
STARTING WAS AMAZING
Why don't you just use std::uniform_real_distribution for the random float though, why the division
I agree. This is the style you would use when you use the C rand() function, in c++ there is a better way.
The only way for internet access for me is my mobile phone and this is a metered internet. I don't know how many of You have the same problem but would be beneficial for this type of CZcams customers if fonts in Your video where1.5x bigger because I watch this video in 480p. I can still see it but I have to pause and literary spend a second on each word to be able to read it. You have Your statistics and If You would decide that it is beneficial for the majority of Your viewers to increase the font size, then this would be great :) for me too :)
Thank you so much man it was really helpful!
Dude, you should try batch rendering here.
Miniseries? I'm in! 😉
nice work bro, i've been watching ur channel for long time and i learn a lot from u , thx u :)
ISnt there a uniform float distribution in c++?
Why this is not in your engine playlist?
How does your file pathing work? I am attempting to recreate your project but have trouble with it as vsCode and CLion can not detect the header files for multiple vendors and GLCore's, not without massive modifications to file locations
I'm having the same issue
Were you able to solve it?
I searched up ps4 on google one time and a bunch of ads about ps4s started showing up on CZcams. Coincidence I think not.
NextDNS is also a great way to block trackers and ads.
Be a collision system in the next hour?
Hey everyone, a silly question. Please Answer.
When I keep more than 1 files in my cpp project and when i try to run a particular file, it shows an error where it says that int has already been defined but when there is only 1 file in project, it Debugs perfectly.
I think you might be defining a variable in more than one file
@@aradarbel4579 well, it actually says that int main() has already been used by me . Is this by default or there is a problem
@@ishida3730 You can only have one main function in your project
You can try "pragma once"
Having a doubt like that is a good indicator that u need to learn more about c++ before watching this series!
That said, the reason why that's happenning is because u're reimplementing the same function (main) in different translation units (aka cpp files), this is a problem because then the linker won't know which version of that function to link to.
If u want to have multiple cpp files each one with an implementation of the main function, u've to have a different project for each one of those cpp files so that ur compiler generates an application for each one of those
I'm making my onw particle emitter with pygame. I'm basing it in godot particle.
My problem is how to manage the life time and the amount of particles params at the same time.
like how to emitt each frame a certain quantity of particles that reaches the maximum amount. Can't even explain it in english kkk
This part of the code: "glEnableVertexArrayAttrib(QuadVB, 0);" is working purely out of luck I assume? It should be QuadVA, right?
nice work! But, hey! What are those C-style casts? Tsk tsk
Trey Quattro you must be a female...
“Tsk tsk” 😑
@@MrHEck-fd6mo lol. What an odd thing to say, regardless of real or imagined gender.
@@MrHEck-fd6mo you think Bjarne Stroustrup is female too, I suppose?
Chill dude, it was a joke, I was talking about how you used ‘Tsk’ - nothing to do with C-style casts
Tf you have against C?
Hey, why don't you create a game with the private branch of Hazel? Just don't expose the source. Just a one-hour challenge. It would just be a good showreel of what we are heading towards. What do you think?
Can you share your color scheme for the actual code for Visual Studio?
thanks for sharing.
What if you want to make craftable items and one of them can emit particles, something like a torch
Because then there would be new particle systems created all the time
It's him!
Yeyyeyey intro!!
dis bussin
Why not instanced rendering?
@Keeper Holderson Yeah but, it's just an hour challenge. So, I don't really bother.
The Cherno The Best #CODEDVYBES
You say you want simple code, but then at 13:19 you write "m_PoolIndex = --m_PoolIndex % m_ParticlePool.size();"
Whats wrong with "m_PoolIndex = (m_PoolIndex-1) % m_ParticlePool.size();"?
I love it thank you
Wow you didn't just do it within an hour, you did it in half an hour? And you were even explaining stuff while coding it!
Ah it actually says 57 minutes in the thumbnail, so you cut some stuff from the coding "footage"?
Where can I find the code?
Im new and i just download visual studio 2019 how can i compile ?
I have the same issue
Were you able to fix it?
can someone help me run the project inside visual studio, please?
I have the same issue
Were you able to fix it?
Time to redo my particle system lol :D
Will he manage it within an hour?!
Spoiler alert, the video < 30 minutes long :)
Second spoiler... he cut some time out!
Final spoiler... He did it in time
are you one of blender developers team?
Dude what is this music?
No engines woooot , well I'll figure it out.
I cant even do particles in unity feelsbad
*hello*
*Particles must be GPU based 😏 [change my mind]
osom keep it up....
Am I the only one who thought the thumbnail looked like bottom part of Africa
wow
Ooh I just gat home beech
another content creator fallen into the false vpn advertising trend :(
voll doof
In ONE hour, lets not really do it in one hour, instead we go over the complete code .....duh.
Cute