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!
One of the goals was to add trams into the game. I’ve noticed while working on them, that it would be much easier to add them in if I started reworking the road connection system first. So the actual tram vehicles will not be added. But the station will be there:
I’m hoping to have the improved road connection system in the next version already, so trams should hopefully not be too far off. This way, the traffic system gets an overhaul too!
I’ve added another set of decoration blocks:
A lot of work has been put into refining some of the systems already in place – the way goods tickets are generated as well as the demanded resources has been reworked and what foods are demanded by different classes of citizens has been changed.
The city stats window has gotten some additional info – The amount of resources produced in the city can now be seen there, as well as the amount of education and health produced compared to how much is required.
Demand for resources and their pricing has also been altered. Instead of the price and demand of a good diminishing very quickly when selling them, now the amount you can sell before price is drastically dropped depends on the city’s population (a proxy for the world population basically). Once a resource has been sold, the time it takes for price to return to normal, will depend on how much has been sold.
0.31 will be live tomorrow. This version will add in the monorail trains, a bunch of new monorail track pieces and fix a bunch of performance issues and slow loading times.
In adding the monotrails, I’ve had to rework how vactracks work – since they share systems. Part of this work has been to fix slow connection calculations, trains sometimes occupying the same track and imprecise movement. Part of this work can now be ported over to roads and cars to start making traffic movement nicer looking. This will be done after trams have been added in (version 0.32).
Monorails being more or less finished (obviously tweaks will be done), trams are the next step. Whereas monorails share systems with vactracks, trams will share the road system. This system has been incredibly slow to calculate what roads are connected and what road system belongs to which road network. In the test city (a huge city with lots of roads), the process of checking road connections when loading the city took 68s. I’ve now managed to cut this down to about 3s. This is a huge performance improvement noticable both when loading cities and when playing the game, as things will connect together much faster now. Some of the techniques I used to improve performance have also been moved over to vactracks, making them faster to calculate too.
Since I’ve been working on a lot of performance related fixes, I’ve also looked into cleaning up the project to remove files not used and also improve import settings. This should hopefully push in game performance a bit. I’ve also looked into the post processing effects.
I’m hoping to get an additional free roam template added as well as some minor decorations. Aside from that, this update will mostly be performance focused. 0.32 on the other hand will add more features, this one is set to release a week after 0.31, on monday the 22nd.
– 3×3 concrete, steel and glass production facilities added.
– Flower farm added. Flowers can now be produced.
– Dyes factory added. Dyes can now be produced.
– Textiles factory added. Textiles can now be produced.
– Monorails added! They currently don’t spawn trains though. This is an early iteration, so many changes still to come.
– Local area effects now non-linear. Before the effects of for example crime, poor health and poor education would be added up. Now a neighborhood might have poor health levels, without taking quite the same efficiency hit. However, when more than one aspect is poor, then it takes a bigger hit instead.
– Vactrains updated. Some more tweaks coming as tram/monorail/vactrain systems receive more love.
– Vactubes made smaller (-25%)
– Changed modifier crate drop frequency and they now only appear near buildings. They also give off a light when they appear.
– Camera controls and gameplay tutorials french localization added.
– Moved farms to its own category (food prod.)
– Trash notice was displayed on load, fixed.
– Better and more consistent collision detection when placing/demolishing buildings.
– Improved loading performance. Improved on placement times (the first part of the loading bar). Also improved road connection calculations. This is the last bit of the loading bar. More work on loading performance remains, but this should take a fair chunk out of loading times.
– Fixed buildings sometimes not registering a nearby good (collision layer mishap).
– Fixed bug where nested vacstations weren’t working.
– Fixed buildings not displaying production despite being in a network connected to a vacstation.
– Fixed vactrack train not spawning on load.
– Fixed bug where click and drag placing blocks in the center would not work.
– Fixed modifiers being mapped oddly (cereal modifier added fruit for example).
– Fixed descriptions of crates in the modifers and crates window.
– Fixed glossmap for 1×1 tier one residence
– Fixed traffic timestep being a bit slower than it should be when city has been loaded.
Aside from the newly added resource tree with flowers farms, dyes factories and textiles factory displayed in previous devlogs, public transport has been a big project this time around. There’s a lot of work involved in getting this working properly, so it’s not all there yet. But you can now construct monorails!
I had initially meant to add trams in first, but this requires a bit of additional work on how roads and road bound vehicles work, which I will be finishing up for next update. There’s been some work done already, but this part of the code is currently a bit slow so it needs to be optimized before I can move further with it.
Monorail stations and connections can be built though, but won’t spawn trains currently. Monorail trains will be a bit funky so they require a bit of additional work on top of the vactrain code that’s already in the game.
On the subject of vacuum trains, they now have wagons! I’ve also made the movement a bit stricted so they stay in the vactube! More work is still needed to tidy up everything and make it look nicer, but it’s getting there! Here the train and wagons can be seen in a user made city (and an amazing build it is!!).
In this city there was an issue with nested vac train stations not tying together different road networks. This has now been fixed so that vac train stations work properly. Cities can now be spaced out on different islands and share resources as long as there is a station and proper connection. There still needs to be an atmoport near one of these stations.
In the next update, there will be more public transport, some new decos, a first implementation of disasters (fire) and a bunch of other things. I’m hoping to have this version out monday the 15th!
Here’s another user build that I find really nice: