DevBlog
Community
Source Code
Live Builds

A city building game that uses microscopic models to vividly simulate the organism of a city arising from the interactions of millions of individuals.

People on the move, businesses in trade, neighbourhoods changing. Each inhabitant struggling, adapting, making life choices. The city evolves, the city grows. The city is us.

See and inspect all aspects of city life, across many scales of time and space.

Shape your city by sketching detailed project plans for infrastructure and zones.

Implement projects, decide on budgets and make government decisions.

Citybound has an ambitious vision, but is still actively developed as a largely one-man open-source effort. Follow my creation process on the DevBlog and the Citybound community on Reddit. If you are brave, try out the experimental live builds. Citybound is proudly community-funded.

Support Citybound

Game Features

Micro-Economy Simulation

In Citybound, every single household (a family or a business) is individually simulated. Each household has a home, and the daily activities of its family members or employees are driven by the resources the household needs and offers. Each household maintains a precise real-time inventory of its resources, which not only include tangible goods like groceries, raw materials, or money, but also intangible concepts like sleep, health, recreation, work-force, touristic interests or business services.

Economic patterns arise directly from household interactions. To fulfil its human or business needs, each household tries to find attractive "trade-partners" for each resource, factoring in price and quality differences, but also local reachability based on transport conditions. Households re-prioritise their needs throughout the day, leading to natural patterns of commute, shopping or logistical transport trips.

Future work: Pre-simulating local trade conditions to determine attractiveness of real estate, thus influencing immigration, development and city growth. Scaling the system to high-density buildings and large populations in the millions.

Details & Inspiration ▾

  • The original inspiration for simulating cities at the level of individuals and their interactions (and starting Citybound in the first place) came from SimCity (2013), which, however, only implemented a very superficial version of that (modelling people more like fluids with sources and drains)

Papers:

  • Kim, D. (2012). Modelling Urban Growth : Towards an Agent Based Microeconomic Approach to Urban Dynamics and Spatial Policy Simulation
  • Koomen, E., Diogo, V., Dekkers, J., & Rietveld, P. (2015). A utility-based suitability framework for integrated local-scale land-use modelling.
  • Waddell, P., Borning, A., Noth, M., Freier, N., Becke, M., & Ulfarsson, G. F. (2003). Microsimulation of Urban Development and Location Choices: Design and Implementation of UrbanSim.
  • Park, I. K., & von Rabenau, B. (2011). Disentangling agglomeration economies: Agents, sources, and spatial dependence.
  • Tiglao, N. C. C. (2005). Modeling Households and Location Choices in Metro Manila.
  • Weidner, T., Moeckel, R., & Brinckerhoff, P. (2011). SILO: A Land-­Use Model For Integrated Modeling.
  • Beckmann, K. J., Brüggemann, U., Gräfe, J., Huber, F., Meiners, H., Mieth, P., … Wegener, M. (2007). ILUMASS Integrated Land-Use Modelling and Transportation System Simulation.

Microscopic transport Simulation

The efficient flow of traffic through transport infrastructure is vital for a city's health. Traffic is spontaneously determined by the micro-economic goals of its participants - and chaotic events are at the heart of traffic. That's why in Citybound every single trip of every person is simulated microscopically. Hundreds of thousands of cars physically move along roads and have to break, accelerate and change lanes in traffic to safely get to their destination.

Future work: Other modes of transport (pedestrians, light & heavy rail, airports, etc.). Multi-modal pathfinding (combining walking, public transport, taxis and driving to reach destinations).

Details & Inspiration ▾

  • Microscopic traffic simulation was the first part of Citybound that I implemented - my strategy was to show of that I could make this very computation-intensive part of city simulation scale to city sizes of millions of inhabitants. With already early prototypes being able to simulate up to 400,000 cars in real-time, this would suffice for cities of population ~4 million.
  • Because the road network is subject to frequent change in Citybound, many static pathfinding methods that require long pre-computation but offer fast run-time lookup are unsuitable. Pathfinding information in Citybound is stored in the road network itself and is dynamically updated and propagated through the network, similar to internet routing tables.

Papers:

  • Blatnig, S. (2008). Microscopic Traffic Simulation with Intelligent Agents.
  • Liberti, L. (2014). 14th Workshop on Algorithmic Approaches for Transportation Modelling, Optimization, and Systems.
  • Sturtevant, N., & Buro, M. (2004). Partial Pathfinding Using Map Abstraction and Refinement.

haptic collaborative
planning

The core principle of interacting with the game world in Citybound is through planning. This gives you the ability to preview effects of even large-scale projects in your city, to undo and redo and to combine different ideas. Smart paint-gestures become beautifully curved roads and perfectly shaped zones, offering the power and expressiveness of professional CAD tools while being much more intuitive and fun to use.

Precise management of plan updates not only enables smooth interactive editing of even huge cities, but also makes collaborative multiplayer planning possible, where several people can play in and work on the same city together in real time.

Future work: Planning with 3D features like bridges and tunnels. Preview of financial and political impact of planned projects.

Actor-Based distributed simulation

Engine Technology

To realise Citybound's vision of simulating large-scale cities and streaming them to browsers for interaction, I had to invent and implement quite an unusual computation architecture. Actors and message passing are the key concept in Kay, my actor-system framework that elevates Citybound's simulation logic from its transparently networked and easily scalable underpinnings. Implemented in Rust, it allows type-safe and high-performance actor updates and inter-actor communication, with low-level optimisations for cache-locality while offering high-level features like distributed dynamic dispatch and broadcast messages.

Details & Inspiration ▾

  • The main inspiration for my approach was my experience with the Erlang programming language for distributed systems.
  • Kay has relatively few features and abstractions in comparison, but that allows a focus on high-performance, with minimal actor and message footprints in memory.
  • The consolidated layout of actor state in memory and the mechanisms for handling broadcast messages that are received by up to millions of actors are heavily inspired by Data Oriented Game Engine Design, the core ingredient in the highly successful pattern of Entity-Component Systems.

RUSt-WASM-JS Bridge

Compiling Kay to WebAssembly allows running a fully fledged actor system node in the browser, which can communicate with the simulation backend through type-safe high-performance messages and do computation-intensive preparation work for rendering, before efficiently serialising and passing rendering-relevant information as JavaScript objects to a React app that implements the rest of the UI. The React app can call Rust hooks that were exported to JavaScript, to send Kay messages back to the simulation backend for influencing the game world based on player input.

Reactive 2D+3D UI framework

Defining a combined 2D and 3D UI to interact with Citybound's quite complex planning and simulation objects is a difficult task. Reactive, component-based frameworks with clear information flow heavily simplified 2D UI development in recent years. I extend React with my Monet library, applying React's principle (wrapping stateful updates in a declarative, functional API) to WebGL rendering and GPU resource management. In addition, I define a new kind of React component representing an interactive shape in a 3D world. Taken together, this allows me to fully define the 2D and 3D appearance and interactivity of a game object in a single React component.

Robust high-performance geometry kernel

Almost every object in the Citybound world can be arbitrarily shaped, be it roads, zones or building lots - and their exact shape typically results from complex geometric operations between other objects. My Descartes library provides everything from simple path operations to vast polygon-overlay tasks, with a focus on performance and topological robustness despite approximation and inaccuracies.

Incremental computation framework

To provide real-time interactive editing of large city plans and to minimise bandwidth usage between UI and server while streaming plan result previews, it is vital to have a precise formalisation of how changes in plan input affect plan results, and then communicating only the differences. Currently implemented ad-hoc in a monolithical planning manager, this approach will be generalised and translated into a distributed framework to allow plans to scale beyond one backend server.

Details & Inspiration ▾

Papers:

  • Matthew A. Hammer, Joshua Dunfield, Kyle Headley, Nicholas Labich, Jeffrey S. Foster, Michael W. Hicks, David Van Horn. Incremental computation with names - also see adapton.org

Procedural geometry pipeline

The fact that almost all geometry in Citybound is procedural is both an opportunity and a challenge. Early work has begun in my Michelangelo library that will provide expressive shape-grammars to describe architecture styles or natural shapes based on extrusions, which can then be evaluated on demand to generate optimally-batched meshes and instance-arrays with dynamic level of detail and animated components.

Details & Inspiration ▾

Papers:

  • Kelly, T., & Wonka, P. (2011). Interactive architectural modeling with procedural extrusions.
  • Kelly, T. (2013). Unwritten Procedural Modeling with Skeletons.