1# Live edits
2
3A key feature of A/B Street is the player editing the map and seeing how traffic
4responds. The possible edits include:
5
6- Change lane types (driving, bus, bike, parking -- sidewalks are fixed)
7- Change speed limits
8- Reverse a lane
9- Change a stop sign policy (which roads have a stop sign and which have
10  priority)
11- Change a traffic signal policy
12
13The map conversion process outlined above takes a few minutes, so reusing this
14process directly to compute a map with edits wouldn't work at all for real
15gameplay. Instead, the process for applying edits is incremental:
16
17- Figure out the actual diff between edits and the current map
18  - This is necessary for correctness, but also speeds up a sequence of edits
19    made in the UI -- only one or two lanes or intersections actually changes
20    each time. Of course when loading some saved edits, lots of things might
21    change.
22- For any changed roads, make sure any bus stop on it have a good pointer to
23  their equivalent driving position for the bus.
24- For any modified intersections, recompute turns and the default intersection
25  policies
26- Recompute all the CHs for cars, buses, and bikes -- note sidewalks and bus
27  stops never change
28  - This is the slowest step. Critically, the `fast_paths` crate lets a previous
29    node ordering be reused. If just a few edge weights change, then recomputing
30    is much faster than starting from scratch.
31  - While making edits in the UI, we don't actually need to recompute the CH
32    after every little tweak. When the player exits edit mode, only then do we
33    recompute everything.
34
35A list of lanes and intersections actually modified is then returned to the
36drawing layer, which uploads new geometry to the GPU accordingly.
37