Abstreet: Traffic simulation game written in Rust
github.com
github.com
In the meantime, I have heuristics like https://github.com/dabreegster/abstreet/blob/ed2f703e859d57d.... They're not great at all. If you're interested in improving these, https://github.com/dabreegster/abstreet/issues/8 is a great bug. ;)
Some traffic signals are adaptive (they'll switch phases sooner/later based on real-time vehicle detection, bus priority, etc) or even centrally controllable. I'm not modeling that yet.
We certainly don’t deserve you though, you’ve seen how we drive
That's just not realistic -- especially on Mercer, which is blocked (both directions) every few minutes in rush hour by some jerk trying to make an illegal turn onto a packed street. I'd say the main causes of traffic blockages that I encounter during rush hour are drivers blocking the box, and pedestrians entering the crosswalk against a red hand. I also see a lot of lane sweeping, too, which I assume is from the influx of drivers from California (where it's legal).
I hope traffic engineers aren't making real-world decisions based on simulations that follow all state laws perfectly, but I fear they are.
The principle one is entering an intersection that they don't have room to leave, so they're still there when the signal changes and block the cross direction. (Is this AKA blocking the box? That sounds like a regional term.) This is needed to induce most forms of gridlock.
I'd love if it had more support for jaywalking and vehicles stopping in travel lanes with their flashers on. (And then I'd love if I had a lightning-bolt tool where I could just smite them from on high. There probably is a mod for that, actually.)
[0] https://tmpe.viathinksoft.com/wiki/index.php?title=Reckless_...
You can get a ticket in many places for crossing at the wrong spot, or agains the signals, even if you didn't inconvenience anyone.
I'm starting to see why the stereotypical USian drives everywhere, even in small areas.
You're not wrong about the system heavily favoring driver's convenience; and when drivers break the law (even if they injure someone) the punishments are light.
> Originally, the legal rule was that "all persons have an equal right in the highway, and that in exercising the right each shall take due care not to injure other users of the way".[8] In time, however, streets became the province of motorised traffic, both practically and legally. Automobile interests in the US took up the cause of labeling and scorning jaywalkers in the 1910s and early 1920s, by then the earlier term of "jay driver" was declining in use.[9][10] The earliest citation in the Oxford English Dictionary follows in 1917.
[8]: Miller McClintock for the Chicago Association of Commerce, "Report and Recommendations of the Metropolitan Street Traffic Survey", p. 133, quoted by Norton, Fighting Traffic, on p. 289.
[9]: Norton, Fighting Traffic, pp. 79-79.
[10]: Peter D. Norton, "Street Rivals: Jaywalking and the Invention of the Motor Age Street", Technology and Culture 48 (April 2007), 331-359 (342). doi:10.1353/tech.2007.0085
cars have dedicated lanes for driving
bikes have dedicated lanes for biking
legs have dedicated lanes for walking
do NOT cross the lanes
- "Turn on your lights"
- "Move over"
- "Thanks"
- "Sorry"
- (incoherent obscenities)
- "Have a nice day"
I'm seriously considering picking up some programmable LED sign and wiring these sorts of messages to buttons I can press while driving.
I drove in downtown Seattle rush "hour" traffic for the first time in almost a year earlier this week, and Maps was giving me all kinds of dangerous, traffic-jam-causing directions. Things like "make a left turn at an uncontrolled intersection, from a side street onto an arterial that's gridlocked for about a kilometer in either direction". Apparently it had been happening for awhile, because the city had installed a barrier across the median, and I couldn't have followed the directions even if I'd wanted to.
IOW, it's not just drivers ignoring the law, it's tech companies explicitly instructing drivers to break the law and cause traffic problems that the simulations need to account for now.
It is. If a driver comes across the situation you described, any action other than a right-hand turn means they should probably take a driver's ed course again. Regardless of what a robotic voice on their phone is telling them.
Google maps once instructed my wife to do a U-turn on Lakeshore Drive. Nope.
By the time I realized that Google had given me a route that would not work, breaking out of it cost me 10 minutes of sitting in traffic going the wrong way. I think most people would take the "drive like a jerk" alternative at that point, because the sunk-cost illusion is hard to let go of.
A self-driving car is basically just going to do what the mapping software tells it to as well, so the "bad instructions from tech companies" factor is a problem that needs to be addressed specifically anyway.
I don't think this concept is mentioned anywhere in the current curriculum, and I think a lot of people are ignorant enough of technology to obey it more blindly than they should.
Not so much actions that break the law, but rather actions that are just pointless and stupid.
And the process for reporting a map error or unsafe maneuver instruction is way too complicated to do while moving, but can't be done after you've left the area, and there's no function to just submit a voice note.
Related:
Some time back, I gave my old TomTom to a not-very-technically adept friend. I figured a little introduction was in order, and at first, I asked her to interact with the unit while I did the driving.
The first thing I did was ignore every instruction. A few minutes of https://xkcd.com/1837/ ensued.
Because I wanted to drive home the point, you won't break it by ignoring it. If you don't feel like making that turn, don't make it. The voice in the box will just recalculate, it won't get annoyed, it has infinite patience and can recalculate for as many maneuvers as you feel like missing.
This is a crucial bit of understanding that I think many drivers lack, as they blindly try to follow impossible or unsafe maneuvers like the computer's word must be obeyed absolutely.
If I had a button which could project thoughts into other people's minds, but _only one thought_ and once programmed the button can never be changed, I think I might set it to "It's okay, just go past it, turn around, and come back." I think a huge fraction of traffic snarls could be eased by spamming the hell out of such a button.
Right now, it's hard to get a full day of simulation to complete at all, because vehicles gridlock on really short roads inferred from OSM. Once a realistic amount of traffic can get through at all, then I'd love to simulate some percentage of illegal behavior.
Seattle is a good example of how bad design can create incredibly bad traffic despite the fact that number of cars are actually not that high. Assign a cop to certain intersections would relief most of the traffic I presume.
https://www.nytimes.com/2016/10/13/us/why-last-second-lane-m...
https://github.com/citybound/citybound
I really hope A/B Street and Citybound developers will work together.
Kudos to Dustin for working on this.
[0] https://en.wikipedia.org/wiki/Microsimulation#Traffic_micros...
source: my partner helps run these simulations as part of their job/their company gets contract work from the city all the time to check changes of bus routes/etc.
I've been thinking for a while now about building a system like this. There is one particular set of traffic lights on my commute which causes 45-60 minute delays at peak times. I've wondered how some small changes to timings of the light might reduce some of that, and was thinking about building something to simulate it and test my theory.
The other thing that is interesting about traffic patterns is how truly connected the entire network of roads are. You can have a collision on a major road which has a big impact on roads several miles away. I've always thought it would be fun to visualize that somehow, to determine not just the immediate effects of a change to a road system, but how it effects other commuter routes.
Definitely going to play around with this. Kudos to the author.
AIMSUN
Linsig
Paramics
VISSIM
For examples of commonly used traffic modelling packages
More high level strategic modelling is often done in Cube
I've worked with transport and traffic modellers for years now and still don't understand the software packages very well.
But I don't see any configuration option in the examples other than chaining method calls to set each config option. Is there something else?
I'm wondering if, with a big enough budget and a team of skilled devs like Dustin here, the local government could create more refined simulations to tackle these planning issues. Or would that inevitably run into the problem mentioned in his Project Mission: 'People are local experts on the small slice of the city they interact with daily -- the one left turn lane that always backs up or a certain set of poorly timed walk signals'?
Perhaps, with a large enough data pool, even these small quirks could be worked out via simulation?
100% of the intersections I see that get backed up are backed up because someone blocks the box. Can we get more enforcement for that? They don't even need a patrol car. Just have an officer stand at the corner of Mercer and Westlake from 4pm to 7pm, and each time the light changes, walk out into the intersection and ticket the guy who's blocking it. You could write $1000 in tickets an hour, every night of the week.
Many intersections have threatening signs to this effect, but they don't do any good. I've never seen or heard of anyone getting ticketed for that.
I would also like to see some pedestrian bridges or tunnels that would allow walking commuters like me to cross our major streets (Mercer, Denny, Westlake, and Dexters) at any time. This, I strongly believe, could reduce traffic, make residential neighborhoods effectively closer to commercial areas (due to reduced walking time), and improve both vehicle and pedestrian safety. Bridges should be far less expensive than roads, and could be built very quickly.
Cars that block a lane tend to get honked at, and that seems like it should be enough to not to do it again. I made that mistake once and ever since have been vigilant about there being at least a car space available on the other side.
In SF, that would be 2 tickets. A red light ticket, or carpool lane ticket, is $490.
Does Seattle have similar fines?
Ignoring that, cities change. You can come up with an optimal system, but people get new jobs, move to new houses, have kids, die, just to name a few obvious things that affect traffic - it might seem minor but they all add up to your optimal system today being wrong for tomorrow.
Even ignoring that, budgets are finite. The ideal solution probably is to tear down all buildings, move the mountain a few dozen miles east, re-reoute the river, change the shoreline, and then rebuild. Any one of them is possible on a small scale, but not on the whole thing all at once (you wouldn't move a whole mountain, but we have created passes).
Really the best we can do is come up with ideas that are affordable and then test them. One thing this can do well (if the simulation is good!) is let us see if fixing one are makes a different area worse - which helps as talk about the trade offs in the projects we can afford to do.
That reminds me of Sumo[1] a open source traffic simulator I used at university to import a OSM map of town, populate it with activity based traffic and simulated the traffic under different conditions.
While that isn't quite as 'gameified' as this, it was fun!
(It's scary thinking a half-mile traffic jam starts at 4am... and I can't help but wonder what it looks like at more sane hours such as 8:30am or 5:15pm. Is everything just red for miles around?)
(Also sorry for the slow replies, HN is rate-limiting comments because this is a new account.)
https://docs.google.com/presentation/d/1cF7qFtjAzkXL_r62CjxB...
A beautiful piece of work. What else to say.
Realistically, modeling this section of the freeway would be difficult, and proving there would be a net benefit - even harder, because there are accidents due to this on-ramp merge which cause the delays. The simulation has to model accidents to be valid.
If anyone knows of a way to simulate traffic, including changing accident probability based upon traffic flow (quick stops caused by merging traffic likely increase the accident probability), I’d like to model my commute and provide that to the department of transportation.
I'm looking for 3D or 2D graphics libraries that are good for prototyping stuff in Rust.
For 2D I'd recommend ggez, it's easily the simplest and most polished rust game toolkit.
There's a good wrapper for SDL2, but I forget which one it is.
wgpu-rs is a really cool next-gen-but-easier-to-use cross platform graphics API. It's early days though so you have to be willing to do some legwork.
Amethyst is taking a shot at a Godot or Unity style modern integrated game engine. It'll be a while before they get to that level but it's still useful and reasonably well documented.