0.4.0: Coastal cities

List of changes:

Cities/towns on a (sea/lake) coast

Nicer map labels (Merriweather TrueType font with outlining)

Slightly modified UI which auto-hides after a short timeout

Some old bugs and glitches are fixed, some new ones are introduced - same as usual

Coastal cities

The new version of the generator is now able to place a city on a coast or to be exact it can place a coast next to a city. There are no rivers yet, they will be added later, since I'm going to implement them differently. As with walls, plaza and citadel currently you can't specify whether you need a coast or not, this parameter is chosen randomly (2 out of 3 layouts are coastal). Here is roughly how the coast thing works:

Before building a city MFCG marks some part of the terrain as water. Right now the coastline it creates is far from perfect - sometimes not suitable for a real coastal settlement and almost always lacking interesting features such as bays and peninsulas. I hope to improve this part in the future. Then it builds the city normally, making sure no wards spawn in water. In most cases it gives the city a "bitten apple" shape. In theory it should be able to build cities on islands, but I haven't tried that yet. The section of the city wall which borders the water is removed to provide the city access to the shore. It's the most obvious and easy to implement layout for a port city, but not the only one possible. A number of seafront blocks are assigned to be "docks", piers are drawn next to them in the water. These blocks don't have to be exactly docks, just some water related wards e.g. fishermen wards.

That's it, conceptually it is very simple. In practice it took much more time and much more refactoring than I anticipated. Also surprisingly adding a waterbody had a serious negative impact on performance so I needed to invest into optimization.

What's next?

The next big feature I'm planning to work on is rivers/canals. Unlike sea they won't take whole patches of terrain, but will run between them similarly to roads. This approach should allow me to create narrow channels, I just hope it will be "compatible" with existing coast feature.

Another thing in my to-do list is smaller but equally important I guess: a UI for editing map parameters, both "structural" (e.g walls, plaza, coast) and visual ones (e.g. colour scheme, hatching). Initially I was going to implement something fancy like a dialog window or sidebar with tabs, but I don't want to spend too much time on it so now I think it will be a simple hierarchical menu. Also I'll try to bring back zooming. I'm not sure if anyone needs it, but it was there in the beginning and then I had to remove it and now it makes me feel uncomfortable :)