Okay, to finish off this trifecta of unhealthily co-dependent posts, here we approach one of the most central systems in the entire game: Energy.
“Energy” is everything in Species. Every dynamic in the game uses a type of energy, and every type can be converted into another type. 1 unit of plant-food can become 1 hit point, 1 unit of walking distance (sort of), 1 unit of meat for other creatures to eat, etc. If a creature loses all its energy it will starve. If it loses all its hit points, the energy will be converted to meat. And so on.
There’s nutrient energy in the ground, which is converted into plant energy. Creatures convert that into chemical energy by eating it, which can be used for all sorts of things: it can be used to grow into adulthood, it can be converted to hit points to heal themselves, it can be used to give birth (in which case it is handed directly to the child creature. Childbirth is a somewhat less messy process in Species), or just consumed by their metabolism and exertion (walking about). When they die, spare chemical energy is converted into meat-energy, which can be eaten by other creatures or, to complete the cycle, decay slowly into nutrient energy in the ground.
This system makes the decision of whether to implement a closed or open energy cycle a big deal.
A closed cycle would have the same amount of energy in the global ecosystem at all times according to conservation of energy. Growth, metabolism and exertion convert chemical energy to ‘biomass’, which is returned to the ground as meat when the creatures die. There is no external energy source.
An open cycle doesn’t convert metabolism and exertion energy into biomass: it just vanishes into the ether. In addition, some energy losses are acquired during conversions, such as eating. This requires an external energy source to sustains the losses and allow the cycle to continue.
Given these choices, I decided to build an open system. It’s less controllable, but I don’t want to control the ecosystem in Species: I want it to evolve, to adapt and change, on its own. It’s also more realistic: the earth has an external energy source, a ridiculously massive one that renders anti-evolutionist arguments involving the second law of thermodynamics (yeah, we’ve all heard that one, guys) utterly moot: the sun. It’s only fitting that sunlight in Species should serve the same purpose: feeding the trees that feed everything else.
This doesn’t stop me from closing off the energy cycle, however. It just requires me to add energy gains (the sun) and roughly equivalent energy losses (metabolism, movement) to it.
But it also makes problems harder to debug.
The problems I refer to are “energy leaks.” Under particular atypical confluences of unexpected variables, or more often simply because the programmer can be kindly described as a complete dingbat, energy can be gained without being lost. This particular type of bug absolutely plagued the early iterations of Species. Populations of creatures would often discover these leaks long before I did, and would explode massively as a result. And making it harder for them to survive in an attempt to control the population would simply result in them dying out before they found the exploit.
Some of these were easy to track down: for instance, an observation that the exploding population were all carnivores…
(“I thought you hadn’t yet implemented a carnivorous diet at this stage?” Shuddup. Time can be re-written.)
… led to me rewriting the energy transfer for eating meat. I have to admit, there’s something inherently awesome about the creatures helping me debug their own game without me having to prompt them to do so. 🙂
Other leaks were more subtle, and an inability to track them down would eventually, after much frustration, lead to some drastic action: I closed off the energy cycle entirely, built an “entire ecosystem” energy counter that added every type of energy in the game up, and watched to see when and why it changed. You can still see the “Entire Ecosystem” counter in both of the Development Video’s.
Only once I’d completely debugged the energy cycle, and ensured that it stayed closed and stable under all conditions, did I slowly reopen it. That was only a few months ago.
(“You’ve completely given up on a sensible chronology, haven’t you?” I am a Time Lord. Chronology has never laid a hand on me. “It hasn’t laid much of a hand on this blog, either.” Damn right it hasn’t!)
Of course, at the time of making this whole system I had no idea what lay ahead: I was just obliviously coding, and seeing populations of creatures change and move about as their constituents lived and died was more than enough for me to be happy I was getting somewhere.
The next step would be implementing variable statistics: tying leg size to speed, size to metabolism, not-yet-implemented head-type to not-yet-implemented diet, and so on. From that combination would emerge one of the most vital points of this entire project: natural selection.
But perhaps, before even doing that, I should implement the still-remaining body parts: head, eyes, hands and feet. Yeah, that’s probably a plan. Assuming I don’t get distracted and go off on some sort of a rant about something shiny.
Huh. That’s pretty much the most planning ahead I’ve ever done in my life. Err… for the blog. Not the game. I planned the game out completely from start to finish, like a professional– oh, who am I kidding? I’m winging every aspect of this thing.
See you next week!
“For the record, I’m… uh… pretty sure he’s not really a Time Lord. Like, 95% sure.”