HW#1: Particle System

In this assignment you will create some particle systems using the C++ language and the SFML library (or similar -- check with instructor first) for this homework assignment. Students in the main campus section may use any technology except Processing/Java (since that would only involve a copy/paste of code from Shiffman's book).

The following resources may be of help in performing this assignment:

Building an Advanced Particle System, John van der Burg

Chapter 4: Particle Systems, in The Nature of Code, Daniel Shiffman

1. Simple points. In this particle system, each of the particles is a simple point, and has an emitter fixed at a specific location. Each particle has a fixed velocity, direction, and lifetime which are randomly assigned at time of creation. The program must have a way to increase and decrease the total number of particles (such as via keypresses) while the particle system is running. Explore how many particles can you have before your system slows down!

The tutorial code shown on this SFML tutorial page accomplishes everything except for the growth/shrinking of the number of particles.

2. Gravity. Change the particles so they have a gravity (an acceleration), and the emitter only emits particles in a specified range of angles.

3. Shapes and multiple emitters. Modify the particles so that they are a textured polygon. Allow multiple particle systems to be active at the same time, each with a different visual effect.

Performing the above is sufficient for a B grade (passing this homework assignment). For an A grade:

4. Add a repellor/attractor. Make it possible to add one or more repellor/attractor elements to the simulation. A repellor/attractor repels/attracts particles to a fixed point at a specified acceleration (see Section 4.12 of Chapter 4: Particle Systems for a discussion of repellor/attractors and how to implement them in a way that is minimally intrusive to the particle.

5. Create an engaging visual demonstration. Create an interesting visual demonstration using your particle systems! Be creative, and show off your artistry using particles!

Homework submission:

  • For #1-4. submit source code of your final particle system (i.e., for #3 or for #4), either via a Zip file to a shared Google Drive folder, or a link to GitHub
  • For #5, submit a link to a short video on YouTube demonstrating your particle system. Keep in mind that you may wish to use this video in your online portfolio.