CH NEO-ZÜRICH EDITION
WEATHER · CLEAR 20°C
BLEND OF THE DAY · 07/ROGUE
EST. 2027
THE AEC CYBER MORNING NEWS

PAZ Kaffi

DESIGN · DEMOLITION · CAFFEINE · DISPATCH
EDITION 0710 · 10 July 2026
BROADCAST 04:42 CET
2,400 BROADSHEETS PRINTED
READ TIME · 47 MIN
The Distance Field: A Crowd-Egress Toy You Can Break in Your Browser
ART
FRAME · 06:55
10-07-2026

The Distance Field: A Crowd-Egress Toy You Can Break in Your Browser

Build a BFS distance field in 15 lines — the game mechanic behind crowd egress, turned into a live, breakable fire-evacuation check for any floor plan.

Here is the thing you can poke. Open a blank grid, drop one green exit, and let the grid flood: every cell stores its walking distance to the nearest door, computed by a breadth-first wave that washes outward one ring at a time. Now spawn fifty dots. Each one does something almost insultingly simple — it looks at its neighbouring cells and steps toward whichever holds the smaller number. No agent knows where the exit is. No agent plans. The distance field already did the thinking, once, for everybody. That is the whole trick behind crowd egress in modern game engines, and it is also, quietly, a fire-evacuation study.

←TODAY: In 2026 a flow-field pathfinder routes 50,000 RTS units on one core; the same BFS routes occupants out of a floor plate. →3012: By the Zurich-3012 horizon every plan is born with its egress field baked in, recomputed live as walls move. Fulcrum: The insight only works because the field is a property of the building, not the crowd — solve space once, and the people are free.

The lineage matters, because it explains why this is cheap now and was not obvious before. A naive crowd gives every one of N agents its own A* search every frame — O(N) pathfinds, and the framerate dies at a few hundred souls. The flow-field flip, popularised by Supreme Commander and dissected to death in creative-coding circles, computes one field for the destination and lets all N agents read it for free. Daniel Shiffman’s The Nature of Code and the Coding Train videos are the gentlest on-ramp here — the chapter on flow fields and autonomous agents is the exact mental model you need, and it is free online. PAZ has leaned on that corpus before; it is the bridge book between “code that draws” and “code that behaves.”

The rules, exposed

  • Each open cell holds its integer distance to the nearest exit (BFS wave from the door).
  • Walls are infinite distance — the wave flows around them, so the field already knows about your corridor.
  • An agent simply steps downhill to the lowest neighbour. Emergent queues, merges and bottlenecks fall out for free.

Now break it. Add a second exit and watch the watershed line form where the two floods meet — that boundary is your real catchment basin, not the one you drew with a marker. Then choke a doorway to one cell wide and count the frames it takes to clear: that number is your egress capacity. And here is a wrinkle the games never modelled — a Nature study covered this June by The Guardian and Smithsonian found pedestrians from Spain to Japan share a persistent bias to turn counterclockwise, independent of culture or handedness. Add a tiny left-turn nudge to each agent and your symmetric twin-exit hall stops splitting evenly. The cheat costs you a balanced evacuation — which is precisely the kind of thing a sandbox you cannot break would have hidden from you.

Atelier: This is where the toy becomes the building. The same BFS field you ran on a game grid runs on a rasterised floor plan: tag your IfcDoor and IfcStair cells as sources, flood the walkable area, and the resulting field gives you per-room travel distance, bottleneck cells, and a defensible occupant-load story — a parametric egress check that updates the instant you drag a partition, long before a code consultant sees the plan.

Hack: This Hack teaches you to build the distance field itself — the one structure both the game and the fire plan stand on. The domain is geometry: a BFS that turns a walkable grid into a scalar field of distances-to-exit. Run it on any 2D occupancy array.

function distanceField(grid, exits) {        // grid[y][x]: 0=open, 1=wall
  const D = grid.map(r => r.map(() => Infinity));
  const q = exits.map(([x, y]) => (D[y][x] = 0, [x, y]));
  for (let i = 0; i < q.length; i++) {        // BFS wave
    const [x, y] = q[i];
    for (const [dx, dy] of [[1,0],[-1,0],[0,1],[0,-1]]) {
      const nx = x+dx, ny = y+dy;
      if (grid[ny]?.[nx] === 0 && D[ny][nx] === Infinity) {
        D[ny][nx] = D[y][x] + 1; q.push([nx, ny]);
      }
    }
  }
  return D;   // each agent just steps to its lowest neighbour
}

Run it, then go change a wall and run it again. Watch which rooms got further from a door. That delta — not the floor plan’s prettiness — is the thing your future occupants will feel. Build the field, break the field, then put it under your next plan.

FILED FROM
CO-SIGNERS
PAZ Academy
CONFIDENCE
HIGH
REPRINTS
© PAZ - PARAMETRIC ACADEMY ZURICH · ALL RIGHTS RESERVED

PAZ Kaffi · multidisciplinary editorial, led by PAZ Academy

⚑ REPORT AN ERROR · SUBMIT A CORRECTION
◂ BACK TO FRONT PAGE · PAZ KAFFI

© 2026 PAZ Academy.