Just a brief update this week, as I’m currently in the process of reworking the traffic system so not much new stuff to show yet. This is in preparation for better traffic simulation, but also to make trams easier to implement.
The fundamental changes are more or less finished. Traffic simulation was pretty messy before, with cars only javing access to the position of the target road tile. This meant things like driving on the right side could only be handled by offsetting the tile position. Same with leaping over edges, which included a lot of vector math to find whether the next road tile was on an inner corner or outer corner. All of this had to be done on a per car basis, which ended up being a bit heavier than I like. The results were also that traffic was rather floaty, due mostly to the lack of information to guide cars to the next destination.
The way roads work in the game is that only ends, turns, T and X intersections as well as straight tiles where there’s an “edge leap” are registered. So cars assume that between the current position and the next is a straight path. This would sometimes get messed up making cars travel diagonally when they failed to find the next tile. All this has now been tightened upp, and baked into each registered tile is a node system that forces the car to travel from and to each individual node in the correct order. This makes traffic simulation much tighter and cleaner looking.
With these changes I’ve also been able to add more information into road tiles, so that cars know whether they are nearing an intersection or if they are in the inner or outer lane of a curve (unlike before, when this was handled with clunky offsets). All in all, about 70 lines of code have been cut from cars, mostly vector math. I’ve also been able to add in a simple system of traffic rules, so that cars take turns at intersections.
This is not all that’s in the works though, as seen above I’m also expanding on the information presented in the city statistics window. Among them a slider for the availability of education seats and hospital beds per student and ill person respectively.
How much is stored in cisterns and batteries has also been added into the city statistics panel. I’ve also expanded the budget window to add a breakdown of hotel taxes as well as other taxes and costs. This is for 0.33, but beyond that I’m going for a more expansive budget window.
I’ve currently no release date for 0.33, but july 6th is the goal!