Introduction
Hi. My name is Robert Hodgin, and I am the author of this tutorial (with helpful input from Andrew Bell, Mike Creighton, and Noah King). I want to help others get started with Cinder because learning a new framework can be intimidating.
Things are going to be pretty informal. Think of this as a quick-start guide. Instead of exhaustively covering a topic before moving on to the next, I am going to meander around a bit and sample some of Cinder's many features along the way. Hopefully, this tutorial will inspire you to continue to explore Cinder and learn to love it as much as I do.
In Section One, I will show you how to go from a brand new Cinder project to a particle engine with both local and global forces, and then use it to achieve some artistic effects. Along the way, I will point out a few of Cinder's features as well as explaining a bit about my personal coding practices. If you wish to see what you will be working towards, check the final video at the end of Chapter 5.
In Section Two, I will tweak the particle engine from Section One and use it as a basis for a flocking simulation. Over five chapters, I will show how to create and control a 3D camera system and show how to set up a graphical interface for controlling variables in runtime. Then I will explain and implement four rules for a robust flocking simulation. By the end of Section Two, you will have a fully functioning 3D flocking simulation complete with predators and collision avoidance.
Section One: Introduction and Particle Engine
Chapter 1: Getting Started
In the first chapter, we will set up a new project and learn how to load and display images. We go on to show how to draw simple shapes and we even set up a basic Particle engine.
Chapter 2: Personality and diversity
We continue to expand our Particle engine. We also learn how to pull color data from images and put that information to good use.
Chapter 3: Influence
In chapter 3, we show how to use keyboard and mouse input to control our Particle engine.
Chapter 4: Fine tuning
A birth/death cycle is added to our Particle class and Perlin noise is introduced.
Chapter 5: External Forces
We show you how to use nested iterators to allow the Particles to interact with each other. We then tie everything together and marvel at how far we have come.
Section Two: Flocking Simulation
Chapter 1: Camera and Parameters
We will learn about the Cinder Camera class and use it to create a 3D environment for the Particle engine we made in Section One. Then we will show how to setup a Params class for controlling variables during runtime.
Chapter 2: Rule One - Separation
The first rule of flocking is described and implemented. This rule states that all flocking objects should avoid getting too close to each other. This helps to mitigate overcrowding and collisions.
Chapter 3: Rule Two - Cohesion
The second rule is one of attraction. Flocking objects will move towards each other in order to prevent any individual from becoming isolated and exposed.
Chapter 4: Rule Three - Alignment
The third rule is arguably the most important. Alignment, or orientation, states that flocking objects will try to move in the general direction of the nearest neighbors. This inevitably leads to characteristic group behavior that is witnessed in large groups of birds and fish.
Chapter 5: Rule Four - Evasion
In this final chapter, we will add a few predators to the simulation and show how to add personality and behavioral diversity to the flock in order to produce a more organic result.
Okay, enough with the introduction. Let's dive right in.