The Value of a New Tool
My exploration with C++ and how it reignited my passion for generative art.
I kept telling myself this past year that I was just too busy to make art. I would post new work and the caption would be “haven’t posted in a while but I’m hoping to get back into it!” But fairly quickly the spark would die down and I would not make art for a couple weeks or months. I was feeling stuck, like I wasn’t creating anything new or meaningful or even interesting. To be fair to myself, I was busy with my last semester of college, trying to focus on spending time with my friends. I do believe that breaks like this can be valuable to refill your pool of creativity, but even after I graduated, I still felt myself trudging through the motions whenever I tried to make art.
I felt like every idea I had was just some sort of repeat of what I’ve already done, some collection of circles and squares moving about the screen, in a grid or along a flowfield (a grid of vectors that guide particle movement) or moving randomly. And I think it looks cool! But I felt like I was just repeating myself over and over, copying the same code from one project and adding it to another.
That is the nature of generative art though, it’s a constant iterative process that improves slowly and slowly and only when you zoom out do you see the extent of your improvement.
On the left is one of my first ever flowfield pieces, from 2021, and on the right is a flowfield piece from 2024:


Despite clear improvement, for some reason I still felt stuck in my art practice, like I had been doing the same thing for years. But this summer, attempting to take advantage of my free time before I start my full time job, I decided to learn openFrameworks, a C++ library for creative coding. This choice was driven by p5.js's performance limitations – I often found myself recording at 1-2 frames per second, which slowed my creative process significantly.
The limitations of p5.js became even more clear when I started working on a flocking algorithm, which simulates how groups of animals like birds or fish move together. Each particle in the simulation has to take into account all of the nearby particles, which can quickly overload your computer with calculations as you increase the amount of particles (or boids, as they're called in flocking simulations). Even with optimizations like quadtrees, a method of dividing space to efficiently locate nearby objects, p5.js still struggled to get more than 500 particles. I want to do a whole writeup on flocking algorithms in the future so I will spare you the details, but if you want to learn more I might suggest this flocking chapter in The Nature of Code (a free online book on creative coding!).
I wanted more particles! Much more!
C++ and openFrameworks was my solution to this problem, because it’s much faster than p5. C++ compiles to machine code, has low level system access, and all that good stuff like less abstraction and manual memory management. It is powerful, but much scarier than Javascript because it’s harder to write and debug. Luckily, I took a systems programming class this year, so I had some experience with C++, otherwise I may not have had the courage to start. And I also had Claude 3.5 Sonnet, Anthropic’s new AI model which is insanely impressive from a coding standpoint, to help me translate some of my p5.js code to C++/openFrameworks.
It was a bit of a process to get openFrameworks running on my computer, and I ran into quite a lot of bugs at first when I attempted to translate my flocking code, but slowly I got it working. Although definitely faster than p5.js, the upper limit was around 1500 or 2000 particles running around 40 or 50 FPS.
I had a lot of fun trying to optimize my code, and eventually after 2 days of trying and failing, I got parallelization for the simulation calculation to work (splitting the calculations between multiple CPU cores) and prevented off-screen rendering of the particles, as well as some smaller optimizations.
Eventually, I was able to get 10,000 particles running at 40 FPS. I was quite proud of my code.
I can’t show videos on Substack, but check out my Instagram for some of these flocking algorithms in action.
These look awesome, but more importantly it was so exciting to program them. I could not stop thinking about flocking algorithms (I know, I know, I am such a nerd) and ways I could improve my project. Coding was exhilarating again, like I was exploring a new frontier.
Learning a new tool like C++ didn't just solve my technical limitations – it reignited my passion for creative coding. It turned code and art into a fun problem to solve again.
Stepping out of your comfort zone and embracing new challenges can be the key to overcoming creative blocks. What new skill or tool could you explore to shake up your own creative process? I'm excited to keep pushing the boundaries of what's possible with my art using openFrameworks. Here's to solving more problems and creating unexpected beauty along the way! See you next time.