Diary #19 – Homelessness

After the 0.4.03 release, there were two main game mechanics yet to be added: homelessness and resource storage. Resource storage is currently in progress, but homelessness is now fully in place, so I figure I’ll talk about what it is in the context of Iron Village, and a bit about how it was implemented.

Homelessness is when a Pop doesn’t have an assigned home. Specifically, when a Pop is tired from working, they enter a GOING_TO_REST state. If they already have a residence, they’ll go there, but otherwise they’ll request one from the ResidenceManager. If no homes are available, they’ll go rest at the train station instead, where there is an infinite amount of space to rest. This was already implemented already, but it had no actual impact to gameplay. What’s new now though is Satisfaction.

Satisfaction is an internal value that Emotional Pops (i.e. Pops with an Emotional component, a.k.a. all of them now) have. Right now, housing is the only thing that affects this value. (There’s nothing else planned to affect this value before release, but it’s designed to be extendable in future updates/sequels/titles that reuse the system.) Going to sleep in their own home makes satisfaction go up. Sleeping in the train station does the opposite. Getting assigned a home makes satisfaction go up. Being evicted does the opposite. (Eviction only occurs as a result of demolishing a Pop’s home – this isn’t Landlord Simulator.)

A homeless pop walks down the road towards the station, the only place left to get some rest.

If a pop tries to sleep in a home, but is unsuccessful in finding one, you’ll notice a little icon above their heads indicating their homeless status. Pops aren’t worried about their lack of a home until it’s actually time to sleep, so you have a little bit of time to address the issue. Once the icon appears though, their satisfaction has started to take a hit. This can still be remedied by building enough housing though.

Two homeless pops have had enough – their status icons have now “upgraded” to show that they are now emigrants.

Eventually though, the Pop will get too frustrated with their lack of housing and decide to leave. They’ll have one last sleep in the station, head to the platform, and wait for the next train out. Those passenger trains that bring you pops? They can take them away too, there just hasn’t been anyone wanting to leave until now.

The way the satisfaction system is written, a Pop could theoretically get enough satisfaction to stop waiting around and return to work. However, the only source of satisfaction is being assigned a home, and sleeping in their own home; a pop will only request a home when they are ready to sleep though, and without anything else to make them tired (only work does that), they’ll just stubbornly wait for that train.

Those two pops board the train – although luckily for us, there’s two new pops in town.

So, that’s how homelessness works in Iron Village. The funny thing with implementing this was that most of the programming was pretty simple. The Pop’s internal state machine was designed to be extendable like this, and for once, I successfully future-proofed my implementation well. I was so impressed by my own abilities, until it came time to update the train UI once they boarded the train. Turns out, the code that I thought was doing that was orphaned code – old code that had since been bypassed, but I never cleaned it up completely. Whoooooops. So of course, that’s where most of the implementation time was spent, as well as where most of the ego-crushing happened.

Anyway, the original timeline was that I would finish up resource storage and a lot of smaller tweaks, fixes, and UI by the end of the month, and then put out the “Alpha 1” Demo. While this did account for a vacation last week, it didn’t account for a bit of a crazy week this week, so that’ll likely be some point in early July. There’s a lot more content to add, as well as graphical features (including shadows!), but the new game mechanics stop here. Which is a pretty exciting milestone to get to!


Comments

Leave a Reply

Your email address will not be published. Required fields are marked *