Activated; yay, thanks!
I already did some thinking and made some notes about morale and lifetime, and it would seem you're thinking similar thoughts (or should all this go on redmine?):Death:
Upon death, individuals are removed (object deleted) and the relevant data is stored, if needed. This for possible stats like 'number of dead colonists'. Otherwise every call needs to incorporate the boolean 'mDead', and most data is useless anyway.Age:
In your code, you used maxAge, but this introduces numerous limitations. Repurposing of maxAge as a chance-based calculation: every turn every individual has a chance of dying, given by the following formula (simple example, assuming 3200 is the max age): (1.1 ^ (x / (3200 / 48 ))) - 1. This starts out very close to zero, and slowly increases until it hits 100 just after 3200 (too lazy to figure out when it exactly hits a 100, I think the inverse equation should end up somewhere around log1.1(101)/3200 or something).
In the case of a shortage of food, for example, the chance can be simply increased by 5, or one of the parameters can be changed. When medical research advances, the parameters can be changed slowly. This would produce a somewhat realistic death rate, and allows for easy messing.
Another approach I've seen, would be to let a 'death' - variable increase by a constant amount every turn. When it reaches 100, game over (for that individual). Somebody working on the surface could have a 0.5 increase on top of the standard 0.1 increase, and somebody working in the mines would get a 0.6 increase every turn. This allows for messing as well, but there's less of a 'chance' involved. Bonus: hardcoded events, such as a lab explosion or mining accident, could get a mention in a message box of some kind, like the Outpost newspaper. "Explosion causes death of nine lab technicians; cat to blame?"Morale:
Morale is defined between 0 and 1000. Simple constraints/assumptions; 0 for three turns == suicide. morale < 250 results in progressive depression, leading to less production. Morale > 750 results in progressively more production, up to around a factor of, say, 1.2. Anything in between should not impact anything too much. I think some different methods for different industries might be best: laboratories and recreational centres have a linear relationship with morale all the way, while factories only show stuff above and below certain thresholds. That way, stuff works in all but the most extreme situations, but there's still a bonus to increasing morale in small steps.
There's a detail here; fixed morale is quite boring, so I propose the following: modifiers don't have to be static values, but can decay. This means two details need to be stored; the modifier, and the start of the modifier. I'll demonstrate with a random assortment of modifiers:
Residential area available: 200. Decays 0.1 every turn until it reaches 100.
Upgraded (through research, the fancy wheel one) residential area available: 300. Decays until 250.
Job (baseline): +50. Does not decay. Job in a lab gives +100, which decays until 75. Job in education starts at 50, but increases until 100 (gets used to the kids).Jobs:
At every turn, jobs are organized based on priority. For example; agridome>smelter>lab
If 10 jobs are available in all three, but there are only 20 people available, then the lab will be empty (10:10:0). If a person in the agridome dies, then the distribution will be 9:10:0, which is a problem; then the person with the least job experience (i.e. the lowest work-duration) should be picked from the smelter, leading to 10:9:0 again. When conversely a person is added to the pool in the 10:10:0 situation, who doesn't have education (i.e. we have an 'extra), then the list is searched for the person with this education and the lowest experience. This person is moved to the lab, and the extra gets put in the spot that just opened up.