# Liikennematto devlog #4: hello real-time traffic simulation

**URL:** <https://discourse.elm-lang.org/t/liikennematto-devlog-4-hello-real-time-traffic-simulation/7529>\
**Category:** Show and Tell\
**Created:** [July 7, 2021, 2:33pm UTC](https://discourse.elm-lang.org/t/liikennematto-devlog-4-hello-real-time-traffic-simulation/7529 "2021-07-07T14:33:16Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![klemola](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.elm-lang.org/klemola/32/4593_2.png) [@klemola](https://discourse.elm-lang.org/u/klemola)\
**Post date:** [July 7, 2021, 2:33pm UTC](https://discourse.elm-lang.org/t/liikennematto-devlog-4-hello-real-time-traffic-simulation/7529/1 "2021-07-07T14:33:16Z")

</div>

It’s time for yet another Liikennematto devlog. This one is substantial, as I cover 8 months of work on a rewrite of the traffic simulation. I tried my best to explain how the rewrite works without going too much into detail. Like the previous entries, this one should be interesting for aspiring game/simulation developers. The post is full of videos that show various aspects of the simulation, which should be interesting for everyone!

Feel free to ask me questions in this thread.

[Read the devlog here](https://matiasklemola.com/liikennematto-devlog-four)

If you’re unfamiliar with the project, you can also start from the [first entry](https://matiasklemola.com/liikennematto-dev-blog-one)

---

<div class="post-metadata">

**Author:** ![hasko](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.elm-lang.org/hasko/32/4061_2.png) [@hasko](https://discourse.elm-lang.org/u/hasko)\
**Post date:** [July 17, 2021, 1:52pm UTC](https://discourse.elm-lang.org/t/liikennematto-devlog-4-hello-real-time-traffic-simulation/7529/2 "2021-07-17T13:52:47Z")

</div>

Thanks for the great write-up. I think it’s quite inspiring. You mention that you still experience gridlocks sometimes. In case you haven’t thought about it yet: Maybe restarting cars after a random wait time (with exponential falloff) would help resolve those. It’s a common technique to handle collisions.

---

<div class="post-metadata">

**Author:** ![klemola](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.elm-lang.org/klemola/32/4593_2.png) [@klemola](https://discourse.elm-lang.org/u/klemola)\
**Post date:** [July 23, 2021, 4:46pm UTC](https://discourse.elm-lang.org/t/liikennematto-devlog-4-hello-real-time-traffic-simulation/7529/3 "2021-07-23T16:46:26Z")

</div>

Thank you! The idea of restarting cars that are in a gridlock is worth considering. Currently the cars have no way to escape in terms of pathfinding, as the rails they follow are blocked. One of the cars could reverse to clear the gridlock while others wait, or there might be an alternative path that the car can follow that bypasses the gridlock. Once I have improved the pathfinding to allow one of the solutions above, I can elect one of the cars as the leader (which is similar to stoppping/restarting) to avoid gridlocking again.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex035/uploads/elm_lang/original/1X/50a05e53677a2c3b47776d7abd0f113eb50193a1.png) [@system](https://discourse.elm-lang.org/u/system)\
**Post date:** [August 2, 2021, 4:47pm UTC](https://discourse.elm-lang.org/t/liikennematto-devlog-4-hello-real-time-traffic-simulation/7529/4 "2021-08-02T16:47:01Z")

</div>

Closed on August 2, 2021, 4:47pm UTC

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.
