Swift and Metal Crowd Simulation: Citopia

Introduction

Welcome to our blog on Citopia, a cutting-edge crowd simulation project that intricately models the daily routines of diverse NPCs within a bustling, modern city environment. Developed by Deze Lyu, Paulina Tao, and Christine Kneer using Swift and the Metal API, this project showcases our journey from the initial setup to the rich, dynamic interactions in a cyberpunk cityscape.

Our initial milestone involved simulating 100,000 characters on a flat plane, focusing on basic movements and visibility optimizations. Characters varied in gender and behavior, moving or standing still, with our system efficiently rendering those closest to the camera view. Despite facing challenges with animation transitions, our foundational work laid the groundwork for more complex simulations.

As we progressed to our second milestone, we expanded our virtual city with 10,000 procedurally generated buildings and implemented a basic daily routine for our characters, including working, wandering, and sleeping—enhanced by a rigid body collision system to maintain realistic interactions.

In our third milestone, we introduced character-to-character interactions, adding a layer of social dynamics where NPCs with similar personalities could meet and engage, enriching our simulation with varied walking motions and interaction dynamics. We also tackled optimization challenges, improving performance to support these complex interactions seamlessly.

Each step brought significant enhancements in functionality and performance, culminating in a dynamic, interactive world where NPCs react to each other and their environment in immersive ways. Our blog series will dive deeper into the technical challenges, breakthroughs, and insights from Citopia, exploring how we're pushing the boundaries of real-time performance and simulation complexity.

Results Showcase


View the Source Code

For more details, please check out our GitHub repository below.

Next
Next

Vulkan Grass Rendering