July 18, 2013 | Dukus | 56 Comments
It's been a few weeks since I've posted anything of note. Most of what I've been working on isn't quite ready to show or is balance changes and code fixes.
A large part of my work has been on large scale disasters that will destroy buildings a leave a path of destruction across the town. Building a town and then unleashing a disaster is pretty fun to watch. I'm still play balancing how often they happen and ways the player can prepare for the disasters ahead of time.
One of the ways to prepare for disasters resulted in a few more buildings and objects that can be placed on the map. Adding things like this is dangerous in terms of feature creep. When I add a new object, I start thinking of all sorts of ways it could be used, even though I'm trying to head towards content lock-down.
One of these objects is a well. It makes me think about making water and thirst a need of citizens. Then I'd have yearly rainfall, usage, and closeness to a body of water effect how much water can be gotten from a well. Then I think I'll have farmers haul water to crops in years where it doesn't rain. That then makes me think about allowing the townsfolk to dig irrigation ditches.... At some point I have to stop thinking this way because I really need to ship the game. And what I just described is probably more than a week of work, and the time spent getting water will slightly unbalance the amount of time townsfolk currently spend working.
Despite thinking about things like water, I've also added some map starting condition parameters, changing map size, climate type, and terrain type. These really just come down to how hard or easy the player wants to make the game play experience. I've also been considering exposing the random seed used to generate terrain so that good maps can be replayed and shared.
The other significant change I've been making is the happiness of the townsfolk. I've had happiness in the game for a long while, and a happiness achievement, but not many things factored into it. Generally until a town was very mature happiness was very low. This wasn't good balance. A small town should be able to have relatively happy people when it's just starting off.
I want overall happiness to be a good measure of how well the town is doing, and in turn how well the player is doing, but unless it's meaningful I'd rather pull the stat completely. Before removing it I wanted to try to flesh it out. So I took a few days and made more events effect happiness.
Happiness is now related to being healthy, cold, sick, or hungry, deaths of family members and how they die, availability of supplies, frequency of job changes, housing type and location, what types of buildings are nearby, having children, getting married, getting better clothes, food variety, how much time is spent working, new construction around homes, disasters, how far away a job is from home, and how much time is spent idling at common locations.
Buildings can also now be categorized into several categories of happiness (or sadness), such as entertainment, spirituality, shopping, safety, health, and eye sores. Visiting these places and living near them makes the townsfolk happier or sadder.
After a few more days of play and if the happiness change works out, I'll have to finish modeling and texturing some new buildings too - I've come up with additional places townsfolk will spend their time, and as a happy outcome of design, most of the buildings have other side uses in addition to happiness. This isn't so bad, as I had already planned on making additional 'spice' buildings - now they'll actually have a purpose.
While making the happiness change I also rewrote the decision making process for the AI. It was previously based on a state machine that had states for what the citizen was doing, and the transitions between states ceased being easy to maintain as the AI got more and more complicated. When I went to add behaviors for citizens idling around enjoyable locations I had enough of it.
I removed the state machine and gave each of the citizens wants and needs a weighted value based on their current health, happiness, hunger, etc. Based on these weights the citizen decides what to do. This turned out to be much less code, easier to maintain and extend, and the citizens are now slightly more dynamic - when faced with several possible actions they'll pick randomly rather than follow a strict priority list.
Now I've got to put in a few days of test time with these changes and make sure the game is still balanced and that happiness in small towns will be maintainable (and I'll continue thinking about thirst and water usage...)