Art From Code: Beyond 184

It’s all been leading up to this.

Beyond 184

Let’s have a little urban fantasy. You’re on top of a skyscraper. You look down, and you see the neon world below. It’s beautiful, it’s alive.

And I wanted to capture that.

To build a living place, just pretty neon buildings alone are not enough. After all, the buildings are nothing without the inhabitants. And so, the streets are full of life. They are filled with traffic, with people going around their lives. An entire system that simulates a small world is behind each pair of these headlights.

City in action

When I first found out about this class and interviewed for it, one of the examples of what I considered “Art from Code” was a beautiful video by baku89 that utilized cellular automata. I found it so fascinating that a mathematical model made out of a grid of cells – all using pretty simple rules that determine if a cell will be “filled” or “empty” in the next generation – could produce something so beautiful.

All the pieces ended up falling together in a way that pushed me to explore cellular automata further: this class’ final prompt being “systems”, and the discrete mathematics’ class’ exploration of logic.

Game of Life

As this class progressed, I found myself exploring and implementing cellular automata rules, and even creating a few of my own, such as this automata, which generates a city grid, similar to Piet Mondrian’s Broadway Woogie Boogie:

Broadway Walkie Talkie

So, for my conference projects – both for Art from Code and Discrete Mathematics – I chose to work with cellular automata.

Familiar

Having finally returned to New York City after spending a lot time living in suburban hell, Manhattan was all that I had on my mind.

I thought back to other generative projects I’ve seen – and one in particular stood out. Called Pixel City, this screensaver generated an entire city, full of unique buildings and even street traffic. But the traffic wasn’t really “alive”. And I wanted to fix that.

Pixel City

I decided to base my project on a cellular automata called Rule 184, expanding upon it to create a more interesting traffic simulation in two dimensions (hence, I called it “Beyond 184”). The Rule 184 cellular automata simulates vehicles moving on a one-dimensional road with a very simple set of rules:

  • If a cell is occupied, and the next (right) cell is empty, the cell becomes empty
  • If a cell is empty, and the previous (left) cell is occupied, the cell becomes occupied
  • If a cell is occupied, and the next cell is occupied, the cell stays occupied
  • If a cell is empty, and the previous cell is empty, the cell stays empty

I expanded upon these rules, adding a “cooldown” – that is, the ability of cells to stay in place for one or two generations before moving. This gave me the ability to have a city with “cars” that can move at different speeds. Along with that, I made it so that cells with a lower cooldown will not be able to come to a full stop immediately – simulating how actual vehicles in the real world will have different braking distances depending on how fast they are moving.

I brought this rule to two dimensions by creating a “source-destination” structure, which allowed for moving 1-D traffic cellular automata to two dimensions with minimal modifications. With this structure, as applied to the Rule 184 above, a “road” cell’s “source” and “destination” values dictate what a cell considers its “previous” and “next” cell. By requiring the cells to be connected to one another (that is, a cell’s destination value should be equal to the next cell’s source value for the chain to be complete), I gained the ability to control traffic flow.

I added a unique type of road cell that is called an intersection. This cell, instead of using a single “source” and “destination” value, has two of each, and with every generation, determines which values should be used, with the underlying logic attempting to move traffic from busier roads to less busy roads – after all, throwing more cars at a traffic jam doesn’t help anybody.

You can find more detailed information on how this cellular automaton was created in the paper I wrote for my Discrete Mathematics class, which, along with the source code for the simulation, are available at the GitHub repository.

Beyond 184

Believe it or not, that grid filled with squares is the very same simulation you saw at the beginning.

Doesn’t look that great, huh. That’s because it needs a home. It needs to live inside of a city.

Time to put the “art” into “Art from Code”.

The city motif was present in my creations since the very first thing I made for the class:

Scrolling city

I ended up taking a more minimal approach, and before I brought the city and the traffic model together, this is what I ended up with:

3D test

Once I brought the two together, it wasn’t just city-inspired creations that helped me with the process. Little bits of everything I’ve learned this semester all came together to create my neon city.

Self-portrait

The alternating colors that I used were obtained using the same method I used to create the random files and folders that I used for a part of my self-portrait.

Continuing experimentsThe random buildings and the way I ended up having them use different colors was born from an experiment for one of my other projects – one that didn’t even make it into the final project.

Yuki machi

One of the wallpapers I’ve made before gave me the idea to reduce my buildings to glowing blocks of neon.

With all that, I eventually ended up with my final result. A living neon city.

As seen from above

And I think it’s pretty nice.

Author: Dima Konev