I made quite some progress lately. The biggest news is probably a not entirely shit traffic simulation™!
Vehicles moved completely randomly up to this point. When the map was loaded, vehicles spawned on the streets with a random rotation and they just moved forward. If they drove into a static object, the collision angle was reflected and they just kept on moving. They didn’t care about the street at all. Super boring.
I did it this way because I didn’t know how to make the vehicles use the streets but also be aware of the destruction going on. But I came up with a solution.
I simply place a bubble on each street segment. When the level is loaded those bubbles look up if there is a bubble next to it on the grid. If there is, it saves them in a list. So when a car enters a bubble, the bubble sends all it’s neighbor bubbles to the vehicle. The vehicle now decides into which direction to drive based on where it comes from, so they don’t just move back and forth between a couple of bubbles.
Now the player walks around and destroys stuff. Bug destruction chunks are on the street. If one of those chunks lands inside a bubble, that bubble just deletes itself from the neighbor bubbles list of possible drive directions so vehicles avoid that direction. If the player moves that chunk out of the way that bubble adds itself to the neighbors list again.
This is what it looks like:
(Some cars still spawn at weird positions so they didn’t get the memo yet.)