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