Towns Dev Log

Airships: Conquer the Skies
2 Mar 2018, 11:53 a.m.

With the conquest multiplayer alpha on the way, my gaze now turns towards upgrading the conquest gameplay in general. If you recall, I did a big thing late last year where I asked players what they'd like to see in the finished game. Apart from conquest multiplayer, the most popular item was deeper conquest gameplay.

I'm implementing this on top of the changes I made to the game for multiplayer, which means you're going to have to wait for quite a while yet for this all to arrive, but then it will arrive all together in one glorious dev 10 update.

The first step I'm working on is the introduction of smaller towns. There's a big demand for bigger maps that take longer to play through. But instead of making a huge mosaic of dozens of empires, I'm instead keeping the number of empires the same and making them bigger. Each empire will start out with a capital city and three smaller towns (usually) surrounding it. By conquering towns, you can chip away at the might of other empires and increase your own.

Towns are basically cities in all aspects, except that they produce less income and don't have a shipyard. So you can only build defensive buildings, but no airships or landships.

So here's the implementation:

Cities are placed like before on the map, nicely spaced out. Then, towns are added, spaced more closely, and mostly placed next to their parent city. Occasionally, if there's no space, a town will end up disconnected from the parent city, which adds some variety.

Then, all the towns and cities and monster nests get connected up with roads. I've been improving that code as well, making the game better at re-using existing roads rather than creating multiple roads that run parallel or intertwine in weird ways. I've also fixed a bug where you couldn't travel to a monster nest in another territory despite there being a road going through it.

This all worked pretty well, but when I started up a large map, some painful performance problems became apparent. The game would just... pause for several seconds at the start, and then stutter constantly. I dug out my trusty profiler, and found that the strategic AI was having some problems adjusting to the new situation. I'd written some code that basically went over all cities and for each of them looked at all combination of cities. So by quadrupling the number of cities in the game, this code now took 4 x 4 x 4 times - 64 times - longer.

All in all, I found around three places where I'd written the code assuming there'd be a handful of cities. I fixed the performance problems through a combination of rewriting and just using the code less often.

Finally, I had to think about how to display the towns. With so many places now on the map, it had become very cluttered. So I made the display of things more dependent on zoom level, with the names and arms of towns only popping in when you are zoomed in enough. I also spent some time cleaning up some other parts of the map display code, resulting in an overall nicer appearance.

So what's next? I need to spend a bit more time checking the AI behaves sensibly now. Then I'll get started on the other major new features, including strategic resources and research...