Learning How to Swarm

I learned about swarms a number of years ago from online lectures and articles in Architectural Design (AD) such as Swarm intelligence (2009) by Neil Leach. The topic has been discussed in architecture for at least two decades with research papers (2000) that still included Altavista email addresses. I had no idea how or where to get started with swarms. I didn’t know what software to use nor did I understand the logic of how swarms work. My first assignment this term used the Boids plugin for Grasshopper. Boids was an artificial life program written in 1986 by Craig Reynolds and presented one year later at SIGGRAPH ’87 with the title “Flocks, herds and schools: A distributed behavioral model.” Boids is short-hand for ‘bird-oid object’ as well as how New Yorkers pronounce ‘bird.’ Reynolds suggested three rules that were capable of simulating an emergent flocking, bird-like behavior. These are alignment, separation and cohesion. Further rules can be added such as obstacles, boundaries and goals among many others. Reynolds worked on special effects for films such as Tron (1982) and Batman Returns (1992). The boids algorithm was used to simulate bats moving with a natural behavior pattern. These advances won Reynolds an Academy Award in 1998 for his “pioneering contributions to the development of three-dimensional computer animation for motion picture production.” He later utilized this same logic in his work with self-driving cars.

A number of designers and architects have also been working with swarms. Kokkugia, comprised of Roland Snooks (RMIT) and Robert-Stuart Smith (UPenn), has been researching Fibrous Assemblies, Polyscalar Tectonics, Manifold Swarms, and Behavioral Composites. One technique they use is an ‘agent-branching model’ where new agents spawn after an event such as a collision between an agent with an obstacle. Josh Taron (University of Calgary) presented a lecture at the Architectural Association on Structurally Intelligent Agents with the desire for agent-based modelling to cull poorly performing agents from the flock after some form of structural analysis. Daniel Bolojan (FAU / Nonstandardstudio) discussed his work on both swarms and creative AI at DigitalFUTURES that included pheromones / stigmergy. Soomeen Hahn (SCI-Arc / SoomeenHahn Design) asked if agent-based-modelling was a form of discreet architecture at a panel with Gilles Retsin and Jose Sanchez at SCI-Arc.

I knew that I could learn this complex process and produce my first project with swarm intelligence after our lectures in Houdini.

My first swarm inside of a sphere followed an excellent YouTube tutorial by Junichiro Horikawa on Swarm Intelligence in Houdini.

Swarm Parameters

Junichiro recommended parameters for the swarm that were used throughout this project. These parameters could be varied for further outputs.

varied: numagents = number of agents in model
7: maxpts = number of other agents each agent reacts to in every frame
0.2 = max_speed = global speed of the model

0.356 = ali_rad = align radius
0.269 = sep_rad = separation radius
0.558 = coh_rad = cohesion radius
1 = ali_scale = multiplier for align
0.5 = sep_scale = multiplier for separation
0.5 = coh_scale = multiplier for cohesion
0.01 = flocking speed = speed of flocking

varied = maxtraillife = length of line recorded

varied = current frame = time
varied = total frames = max time

It became clear that it would be difficult to control the agents solely with separation and cohesion forces and that a mesh constraint was a better option. This mesh was constructed as a SubD in Rhino3D.

Designing the Roof

I was inspired by projects like HX Urban Center by Serie Architects and Rolex Learning Center at EPFL by SANAA to create a large volume with cutout interior courtyards. These courtyards could each take on a different character. One courtyard could be the “Courtyard of Dogs,” a dog sanctuary on site that acknowledges the very sad past of the Cave of Dogs located nearby, where many dogs were poisoned for the amusement of tourists.

Kangaroo and Grasshopper were used to form-find a structurally efficient roof.

Start with a circle and a radius

Incline the circle in the XZ and the YZ planes with variables to move its position.
Add UV points on the surface with variables for their position.
Include a variable for each circle’s radius. These will become the interior courtyards.

Incline the courtyards back to the XY plane.

Create windows / openings below the roof structure by moving points in the z axis with graphmapper / sine curve.

Form-find the roof structure using Kangaroo taking the green points from the previous image as target points.

At first, I used a solid volume similar to the SubD at the beginning of this post as the mesh container for the swarm in Houdini. This was changed to a thickened mesh that would restrict the agents to only moving adjacent to the roof structure. The mesh was exported as a .json and imported into Houdini.

Evenly Spaced Starting Positions

A mesh is also required to create the start positions for agents at frame 0. This evenly spaced emitter, which is an offset mesh contained within the thickened mesh, was used at first..

Offset mesh to emit agents.

20,000 Agents with 5 Trail Points that use the offset mesh to emit agents with an evenly spaced start position.

Outer Ring Starting Positions

The geometry to emit agents was replaced with an outer ring after discussions with Hesham Shawqy. This changed the evenly spaced start position to a more clustered start on the outer ring. Agents were expected to make a journey towards the center seeking to separate from each other.

Outer ring to emit agents

100,000 agents with 5 trail points. The problem of this swarm was the amount of uneven coverage as the agents left the outer edge and made their way to the center.

I tested 2,000 Agents with 100 trail points next. This created much longer polylines inside of the mesh reassembling a bird’s nest.

20,000 Agents with 50 Trail Points. There are one million points in this model. Houdini can process a very high level of complexity without crashing. One feature of Houdini that I very much appreciated was that the Esc key can be used to cancel the current command no matter how complicated. Control of the software is always returned to the user after a few seconds without fail.

Swarm Frames

A different strategy was needed to create a better spaced swarm across the entire roof structure. Instead of exporting a single frame of the swarm, I began experimenting with exporting multiple frames evenly spaced across time. Below is a swarm of 5,000 agents with 5 trail points exported every 20 frames from frame 20 to frame 360. These swarms were mesh piped in Grasshopper and joined as a disjointed mesh. They were placed on different layers with different colors as below.

5,000 Agents with 5 Trail Points.

Notes: The file was extremely slow to work with until all meshes on each frame were joined into a single disjointed mesh.

Frames 20, 40, 60
Add Frames 80, 100, 120, 140, 160
Add Frames 180, 200, 220, 240, 260
Add Frames 280, 300, 320, 340, 360

Wood elements on different frames could be assigned different species of wood ranging from light to dark. They would represent time in the swarm across the roof structure.

Animation in Unreal (To be Updated)

East View of Roof


Animation in Unreal
Music – The Reeling by Passion Pit (Owner allows the copyrighted content to be used on YouTube.)