3/22/2012

Placing cities. It's fun and annoying at the same time.

I've been trying to place cities lately. And although it's fun and offers me some personal pleasure, it's also quite annoying. First of all, it's quite demanding on those milliseconds. The map has metadata on which pixels are coastal pixels, which pixels are along a riverbank, which pixels are land pixels, and which pixels are water pixels. Beyond that, there's just not alot of metadata (I'm betting good money that I will invest time in improving this!), so we have to search and approximate alot. In trying to weight what would make a good city location, there are alot of magic numbers...

If you didn't know already, I hate magic numbers. They make no sense to anyone except me. Even future-me won't find them very logical. And the thought of that makes me sick. But alas, that's the sad truth at the moment. I need some magic numbers to form thresholds and boundaries. I didn't plan to rant over the source code here, but I'm not proud of this part. Don't get me wrong, the current [in progress] result is OK, but it's not really maintainable in the long run. Uncle Bob, or more formally Robert Martin, would literally cringe if he saw it. So needless to say, I'm going to spend some time refactoring and fixing it. I've tried to keep a focus on performance in this project, and performance doesn't always go hand in hand with clean code (sadly). But I'm going to sacrifice a few hundred milliseconds to clear my conscience. I aim to be a craftsman after all.

And that concludes today's rant...

I'll post some screenshots instead. The icons used for the cities ... You can discuss them, sure. But if you think about it, you'll come to the realization that they aren't the pillar of importance here.

Continent with a dry climate

Island with a dry climate
Continent with a more temperate climate
Island with a more temperate climate


No comments:

Post a Comment