Posts Tagged energy loss
Not everything in Species has gone the way of the behavioural system, getting simpler and simpler over time. Some things, like lifespan, have actually been becoming more complex over time, slowly integrating themselves with more and more systems in the game. (Don’t worry, I’m like 80% certain none of them are about to become Skynet)
As already mentioned in previous posts, lifespan initially wasn’t included. Once reproduction was put in place, however, we needed to ensure there existed ways to die beyond “brutally murdered by the developer”, which up until then was the only cause of death.
This was something I hadn’t designed from the start: how lifespan should be handled simply hadn’t occurred to me. So to start with, I did the simplest thing and just killed the creatures the moment they hit a certain age. From memory it was 2 minutes simulation time.
This was a pretty blatant instance of placeholder abuse. The lifespan was artificial and arbitrary, but I told myself it was just a placeholder so it didn’t matter and moved on with other things.
As it turned out this self-serving assumption was both true and false. True, it didn’t matter at the time I implemented it: at that point energy leaks and AI bugs made balancing the game a futile endeavour. But it did come to matter later, because as it turns out, 2 minutes isn’t enough time to find food and reproduce. Who’d a thought?
The next iteration (after upping the lifespan variable to compensate several times) was to turn lifespan into an inheritable value.
This turned out to be an interesting solution. Creatures with a longer lifespan would spend longer in childhood, unable to breed. This meant that creatures would have to find the right balance.
Unfortunately, it was impossible to guess a creature’s lifespan from visual cues. It was the same problem I was having with the behavioural system: you couldn’t see lifespan evolution happening, at least not directly. I needed to tie lifespan to something physical.
The third step was to tie lifespan to size. Larger creatures live longer than smaller creatures, right?
This was a lot better, and it made it possible to see the effects lifespan was having on natural selection. It still felt a bit arbitrary (it was possible to put a countdown-to-death timer on top of every creature based purely on their size), but it wasn’t a bad system.
But at this point I realised something else that was bothering me about all these systems: they were instantaneous. Age and lifespan had absolutely no effect on a creature until suddenly and without warning they exploded into mounds of delicious meat. This doesn’t normally happen in real life (well, except that one time I mixed up the nitroglycerine and the cat food, but that was totally* an accident).
The energy system at the time also meant that creatures dying of old age had far more meat on their bones than creatures killed by attacks or starvation, because their energy and health bars were often still full when they died, so they got converted to meat. This side-effect was unexpected, and unless you understood the system behind it, didn’t make much sense.
The fourth implementation (or possibly the 3.5th) was an adaptation of the previous version, where rather than just getting insta-gibbed, creatures past their use-by date would gain a new energy cost, similar to the cost of growing out of childhood. This “dying” cost would deplete their energy and health bars, resulting in a much more natural-seeming death.
But I still wasn’t happy with it. It was theoretically possible for a creature to eat enough to offset the dying cost and live forever, and increasing the age cost enough to counter that possibility simply made it look like I was insta-killing them again. It wasn’t that big of a problem, but I still wasn’t happy with the system. It just didn’t feel right.
And so I finally got around to giving the problem the attention it deserved in the first place. How does lifespan work in real life? (Morbid discussions on the nature of mortality! That’s what this blog needs more of!)
In real life, the damage from age is gradual and increases over time. We don’t suddenly hit a certain age and keel over, we just slowly take more and more damage until our body can no longer keep running. We can offset this with a healthy diet, exercise, and homeopathic remedies… pfff no I’m kidding. Stick with the healthy diet and exercise, at least they do stuff. Anyway, we can offset the damage significantly, but we can’t offset it forever, because it accelerates as we age. It was relatively easy for humanity to get our average lifespan up to 80, but now we’re struggling for every extra year, even with the incredible advances in medical technology we’re seeing in recent times.
So how does this translate to Species? Fifth implementation: aging doesn’t suddenly kick in at the end of the creatures lifespan, instead starting slowly and accelerating over time. Young creatures just out of childhood spend very little energy on keeping their body running, while older creatures spend ever-increasing amounts. This ensures that no matter how quickly a creature can gather energy, it’ll never be able to stave off death indefinitely.
Of course, I still want longer and shorter lived creatures correlated with size, without just handing an indisputable advantage to the largest creatures on the map. A bit of further thought/research on the subject revealed something interesting: smaller, shorter lived creatures in real life tend not to show signs of aging until the very end, while larger creatures die more slowly. This gave me an idea: a variable energy loss curve.
As you can see, small creatures (x3) have the advantage early in their life: more energy to spend on moving, eating and reproduction, but then their energy loss accelerates sharply towards the end of their life. Large creatures (c*x) lose the early advantage in favour of a much higher staying power. In-between creatures lerp (linearly interpolate) between these two graphs.
An interesting point about all this extra complexity in lifespan determination: it doesn’t obscure the in-game evolution the way the complexity in the behavioural system did. The ‘mutable lifespan’ I had way back in step 2 was a lot simpler than this, but also a lot harder to spot in action. I assume that’s because this system matches what we intuitively know about the world: larger creatures live longer, smaller creatures are more energetic (ask any dog owner). The complexity here just gives the system more nuance, making it feel more natural.
So I guess the take-home message is: complexity is not the enemy of intuition. A familiar but complex system is preferable to a simple but alien system.
I’m totally deep!
*footnote: For the record, whenever I use the word “totally” in this context, I am, like, totally being ironic. I don’t generally speak like a high schooler from the 90’s. Dude.
“The neighbour’s cat was probably lucky it was only nitroglycerine. He stores mutagenic nanobacteria on the next shelf down.”