This section contains a variety of experiments, simulations and explorations that I have developed in my free time. I always strive to learn new skills, and push the limits of my abilities as a designer, and engineer. I study cellular automata, and agent based simulations as a method of quickly experimenting with and learning about emergence. From simple rules, comes surprisingly robust and lifelike behaviors.

These skills have often translated to my work, informing designs and solutions used in commercial games. The rendering system in Phantom Brigade was informed by my explorations with voxel rendering, and compute shaders. Agent based modelling in turn helped me develop the traffic and crowd simulation used in Industries of Titan’s promotional videos and early city gameplay demos.

Agent Simulation

Traffic and Pedestrians

At the time of implementing this, Industries of Titan was still early in development. Because of that, gameplay simulation of pedestrians and traffic had yet to be developed.

The goal was to make the city feel more alive and lived in, by simulating a large number of agents in realtime. This needed to be created in time to record gameplay trailers, and to demo at PAX.

I was brought in to handle the design and engineering of pedestrians and vehicles, as well as assisting with performance and optimization to meet targets for live demos.

The simulation is built as a series of intersection nodes and connections. Each intersection can have 1-4 connections in its data structure. These connections provide the start and end points between destinations.

Cars are modelled as simple agents running a PID controller for acceleration and deceleration. If a vehicle is in front of them, they will slow to avoid a collision. Naturally bunching up and expanding as the path clears. PID variables were tuned globally

Assets by Nick Gunn, Antoine Lendrevie, and the Industries of Titan Team.


Compute Shader explorations

Simulation Toolset

When I first began experimenting with simulations and compute shaders in Unity. I quickly realized how much template and boilerplate code was necessary to create bindings for variables and data being sent to the GPU. To facilitate a quicker workflow and iteration while exploring, I built a data driven toolset for editing computer shaders in Unity, utilizing Odin Inspector.

Test

Toolset Iteration

Here, I am exploring the potential variables for a reaction diffusion system. Honing in on the value ranges that form distinct patterns and behaviors.

I also added a camera system for zooming into and browsing simulations without losing rendering fidelity.

In the next iteration, I marked any changed values as “dirty”. These were then sent to the GPU on the next step of simulation. This allowed me to explore simulations in real-time, honing in on interesting results, and quickly locating the edge of chaos, where emergent behaviors would appear.

Since the entire system was data driven, I could write interesting parameters out to a .yaml file, allowing saving and loading. The custom YAML simulation toolset I built, is also used to power the modding API, part data, and serialization in Phantom Brigade.


Compute Shader Experiments | Cellular Automata and Agent based modelling

Physarum Network

This is an agent based simulation running at real-time in Unity Engine. It features millions of agents, being rendering into data buffers, which are in turn used as an input for surface shaders. The simulation can be manipulated and interacted with by sending data over to the GPU in a structured buffer.

Lighting is achieved by multi-sampling the data to determine the slope of a given point. From there, normals and specular lighting can be calculated.

The surface shader graph for this effect is included below.

Cellular Growth

A Compute shader simulation of cellular growth. I created this to experiment with using Append / Consume structured buffers in HLSL Compute Shaders as well programming simple n-body reactions. (Cells interact physically with one another, pushing away as they spread)

Flocking 2D

This is another experiment with agent based simulations on the GPU. The goal with this was to find a way to efficiently compute the local neighborhood of boids, without drastically slowing down the performance of simulation. Boids are spatially binned to allow for memory efficient calculation of the local neighborhood.

Flocking 3D

In this simulation, the boids algorithm has been extended into 3D space. Structured buffer data is used to calculate a matrix for 3D rendering of instanced static meshes.