I’m just gonna write down everything I remember from the crash course Ahmet gave me tonight on the two particle systems I just had to make for homework.
For the C++ one, we had to make a particle, a particle system, and a main for where the two interact. The particle started off with a header file, where we defined the particle and the various pieces of the particle that made it what it is (initial velocity, initial size, initial color, initial texture, and I think a few others.) Then we created a .cpp file where we typed functions that defined where the particle spawned and what it did. Most of these weren’t literally what the particle did, more like “a bunch of variables showing what the particle will be doing once the ParticleSystem tells it what those variables are gonna be” since 90% of the project requirements involved making sure everything was variable.
So once you had that, the ParticleSystem mostly housed useful functions for determining random numbers, and it had the actual functions that spawned particles using for-loops. There was a header file for the ParticleSystem, which defined what it was and what variables it needed to call, and then the Particlesystem.cpp actually did so, and added variations for all of those attributes we defined in the particle header. The main seemed to mostly define the game’s window itself and then call/draw the ParticleSystem and particle so it would actually appear in the game itself.
Unity was different, because it has a built-in engine for particles, so we didn’t have to code at all. We downloaded a bunch of free textures off the Unity Asset store and then grabbed an in-house item called a ParticleSystem from the repository. It came with all the settings caked right into a giant HUD, and you fiddled with them to get the shapes, sizes and behaviors you wanted. The way you string multiple pieces of the particle system together (i.e. explosion->shock wave->smoke) is by setting time delays on the last two so they don’t start playing until after the one beforehand finishes.
The way you made the shockwave was by creating a single particle, set to position 0,0 and speed 0, given a ring material and set to increase slowly in size. I spent way too long trying to make a circle of particles behave properly until Ahmet just told me the right answer to that one.