Making a PARTICLE SYSTEM in ONE HOUR! (NO ENGINES)

Sdílet
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.

Komentáře • 132

  • @Danidev
    @Danidev Před 4 lety +309

    That's really cool, good job man!

    • @sp1xa
      @sp1xa Před 3 lety +2

      Dani!

    • @mdsadik6987
      @mdsadik6987 Před 3 lety +1

      @Dani Why you are not adding videos anymore

    • @markrobershorts
      @markrobershorts Před 3 lety +5

      Better than unity’s particles system?

    • @theeternal6890
      @theeternal6890 Před 3 lety

      *Wow..That's really cool. lol.. Dani is looking kinda ...THIICCC*

    • @Agent_Ax
      @Agent_Ax Před 2 lety +1

      Hazel's particle system goes brrrrrr

  • @pedroganme2503
    @pedroganme2503 Před 4 lety +255

    I would like very much a particle system mini-series

  • @Gunslinger962
    @Gunslinger962 Před 4 lety +81

    **Uses surfshark to block ads on this video**
    Cherno: wait! That's illegal

  • @MrAmix2
    @MrAmix2 Před 4 lety +33

    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 :)

    • @zoeherriot
      @zoeherriot Před 4 lety +1

      Assuming you're working with C++17 no?

    • @Luca-hn2ml
      @Luca-hn2ml Před 4 lety +2

      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.

  • @kyriet9303
    @kyriet9303 Před 4 lety +36

    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.

    • @egdrei
      @egdrei Před 4 lety

      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.

    • @RoySATX
      @RoySATX Před 2 lety

      "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.

  • @KingKarEl100
    @KingKarEl100 Před 4 lety +12

    As a programmer who loves maths and physics, I would love to see a physics engine series from you!

  •  Před 4 lety +34

    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.

    • @cognisent_
      @cognisent_ Před 4 lety +5

      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.

    • @TheJames12112
      @TheJames12112 Před 4 lety +3

      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.

    • @cognisent_
      @cognisent_ Před 4 lety +1

      @@TheJames12112 I actually wrote a small program to prove it to myself. Thanks for the sanity check, guys.

    • @chrisball249
      @chrisball249 Před rokem

      what's the solution?

    •  Před rokem +2

      @@chrisball249 start at zero and increment instead of going from the end and decrementing, otherwise the same

  • @nikoszervo
    @nikoszervo Před 4 lety +2

    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.

  • @krytharn
    @krytharn Před 4 lety +1

    The boolean `Active` is not necessary, you could simply check for `m_LifeRemaining

  • @BlackxesWasTaken
    @BlackxesWasTaken Před 4 lety +1

    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

  • @user-jn9pg3lx7g
    @user-jn9pg3lx7g Před 4 lety +4

    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 :)

  • @StrangeIndeed
    @StrangeIndeed Před 4 lety +5

    I'm glad to see that you're finally getting some sponsors c:

  • @PoetaKodu
    @PoetaKodu Před 4 lety +7

    There is uniform_real_distribution you can use instead of casting to float.

  • @oblivionronin
    @oblivionronin Před 4 lety +4

    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.

    • @abdulalhazred5924
      @abdulalhazred5924 Před 4 lety +2

      seems like someone's been watching some olc videos

    • @bigboiblue1925
      @bigboiblue1925 Před 4 lety +1

      Overengineering...

    • @oblivionronin
      @oblivionronin Před 4 lety +1

      @@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

    • @bigboiblue1925
      @bigboiblue1925 Před 4 lety +4

      ​@@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.

    • @TheStolenBattenberg
      @TheStolenBattenberg Před rokem

      @@bigboiblue1925 Thanks. I'll stop trying to optimize my renderer for now after reading this! I can feel myself slipping into that rabbit hole.

  • @Hello-vq4tn
    @Hello-vq4tn Před 4 lety +3

    I would love a particle system series!

  • @ali51717
    @ali51717 Před 3 lety +1

    this hour will take me a full week.

  • @florianhansen8440
    @florianhansen8440 Před 4 lety +2

    Perfect entry point for going into GPU instancing and render millions of particles at once :-)

  • @Rocco-tb9ih
    @Rocco-tb9ih Před 4 lety +1

    2:54 Hair changes between cuts lmao

  • @irfanjames6551
    @irfanjames6551 Před 2 lety

    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)

  • @zxuiji
    @zxuiji Před 2 lety

    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.

  • @mjthebest7294
    @mjthebest7294 Před rokem

    Still waiting for the Particle System miniseries :)

  • @aradarbel4579
    @aradarbel4579 Před 4 lety +6

    hi :D what books/sources would you recommend for learning about game programming and graphics? (I mean other than your wonderful videos ;D)

    • @BossBeneBaby
      @BossBeneBaby Před 4 lety

      Pretty much any "starting with OpenGL" book is a good way to get into CG

    • @BossBeneBaby
      @BossBeneBaby Před 4 lety +1

      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

    • @aradarbel4579
      @aradarbel4579 Před 4 lety

      @@BossBeneBaby yeah, I also like learning things through books. Thanks for the advice (as general as it is)

  • @JakobRobert00
    @JakobRobert00 Před 4 lety +3

    That was really interesting :) I would love a particle mini series 👍🏻

  • @XMickleXx
    @XMickleXx Před 4 lety

    yes plz make a particle series

  • @theeternal6890
    @theeternal6890 Před 3 lety

    *Ur logo made me remember Portal. Idk why but its trippy.*

  • @misterwahab6709
    @misterwahab6709 Před 4 lety

    STARTING WAS AMAZING

  • @ChlorieHCl
    @ChlorieHCl Před 4 lety +5

    Why don't you just use std::uniform_real_distribution for the random float though, why the division

    • @MsJavaWolf
      @MsJavaWolf Před 4 lety

      I agree. This is the style you would use when you use the C rand() function, in c++ there is a better way.

  • @laureven
    @laureven Před 4 lety +1

    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 :)

  • @Idan-Koren-Israeli
    @Idan-Koren-Israeli Před 3 lety

    Thank you so much man it was really helpful!

  • @nikolaiarsenov1595
    @nikolaiarsenov1595 Před 4 lety

    Dude, you should try batch rendering here.

  • @gergelypaless5042
    @gergelypaless5042 Před 4 lety

    Miniseries? I'm in! 😉

  • @MecegguemMohamed
    @MecegguemMohamed Před 4 lety

    nice work bro, i've been watching ur channel for long time and i learn a lot from u , thx u :)

  • @MsJavaWolf
    @MsJavaWolf Před 4 lety

    ISnt there a uniform float distribution in c++?

  • @tessiof
    @tessiof Před 3 lety

    Why this is not in your engine playlist?

  • @lukeparkhurst8683
    @lukeparkhurst8683 Před 4 lety

    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

    • @tusharreddy6977
      @tusharreddy6977 Před 2 lety

      I'm having the same issue
      Were you able to solve it?

  • @joshuatatmon8799
    @joshuatatmon8799 Před 4 lety +1

    I searched up ps4 on google one time and a bunch of ads about ps4s started showing up on CZcams. Coincidence I think not.

  • @peterdenham
    @peterdenham Před 4 lety

    NextDNS is also a great way to block trackers and ads.

  • @jaykayluo7145
    @jaykayluo7145 Před 4 lety +1

    Be a collision system in the next hour?

  • @ishida3730
    @ishida3730 Před 4 lety +1

    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.

    • @aradarbel4579
      @aradarbel4579 Před 4 lety +1

      I think you might be defining a variable in more than one file

    • @ishida3730
      @ishida3730 Před 4 lety

      @@aradarbel4579 well, it actually says that int main() has already been used by me . Is this by default or there is a problem

    • @kriluk1214
      @kriluk1214 Před 4 lety +2

      @@ishida3730 You can only have one main function in your project

    • @sirknight1291
      @sirknight1291 Před 4 lety +1

      You can try "pragma once"

    • @lengors1674
      @lengors1674 Před 4 lety +2

      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

  • @renatocesar9972
    @renatocesar9972 Před 3 lety

    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

  • @Chimponaut
    @Chimponaut Před 3 lety

    This part of the code: "glEnableVertexArrayAttrib(QuadVB, 0);" is working purely out of luck I assume? It should be QuadVA, right?

  • @treyquattro
    @treyquattro Před 4 lety +1

    nice work! But, hey! What are those C-style casts? Tsk tsk

    • @MrHEck-fd6mo
      @MrHEck-fd6mo Před 4 lety +1

      Trey Quattro you must be a female...
      “Tsk tsk” 😑

    • @treyquattro
      @treyquattro Před 4 lety

      @@MrHEck-fd6mo lol. What an odd thing to say, regardless of real or imagined gender.

    • @treyquattro
      @treyquattro Před 4 lety

      @@MrHEck-fd6mo you think Bjarne Stroustrup is female too, I suppose?

    • @MrHEck-fd6mo
      @MrHEck-fd6mo Před 4 lety +1

      Chill dude, it was a joke, I was talking about how you used ‘Tsk’ - nothing to do with C-style casts

    • @lightskinche
      @lightskinche Před 4 lety

      Tf you have against C?

  • @rikseth9606
    @rikseth9606 Před 4 lety

    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?

  • @nulljupiter6636
    @nulljupiter6636 Před 4 lety

    Can you share your color scheme for the actual code for Visual Studio?

  • @singhi89
    @singhi89 Před 2 lety

    thanks for sharing.

  • @raduhabinyak6860
    @raduhabinyak6860 Před 4 lety +1

    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

  • @P4R7Y24N7
    @P4R7Y24N7 Před 2 lety

    It's him!

  • @patrickwildschut5750
    @patrickwildschut5750 Před 4 lety

    Yeyyeyey intro!!

  • @link6563
    @link6563 Před 2 lety

    dis bussin

  • @themerpheus
    @themerpheus Před 4 lety

    Why not instanced rendering?

    • @themerpheus
      @themerpheus Před 4 lety

      @Keeper Holderson Yeah but, it's just an hour challenge. So, I don't really bother.

  • @CODEDSTUDIO
    @CODEDSTUDIO Před 4 lety +2

    The Cherno The Best #CODEDVYBES

  • @madeso
    @madeso Před 3 lety

    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();"?

  • @noesechet1026
    @noesechet1026 Před 4 lety

    I love it thank you

  • @YambamYambam2
    @YambamYambam2 Před 4 lety +1

    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!

    • @YambamYambam2
      @YambamYambam2 Před 4 lety +1

      Ah it actually says 57 minutes in the thumbnail, so you cut some stuff from the coding "footage"?

  • @thomasknapp7807
    @thomasknapp7807 Před 4 lety

    Where can I find the code?

  • @zooidiotgaming5784
    @zooidiotgaming5784 Před 3 lety

    Im new and i just download visual studio 2019 how can i compile ?

  • @cristichifan4453
    @cristichifan4453 Před 2 lety

    can someone help me run the project inside visual studio, please?

  • @Master_JM
    @Master_JM Před 4 lety

    Time to redo my particle system lol :D

  • @DDeathdealer007
    @DDeathdealer007 Před 4 lety +7

    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

  • @abdelrahman5094
    @abdelrahman5094 Před 4 lety

    are you one of blender developers team?

  • @badwolf8112
    @badwolf8112 Před 4 lety

    Dude what is this music?

  • @CreativeOven
    @CreativeOven Před 4 lety

    No engines woooot , well I'll figure it out.

  • @opod_dev
    @opod_dev Před 4 lety

    I cant even do particles in unity feelsbad

  • @osamaabuzayed2198
    @osamaabuzayed2198 Před 3 lety

    *hello*

  • @jamespong6588
    @jamespong6588 Před 4 lety

    *Particles must be GPU based 😏 [change my mind]

  • @wasit-shafi
    @wasit-shafi Před 4 lety

    osom keep it up....

  • @cofromdiscord118
    @cofromdiscord118 Před 4 lety

    Am I the only one who thought the thumbnail looked like bottom part of Africa

  • @ov3d246
    @ov3d246 Před 4 lety

    wow

  • @clodgozon3968
    @clodgozon3968 Před 4 lety +2

    Ooh I just gat home beech

  • @custard131
    @custard131 Před 4 lety +2

    another content creator fallen into the false vpn advertising trend :(

  • @fontainecards8437
    @fontainecards8437 Před 3 lety

    voll doof

  • @CoreDump07
    @CoreDump07 Před 4 lety

    In ONE hour, lets not really do it in one hour, instead we go over the complete code .....duh.

  • @sonwukong001
    @sonwukong001 Před 2 lety

    Cute