Skip navigation

Andrew Bell

warning: Creating default object from empty value in /var/www/vhosts/ on line 33.

Cinder is a peer-reviewed, free, open source C++ library for creative coding.

Our Philosophy

Cinder provides a powerful, intuitive toolbox for programming graphics, audio, video, networking, image processing and computational geometry. Cinder is cross-platform, and in general the exact same code works under Mac OS X, Windows and a growing list of other platforms — most recently the iPhone and iPad.

Cinder is designed to take advantage of platforms’ native capabilities whenever it’s possible, and relies on a minimum of 3rd party libraries. This makes for much lighter, faster applications, and means Cinder apps get free performance, security and capability upgrades whenever the operating system does.

We also have worked hard to create a library that feels familiar and intuitive to C++ programmers, building on the idioms and techniques the C++ community has developed over its long history. Cinder’s modern internal memory management virtually eliminates leaks, not only of memory but also of resources like OpenGL textures. We make use of the exceptional Boost libraries to fill in any gaps, and always favor techniques built on features which are currently or soon will be standard C++ (such as std::thread or std::shared_ptr).

We are proud of Cinder, and while we think you’ll be hard-pressed to find a more powerful environment for creative coding, we’re just getting started. We hope you’ll take the time to experiment with Cinder yourself, and if you like what you see, come join our community.

Your rating: None

I have just released a new tutorial for Cinder. It is a 5 chapter addition to Hello, Cinder. It covers the creation of a flocking (or shoaling) system. I used the source code from this tutorial to make the following video.

The tutorial is based on the teachings of Craig Reynolds whose landmark 1987 paper on flocking behavior is still the foundation for most flocking simulations. It has also been influenced by the work of Iain Couzin of the Princeton Collective Animal Behavior lab. I particularly enjoy this short lecture he gave at the inaugural webcast of Awe-maggedon by RadioLab.

The flocking tutorial picks up where Hello, Cinder tour left off. In the first 5 chapters (section 1) of the tour, we create a 2D particle engine. The next 5 chapters (section 2) turn the particle engine into a 4 rule flocking system complete with predators.

Chapter 1 discusses the Cinder Camera class and explain how to create a 3D perspective camera. I also add a graphical interface that can be used to control parameters in real-time.

Chapter 2 introduces the first rule for our flocking simulation: Separation (repulsion). We show how to use a repulsive force to keep particles from getting too close to each other.

Chapter 3 explains the second rule: Cohesion (attraction). Now we show how to keep the particles from drifting too far away from each other.

Chapter 4 adds the third rule to the simulation: Alignment (orientation). The particles are now able to change their flight direction based on the flight direction of neighbors. The flocking behavior finally emerges.

Chapter 5, the final chapter, personalizes the rules and introduces a fourth rule: Evasion. Predators are added to the simulation. They chase after the particles by focusing on areas of high concentration. At the same time, Particles (prey) make every effort to flee from any nearby predators.

There is a source code Cinder project for each chapter so you can follow along with the tutorial. If you wish to dive right in and start playing with the flocking source, go straight to the Section 2: Chapter 5 source. It contains the same logic I used to make the Bait Ball video below:

The tutorial received much loving feedback and editing from Andrew Bell, Mike Creighton, and Noah King. Many thanks to them all. If you have any feedback, advice, or improvements, please contribute to the Cinder forum post, Flocking Tutorial.

You can download the source for the whole 10 chapters here or just grab it off the git repo.

Your rating: None