
A/B Street: A simulation game to fix Seattle's traffic - zackham
https://abstreet.org/
======
dabreegster
Hi, author here. Previously posted to HN
([https://news.ycombinator.com/item?id=21763636](https://news.ycombinator.com/item?id=21763636)).
I just released alpha -- check out this cheesy trailer
([https://www.youtube.com/watch?v=LxPD4n_1-LU](https://www.youtube.com/watch?v=LxPD4n_1-LU)).

Happy to answer questions! And if you're serious about running this in your
city, the importing process has improved greatly since December, so get in
touch.

~~~
schemescape
Minor issue I noticed: whenever I launch the app on Windows, the mouse hit-
targeting is off vertically by ~40 pixels. Resizing the window makes the
problem go away for the rest of the session. I'm on Windows 10, 1920x1080, and
I haven't modified scaling/DPI settings.

~~~
dabreegster
Could you give
[https://github.com/dabreegster/abstreet/suites/828409393/art...](https://github.com/dabreegster/abstreet/suites/828409393/artifacts/9222718)
a shot? If that URL disappears or you don't want to re-download the whole
.zip, just the fixed binary is
[https://www.dropbox.com/s/j2hh8xrugtsxslc/game.exe?dl=0](https://www.dropbox.com/s/j2hh8xrugtsxslc/game.exe?dl=0)

~~~
schemescape
That new build did NOT fix the issue for me.

Now that I'm looking more closely, this looks like some sort of initial aspect
ratio issue, possibly related to a resize.

The game launches and the window either starts maximized or it maximizes
itself. If I restore (un-maximize) and re-maximize, the aspect ratio is
clearly different because the logo in the center of the screen gets slightly
taller (while staying the same width).

In other words, the initial aspect ratio of the graphics seems incorrect
(squished vertically slightly for me, running at 1920x1080).

------
sytse
If you like this game consider checking out Cities Skylines. Traffic is a
major part of the game. With the vanilla edition you can already do a lot, but
if you want to route lanes you need the traffic manager mod
[https://steamcommunity.com/sharedfiles/filedetails/?id=16376...](https://steamcommunity.com/sharedfiles/filedetails/?id=1637663252)

~~~
com2kid
Do any of the mods give the simulated people real commutes? I gave up after I
made a city with a full subway system and zoned areas and watched as the
simulated citizens left home, went to work, and then went to another random
home at night.

It completely ruined my fancy subway system's timetable. :(

~~~
rzzzt
A relevant movie from the USSR comes to mind (which was also discussed
recently):
[https://en.wikipedia.org/wiki/The_Irony_of_Fate](https://en.wikipedia.org/wiki/The_Irony_of_Fate)

~~~
MikeTheGreat
Another somewhat relevant film: :)

[https://en.wikipedia.org/wiki/Dark_City_(1998_film)](https://en.wikipedia.org/wiki/Dark_City_\(1998_film\))

------
MasterScrat
If you're interested in this kind of planning problems, check out the NeurIPS
Flatland challenge, in which we try to optimize traffic on railway networks,
in association with the Swiss and German railway companies!

[https://www.aicrowd.com/challenges/neurips-2020-flatland-
cha...](https://www.aicrowd.com/challenges/neurips-2020-flatland-challenge/)

(disclaimer: I'm an organizer)

------
schemescape
This simulation confirms that the easiest fix is to not have the West Seattle
bridge be broken :)

------
yazaddaruvala
I've been really hoping for the Maps team at Google/Waze to release a similar
"traffic congestion" view to highlight consistent hot spots. A simulation is
also pretty good, but the real data from Maps/Waze users will be even better!

Ideally, a government dashboard to see traffic congestion changes per year,
month, day of week, but also hour. If we can create metrics for cities like
p99 door-door trip time (i.e. latency) policy makers can better measure
changes, bottlenecks, etc and plan better.

~~~
andrewxdiamond
Your hope has come true! Kindof. I don't think this comes with a dashboard,
but the data is there

[https://www.digitaltrends.com/cars/waze-for-cities-data-
puts...](https://www.digitaltrends.com/cars/waze-for-cities-data-puts-traffic-
data-on-google-cloud/)

------
linuxftw
The problem is there's only so much room for automobiles in a city. The more
you decrease traffic, the more you'll induce demand to fill those improved
traffic flow patterns.

The more infrastructure that is built downtown, the more people want to be
downtown.

~~~
FeepingCreature
That's not a reason to not improve infrastructure anymore than "the more
chocolate we produce the more people want to buy chocolate" is a reason not to
make chocolate. It just shows you're ludicrously underserving demand.

~~~
supertrope
Efficiency matters. If allocating 100 million currency units to widening a
highway from 5 lanes to 6 lanes improves people/hour capacity and quality of
life less than other solutions, the other solutions should be chosen. In
addition to diminishing returns on the way we’ve always done it, there’s a
hard limit of about 2000 cars/hour/lane.

Chocolate is not free at the point of use but roads usually are. Without price
signals or other limits people over-consume resulting in a shortage and people
paying in time.

~~~
lotsofpulp
Hence an easy solution to traffic is increase the cost of driving. Which
Seattle already has dynamic tolls which change in price:

[https://www.wsdot.wa.gov/Tolling/TollRates.htm](https://www.wsdot.wa.gov/Tolling/TollRates.htm)

------
AcerbicZero
This is awesome, although part of the traffic problem is the horrible
condition of the roads around Seattle, and a failure to enforce basic traffic
laws - specifically - the left lane is for passing, and probably more
importantly, do _not_ stop in an intersection. Just because the light is
yellow, doesn't mean we need to stack more cars into the middle of the road.

I walked to work (when I lived in Seattle recently) but the amount of traffic
jams I saw caused by both regular people in their cars, and the mass transit
bus drivers, driving right into an intersection as the light turned red is
crazy. I don't know how you can plan traffic flow around it, because as green
as the light might be, no one is moving with a bus sitting in the middle of
the intersection.

~~~
paxunix
Plenty of selfish/oblivious drivers, but don't overlook the selfish
pedestrians causing intersection traffic backup too. There are plenty that are
crossing right up until the light is red (even if they don't have a "walk"
signal), making it impossible for more than one car to make the left turn.
Everyone needs to work together.

------
Pfhreak
Rad! It's a bummer that Amazon employees will have a hard time contributing to
this (as Amazon prevents collaborating with anyone on any side projects that
are 'games'.) Their offices surround some of the worst traffic in the city,
and it'd be interesting to have some of their engineers contributing.

~~~
capableweb
What? That's a real thing? Bypassing the feeling of "how can that even be
legal?", how can people join a company that puts these kind of restrictions on
it's employees? Kind of feels like that Amazon employees put themselves in
this situation, so hard to feel bad for them.

If any company tries to limit what I do in my free time, it's a quick and hard
"no" on working for them.

~~~
Pfhreak
They don't tell you until you've started.

~~~
capableweb
_That_ has to be illegal, even in the US?

------
StillBored
This is completely awesome. I've considered doing something similar (mostly
while sitting around in Austin looking at traffic lights backing up 100+ cars
to allow 2-3 to enter from a side street) or looking at a pair of lights
(accidentally?) acting like a metering device. Particularly city wide as I'm
100% convinced that the actual traffic engineers here are doing something
wrong. They reworked a bike lane a few years back on a street I was driving on
daily and then I could see them out there for months trying to work around the
fact that they backed up a couple major intersections a couple blocks away as
a result.

So the question is, given a bit of ML/etc driving it, and some actual commute
time data, what are the changes something like this actually can be used to
improve traffic?

~~~
dabreegster
There are lots of data quality and simulation assumption issues that prevent
results from being meaningful. I'm mostly positioning this as a way to get
people interested in coming up with specific ideas, but of course I'd love to
reach trustworthiness parity with industry standard traffic sims.

I actually got started in traffic sim while I was in Austin! If you know
anybody there who'd be interested in putting in some work to get the area
running smoothly, I'd love to include it as a second city in the game.

------
ALittleLight
The trailer looks amazing. I was actually just imagining a video game like
this a few days ago, so it is something of a wish fulfillment plus baader
meinhoff syndrome to see this.

I can't wait till tonight when I'll have enough time to get it installed and
try it out!

------
Faaak
This idea was supposed to be my master's thesis project. However I found
something different and never did the original idea but's it's always been in
my mind.

Big kudos to the author for this nice project ! I hope it gives further ideas
to people playing it

------
qchris
This project is wicked cool, and I almost missed that they built it using
Rust. I like the language a lot, and I think something like this is a sign of
it moving towards real maturity, where the utility of the programs starts
outshining the method of its construction. I'll be really curious to see if
any project proposals end up citing this over the next couple years as an
impetus for starting to experiment with different approaches to their traffic
infrastructure, or at least inspiring people to become more engaged with it.

~~~
dabreegster
I gave a
[talk]([https://www.youtube.com/watch?v=chYd5I-5oyc](https://www.youtube.com/watch?v=chYd5I-5oyc))
to a Rust meetup with lots of gory details, if it's interesting

------
evolve2k
How much would be involved to adapt this to other cities?

~~~
dabreegster
[https://github.com/dabreegster/abstreet/blob/master/docs/new...](https://github.com/dabreegster/abstreet/blob/master/docs/new_city.md)

Biggest barrier is lack of trip demand data. If you come up with how many
people leave from building1 to building2 at time T using some mode of
transport, then this can work.

~~~
aunty_helen
Hey this is something I've been working on as a side project for the last 2
years. Using traffic cameras to detect the flows through intersections with
the goal of providing better stats to governments and city planners.

Hopefully I can have the poc going in the next month. A city wide integration
with something like AB street would be really cool and was phase 2 for this
project. Phase 3 being an optimised citywide traffic control.

~~~
dabreegster
Whoa, this would be awesome! Strongly consider publishing open datasets. :)
Could you talk at all about how it works, or what privacy issues you've dealt
with?

~~~
aunty_helen
Sure, the system takes a raw camera feed and spits out an entry into a sql db
which will then, depending on customer requirements, be provided in a format
they want.

In between these steps, (all based in python) opencv takes the video, splits
it, sticks some of the frames on a kafka cluster.

Another node picks up approx 2 fps, hands it to a object detection algo based
on tensorflow which then puts the results on another kafka topic.

A heavily customised tracking algo pulls all of the frames available and the
tensorflow results for initialisation and reverification. Once a vehicle is
tracked through the field of view the vehicle is counted.

For the privacy issues, as this is only tracking for a short amount of time,
not tracking between intersections and not tracking persistent uuids or
numberplates, there shouldn't be too much trouble. But it will depend on the
local law requirements. As this is a statistical problem, tracking the actual
path of a car between point a and b isn't completely necessary if you can get
a sufficient amount of coverage over a city. (You probably already understand
this.)

As for opening the datasets up, I plan to do this with the poc. I've been
using the Biloxi Mississippi camera live stream from youtube for all of my
testing so far. My poc will be a website with this live stream having an
overlayed view and the ability to download the stats for the day/month/year
etc. As for other cities, I'm sure a FOIA will be able to get you the data.
But I will be pushing to publish it openly as they will have to pay for it
either way.

As you can probably tell, I'm trying to turn this into a business and the
costs of actually collecting and processing the data isn't something that is
reasonable for single person to bear. After talking to the traffic dept for my
country, the largest city of 1.5m has about 3000 cameras. But I am aiming for
a system that's cheap enough to enable 24/7 monitoring as that's when this all
gets pretty exciting.

------
jakecopp
Woah, the data comes from OpenStreetMap!

Is it possible to create a map with one click for a new city?

I read through
[https://github.com/dabreegster/abstreet/blob/master/docs/art...](https://github.com/dabreegster/abstreet/blob/master/docs/articles/map/article.md)
but I can't tell if this must be manually followed.

~~~
dabreegster
[https://github.com/dabreegster/abstreet/blob/master/docs/new...](https://github.com/dabreegster/abstreet/blob/master/docs/new_city.md)

Not quite one-click, but you can try the one-shot importer. You'll probably
hit some issues; I have strict assertions to prevent regressions in Seattle.
Please file a bug if you can't get a new place to work.

------
bane
I would love to see a simulation system like this that also involved other
"graph" components of city infrastructure -- like power, water, food, rail,
air traffic, internet, mobile service etc. The ripple effects could be very
hard to guess at, but could make for really interesting scenarios. Imagine
trying to increase power when the only "lever" you can change is food prices!

------
tomlagier
In the real world, how is traffic routed? I often wonder what controls
obviously inefficient intersections and how easy or hard it is to fix that.

I assume that there are software systems that take in schedules and various
inputs (cameras, magnets, crosswalk buttons) but I'm curious if anyone works
in the field and would talk about their experience.

~~~
greeneggs
Check out the Kimley-Horn Integrated Transportation System (KITS):

[https://www.kimley-horn.com/service/kits-advanced-traffic-
ma...](https://www.kimley-horn.com/service/kits-advanced-traffic-management/)

A user manual might give you some sense of the complications (bus priority,
special events scheduling, etc.):

[https://dpw.lacounty.gov/TNL/ITS/KITS/site_files/LACO%20KITS...](https://dpw.lacounty.gov/TNL/ITS/KITS/site_files/LACO%20KITS%20Manual.pdf)

------
dillondoyle
So cool! I'm sure there's a reason this hasn't been done, but I'm curious if
there would be value in doing using this for some type of folding at home
distributed optimization problem solving. Converging on actual suggest
improvements that might not seem obvious

------
pugworthy
Adding a options for rethinking current systems would be nice.

For example, autonomous vehicles would be interesting. You potentially don't
need intersection control with all autonomous traffic. Or what is the benefit
of certain streets or lanes being designated autonomous only?

And what is the impact of education? Is there a way to change behavior that's
cheaper than changing a street for example? You can change the street, but you
can also change how people use the street.

~~~
runarberg
> You potentially don't need intersection control with all autonomous traffic

I thought this myth had been widely debunked. In a world where every commuter
drives a 100% autonomous car, you still have hobbyists driving old vintage
cars, cyclists riding non-autonomous bikes, pedestrians, birds, runaway
shopping carts, etc. disrupting the flow of traffic. Without traffic control
you make the intersection in-crossible for a significant subset of the
traffic.

------
10euros
When are we getting the CHAZ DLC?

------
WalterBright
Fixing the traffic lights would go a long way towards improving traffic flow
in Seattle. How much time do you spend sitting at a red light when there's no
cross traffic? How often are you and the 5 cars behind you abruptly stopped to
let one cross traffic car through?

Lots of traffic lights already have cameras on them. Hook 'em up to an AI and
a goal of maximizing throughput.

~~~
xxpor
This sounds simple but it really isn't.

First, the vast majority of signals aren't networked, they're on simple
timers. And you can't just put them on the internet for hopefully obvious
reasons.

Second, there's a bit of a butterfly effect. Change one thing and the whole
system reacts in sometimes unpredictable ways.

Third, you need to account for pedestrians too. There's ADA requirements
around how long signals are green for based on the width of the road.

Fourth, you need to account for pedestrian load. There's no cameras trained on
the areas where pedestrians gather. If you're going to say they just need to
press the button, no:

[https://cal.streetsblog.org/2020/04/01/stop-touching-
pedestr...](https://cal.streetsblog.org/2020/04/01/stop-touching-pedestrian-
beg-buttons/)

Basically, it's really not that simple.

~~~
throwaheyy
Not really, all the above points was solved 40+ years ago.

[https://en.wikipedia.org/wiki/Sydney_Coordinated_Adaptive_Tr...](https://en.wikipedia.org/wiki/Sydney_Coordinated_Adaptive_Traffic_System)

~~~
jschwartzi
I’m curious if you have any professional experience with this? How well does
it accommodate bicyclist and pedestrian traffic flow? In Seattle they’re
trying to accommodate these kinds of traffic instead of cars because it’s
really expensive to build more streets. And we’ve learned over the past 20
years that optimizing for car traffic means making it less safe and harder to
walk or bicycle.

