Flying over Civitas
This village began as the closing slide of my talk, “The Search for Meaning Through Collaboration and Code.” I wanted to see it from a new perspective: flying through it like a bird.
In the talk, I argue that code makes ideas concrete, while writing gives them context and helps us share them. I wanted the slides to have simple graphics that evoke civilization. I made the buildings and objects from 3D coordinates, rendered as SVG triangles from an isometric perspective.
Now those shapes form a world that we can fly through:
Take control and find your own way through the village.
Building the village
This world reuses the models from the slides. The hexagonal spiral beneath the village are from the talks original slide configuration. Clay makes this page from a Clojure namespace and Markdown comments; Scittle runs the ClojureScript in the browser, and Babylon.js renders the scene.
Instead of importing models from a 3D file or building them in Blender, I write Clojure functions to make them. The functions use geometry and arithmetic to create vertices, faces, and colors. For example, a tree combines a cone for its trunk with a canopy built from rings. These compact models can take parameters, combine with other shapes, and be reused in both the slides and the 3D scene.
Here is the fire model. It makes a six-sided base and joins its edges to a point above, forming a simple flame:
(defn fire-mesh [color]
(let [n 6
bottom-verts (translate-verts (circle-verts 3 n) [0 0 1])
cone-faces (for [i (range n)]
[i (mod (inc i) n) n])]
{:role "fire"
:vertices (conj bottom-verts [0 0 10])
:faces (vec (concat [(vec (range n))] cone-faces))
:colors (vec (repeat (inc n) color))}))See more in models.cljc
Flying through the village
I find flying more interesting than walking through a scene. You can swoop between buildings, climb above the village, and see the whole spiral. Moving is part of the fun. The controls are intended to feel like flight. I hope you’ll spend some time trying it, and get the feeling of being a bird.
The original talk
You can explore the talk slides and commentary, or watch the recording:
ClojureCivitas is a shared space for ideas, big and small. If you have an idea you’d like to share, you can contribute a post.
source: src/games/crow/crow.clj