Skip to main content
  1. Teaching/
  2. Su2024 CS N324E/
  3. teaching/

Project 5: Simulation

This project explores simulation and other rules-based systems. This project is intended to be open-ended, so that you have the opportunity to explore the aspects of simulation that interest you most. You may choose between three types of simulation to implement:

  • A particle system
  • A physics-based system
  • A rules-based system (e.g. cellular automata)

Basic Requirements
#

You will write the following pieces:

  1. A 2D or 3D scene (or scenes) drawn via Processing
  2. A simulation (or set of simulations) that covers at least one of the simulation concepts described above.
  3. A project report to detail overall design goals.

Your simulation must also have the following:

  1. At least one class to be simulated in the scene. Objects of this class will move according to the rules you decide on. The object must be beyond the scope of what’s shown in the class or discussed in the book.
  2. At least two rules or forces to guide object behavior. For example, you may use gravity, spring forces, flocking rules, etc.
  3. Unique visual appearance of the simulated objects. It should be something a little more exciting than just ellipses, rectangles, or other “basic” Processing shapes.

Project Ideas
#

If you’re stuck on what sorts of things you can simulate, below are topics you might find interesting and engaging to work on:

  • Flocking behavior (automata)
  • Disease spread (automata)
  • Minecraft terrain smoothing (automata)
  • Any of the simulations from https://github.com/zshipchandler/particle-simulator
  • Hair (physics-based)
  • Cloth (physics-based)
  • Simple 2D fluids (physics-based)
  • Notable extensions on any examples from class (ask the instructor beforehand)

Project Report
#

Create a project report as specified in the Project Report rules

Make sure your report includes the following information:

  • What the simulation is intended to depict
  • What classes you have designed and what they do
  • The rules of force (or interaction) acting in the simulation
  • How you drew the elements
  • Any unexpected challenges you faced along the way
  • Any extra credit you implemented

Language Model Log
#

You should either submit a log of your language model interactions, or a statement that you did not use LMs for this project. In either case, you will need to submit a file in your project on your LLM usage. See the rules on language model logs for details.

Extra Credit
#

Decoupling the frontend and backend (6 points)
#

In class, I mentioned that tying program logic to the framerate of the screen is a terrible idea. We have proceeded to do this anyways throughout most of the class, because the alternative is somewhat tricky to get right.

Implement a mechanism that makes it so that your draw loop and simulation step occur on separate threads. The simulation thread will simply update the simulation state constantly, while the draw loop will render the current state of the simulation.

In order to do this, you will need some way to specify how fast the simulation runs, since you have decoupled the simulation from the framerate: if you run the simulation as fast as possible, the speed of simulation will depend on how fast the computer running the program is, e.g. if the computer can do twice as many calculations per unit time, the simulation will run twice as fast.

To avoid this, I suggest using the millis() function from within the simulation loop to delay if the simulation step completes too quickly.

You will need to use the thread() function from Processing, or the lower-level java.lang.Thread class, to accomplish this extra credit.

Submission
#

Your submission should include the following:

  1. A Processing file named youreid_project5.pde that runs the simulation.
  2. All the necessary classes and subclasses for the Processing file to run.
  3. Your project report, with the information specified above and the project report guidelines.
  4. Your language model log

Place this all into a directory named youreid_project5, zip the directory, and submit it to Canvas.