Liikennematto devlog #4: hello real-time traffic simulation

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

If you’re unfamiliar with the project, you can also start from the first entry

11 Likes

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.

1 Like

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.