Developer Log #2

Colonist Needs

So far I’ve planned out colonists having needs for sleep, hunger as well managing health and mood. Last week I started out by writing a generic needs system which, I thought, would be able to handle the needs of the colonist. The idea wasn’t a bad one, but the system was far too generic to handle anything specific or fun with the needs. After more analysis I realized that the needs really needed to be handled separately to really allow for different behavior and how the need is met.

After realizing I was over thinking the problem I came to the conclusion that I could simply just have each need as a component, in my custom component system, which would handle the raw data values as well as generating any work that needed to be done to supply the need.

Which one to choose?
Which one to choose?

Work is handled by looking for the closest object with a work component attached, checking if it’s ready/workable and then doing that work. By attaching work related to needs on to the colonist object itself I could ensure that a colonist would attempt to do the work related to their needs before doing any work elsewhere.

So far this system works out pretty well. I’m still working to implement the various needs, but sleep is currently being handled by either sleeping in a bed or sleeping on the ground if no bed is available. Sleeping on the ground will give a mood penalty and take longer to restore sleep. By handling needs separately I can better test/handle result cases for applying positive/negative attributes.