I'm super excited. I was thinking: "How do I implement old age and death, and health in general? Is health just energy? When the snail is out of energy, it dies? But that seems too simplistic."
At this point I should have realized that 'simplistic' is a good thing. Instead I decided to try to mimic a scenario that is a little closer to real life. Again, I am no snail expert or biologist and mostly I just...guessed. I want to tweak the system when I move more into the research phase of the project vs the implementing random features and fixing bugs phase. I have a feeling this should have been done the other way around.
Anyway - why does any living organism die? It seems that we die either because of some trauma or injury to our internal organs or...old age. But what is old age, really? How is it different from trauma or injury to our internal organs?
From the very brief amount of reading I'd done it's partly about telomeres and how efficiently our cells can keep dividing as we get older. Telomeres protect our chromosomes. Each time a cell divides, our telomeres shorten until eventually our cells can't divide anymore. And then what?
I think that's when we become more prone to age-related diseases. The immune system is apparently highly related to the length of the telomeres. And when your immune system gets worse our bodies can no longer handle various illnesses as well as they used to, which eventually results in that first thing - trauma or injury to our internal organs that we can no longer recover from.
My cat Rigel has a damaged bladder. A vet "broke" him and he has been handicapped ever since. The bad news is that he may now need to be on medication for the rest of his life. The good news is that there is a chance, especially since he is so young, that his bladder will regenerate over time. The cells and nerves of his bladder may still kick themselves into shape over months or years and he may be able to take a little less medicine or maybe, if a miracle happens, eventually none at all!
This is how I want the snails to work. Organ damage can be sustained, but with a high enough immune system the snail may be able to recover and at least partially heal/regenerate itself. As the immune system weakens organ damage becomes permanent and the snail is not as able to recover. Eventually the snail is just too weak, its organs start failing, and it dies.
The details
I've kind of done it in a really hacky way...like all the experimental features so far...which is pretty much all the features.
Organs
So a snail has a base organ efficiency score and an organ efficiency percentage. Eg:
- baseHeartEffic: 60
- heartEfficPerc: 100%
- baseLungEffic: 45
- lungEfficPerc: 90%
The organs so far are:
Yes, I know a snail has more organs than this. But I have sort of stayed away from organs that already are represented by sensors in the brain. These include eyes (vision is accounted for), mouth (taste is accounted for), tentacles (touch is accounted for). Theywill be added eventually, but I wanted to focus on the others for now.
All snails start with 100% efficiency for each organ. At first I was thinking of not havingbaseXEffic at all and just have a 0-100 percentage for each snail, but I realized this would be boring. All snails are not created equal. Just as Secretariat had a very large heart, a snail can have a much stronger or weaker organ than average. A simple percentage standard across all snails would not allow for the amazing outliers of nature that we see in real life.
Ageing
Snails already have a maturity rate (the rate at which they grow after birth). I decided to reuse this for ageing. Snails age every hour. Until a snail is mature it grows each hour based on its maturity rate. Once a snail is mature it begins to age and deteriorate every hour. The amounts may be small - something like 0.05% decrease in immunity per hour. You will be able to boost immunity with supplements, medicines, etc, but for now we are just focusing on the snail's natural rate of ageing here.
Each minute we check for idle snail actions. Each minute we will also check for any organ damage as a result of those actions. For example, if a snail is operating at 95-100% physical effort it may have a higher chance of heart, lung, or foot damage.
Recovery
I have not built recovery in yet. I want to see how long a snail might live without any recovery of the organs. Recovery is to follow!
First I think a big refactoring is in order. As I look back at some of the older code I can see a lot of cleanup that needs to be done in general. I think I'll do that over this weekend and then continue.