Live data from Hacker News

Abstreet: Traffic simulation game written in Rust

github.com

31–40 of 77 posts

Re: Abstreet: Traffic simulation game written in Rust

#31
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) ?

I wouldn't call the GUI library "nicely modularized" at all. :) I regret rolling my own; the best choice when I started probably would have been https://github.com/Gekkio/imgui-rs. Recently iced has appeared and looks like the most promising.

Re: Abstreet: Traffic simulation game written in Rust

#34
post #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 duri…

I'd like to explore more realistic behavior at some point. Right now, vehicles will avoid starting a turn if there's not enough time left in the signal, but this is an optimistic estimate assuming nobody else is creeping along on the same turn: https://github.com/dabreegster/abstreet/blob/770507610caf4e4...

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.

Re: Abstreet: Traffic simulation game written in Rust

#35

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.

See AIMSUN Linsig Paramics VISSIM For examples of commonly used traffic modelling packages More high level strategic modelling is often done in Cube

The professional simulators are prohibitively expensive for individuals to play around with, sadly. I had the chance to try VISSIM recently, and the UI was overwhelming -- the general public would never casually learn to use something that intricate. I'm trying to strike a balance between the heavy-duty simulation packages and existing city sim games -- something with a good approximation of a real city by default, and something that's very easy for anybody to pick up.

Re: Abstreet: Traffic simulation game written in Rust

#36
post #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 duri…

I've had a lot of fun tweaking this setting in Cities:Skylines. There's a user-written mod called Traffic Manager Presidential Edition which lets you enable some (but not all) bad behaviors.

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.)

Re: Abstreet: Traffic simulation game written in Rust

#37

Looking to learn rust. Anybody know how/what library was used to build those graphics? I'm looking for 3D or 2D graphics libraries that are good for prototyping stuff in Rust.

Looking at the Cargo.toml for ezgui this uses glium which is an attempt at making OpenGL safe using the typesystem. I don't think it's worth the hassle.

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.

Re: Abstreet: Traffic simulation game written in Rust

#38

Earlier quoted context omitted.

See AIMSUN Linsig Paramics VISSIM For examples of commonly used traffic modelling packages More high level strategic modelling is often done in Cube

The professional simulators are prohibitively expensive for individuals to play around with, sadly. I had the chance to try VISSIM recently, and the UI was overwhelming -- the general public would never casually learn to use something that intricate. I'm trying to strike a balance between the heavy-duty simulation packages and existing city sim games -- something with a good approximation of a real city by default, a…

Agreed - I used VISSIM for some work in a university transportation research lab, and it was very interesting after learning how to use it - but both expensive and very intricate to learn. It even supports other types of transportation, like rail networks. It would be great to have a simplified version or some kind of middle ground to help people understand these complex systems.

Re: Abstreet: Traffic simulation game written in Rust

#40
post #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 duri…

I've had a lot of fun tweaking this setting in Cities:Skylines. There's a user-written mod called Traffic Manager Presidential Edition which lets you enable some (but not all) bad behaviors. 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.) Thi…

The feature, for anyone curious what the other rules it'll break are. [0] TMPE is such a great mod for improving the game's traffic simulation. I've spent a lot of time playing with timed traffic light systems. Cities Skylines will also automatically despawn vehicles to prevent massive gridlock that will break your city, and TMPE can disable this assistance for a truly difficult game.

[0] https://tmpe.viathinksoft.com/wiki/index.php?title=Reckless_...

Post reply on HN