Live data from Hacker News

Abstreet: Traffic simulation game written in Rust

github.com

11–20 of 77 posts

Re: Abstreet: Traffic simulation game written in Rust

#11
post #4

Nice work. I'm wondering since this project seems to use its own nicely modularized GUI library, what motivated you in particular to write your own instead of using an existing Rust GUI library/game engine ? And would you make the same decision if you started now (vs 2 years ago) ?

Iced has emerged as a strong favorite for game GUIs: https://github.com/hecrj/iced

Re: Abstreet: Traffic simulation game written in Rust

#12
Very cool!

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!

[1] https://sumo.dlr.de/index.html

Re: Abstreet: Traffic simulation game written in Rust

#13

I swear I was discussing exactly this sort of simulation with my brother as both of us wondered how many city planners model the changes they are making to the road networks before pumping millions into projects that dump traffic from one point to another. Additionally, it'd be interesting to simulate the cascading effect of traffic violations like bad parkings, straddling lanes. Kudos to Dustin for working on this.

in nyc it's quite common (maybe even required) to run simulations of changes of infrastructure before making them to see how they will effect traffic.

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.

Re: Abstreet: Traffic simulation game written in Rust

#14

I swear I was discussing exactly this sort of simulation with my brother as both of us wondered how many city planners model the changes they are making to the road networks before pumping millions into projects that dump traffic from one point to another. Additionally, it'd be interesting to simulate the cascading effect of traffic violations like bad parkings, straddling lanes. Kudos to Dustin for working on this.

Came here to write almost exactly this!

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.

Re: Abstreet: Traffic simulation game written in Rust

#15
While I'm not overly optimistic about his goal of getting solutions from the game to be enacted in real life Seattle, it's a really admirable idea and an impressive execution to boot.

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?

Re: Abstreet: Traffic simulation game written in Rust

#17
post #4

Nice work. I'm wondering since this project seems to use its own nicely modularized GUI library, what motivated you in particular to write your own instead of using an existing Rust GUI library/game engine ? And would you make the same decision if you started now (vs 2 years ago) ?

Iced has emerged as a strong favorite for game GUIs: https://github.com/hecrj/iced

Looks promising. But I don't see any sort of XML-like component layout/config so I assume it's all done by calling methods? That sounds kind of kludgy. Or am I missing an example?

Re: Abstreet: Traffic simulation game written in Rust

#18
post #2

The next step would be writing a program to modify intersections, monitor how long cars take to get a journey done and optimize the streets for total transit time, or emissions, or whatever. That's probably faster than letting people discover optima along their usual routes.

I'm pretty sure that is a NP-complete problem (or worse). Which means on the scale of a city all the computers in the world couldn't solve it in a human lifetime. A small town is easy, but in a large city is out of control.

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.

Re: Abstreet: Traffic simulation game written in Rust

#19

Earlier quoted context omitted.

Iced has emerged as a strong favorite for game GUIs: https://github.com/hecrj/iced

Looks promising. But I don't see any sort of XML-like component layout/config so I assume it's all done by calling methods? That sounds kind of kludgy. Or am I missing an example?

What makes you think xml isn't kludgy

Re: Abstreet: Traffic simulation game written in Rust

#20
This is pretty cool! One thing that bothers me about every traffic simulation I've ever seen, though: all of the vehicles and pedestrians here seem to be obeying the law.

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.

Post reply on HN