Connecting cities with rails took more time than I thought, but most of the framework has been set up.
Cities uses parcels to place buildings. I used a similar strategy for roads, but needed custom parcels because the existing DynParcels weren't flexible enough. So I created a new
RoadParcel which essentially marks down the regions where a road will be laid by storing that road's
RoadSegments. These road segments are just
Rect2is with some additional information like height. The square sections of the road shown below are expanded segments.
Despite using a rasterizer which leverages the
BlockBufferSystem from DynamicCities, block placement is still an expensive process, which makes placing roads so inefficient that even my beefy system feels like a potato while testing. Possible ways to improve performance would be to minimize extra blocks placed, create fewer roads and find exactly which methods take up the most time. These possibilities will be explored in the next week.
SettlementEntityManager has a
settlementMaxRadius property which should, theoretically, limit the size of all settlements. So when I'm placing my roads, I start at a distance
settlementMaxRadius + some margin from the town centre. The problem is somehow this doesn't work and settlements exceed the max radius specified.
Another problem that this exposes is the interaction of buildings with roads. Once parts of the road get inside the settlement, buildings start forming on the roads. Ideally this should not happen and regions where roads are laid should be out of bounds for buildings to be constructed on.
These problems will be going into my backlog.
- Fix performance issue, optimize if necessary
- Create a necessary components in MetalRenegades to have rails instead of the default generic roads