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 and is 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.
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.
Papers:
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).
Papers:
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.
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.
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.
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.
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.
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.
Papers:
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.
Papers: