Wow, two blog posts in one day.
Today I implemented a basic energy system for the snails. I’m trying to keep it moderately realistic for the time being just to implement something quickly, but the idea for the final version is to actually do proper research on exactly how this stuff works and revise the system to match.
The attributes involved with this are as follows:
idealEnergy(undecided energy unit, possibly Joules)
baseRMR(Resting Metabolic Rate)
baseAMR(Active Metabolic Rate)
currentEndurance(energy unit, possibly Joules, that serves as a “buffer” during a race)
So here’s what happens…
When a wild snail is randomly generated or a newborn snail is born, it gets an
idealWeight attribute. This is the weight at which the snail is at its peak performance and health.
Based on its ideal weight we figure out how many units of energy (as mentioned above, still undecided) the snail requires each day (
idealEnergy). The snail won’t die if it gets less or more energy than this per day. However, if it gets too little energy it will begin to lose weight and can get malnourished and if it gets too much energy which it doesn’t use it will begin to gain weight and get fat. In either of these cases both performance and health of the snail can suffer.
Deciding on the unit of measurement for snail energy is tough…just read this heated discussion.
What’s currently implemented
- The above attributes are generated and assigned
- Each snail loses the amount of energy equivalent to its Resting Metabolic Rate every day (reflected in its
- While it’s racing, the snail loses energy from its
currentEndurancebuffer based on its Active Metabolic Rate. If this buffer is depleted the snail is knocked out of the race.
- At the end of each race, the snail loses
currentEnergyequivalent to what it used out of its endurance buffer during the race.
Currently a snail’s energy level is represented as a percentage bar on its profile page:
What I’m implementing next
- Death - the snail needs to go into hibernation and then die if it ever gets to 0
- Feeding - You should be able to replenish the snail’s energy by feeding. You can overfeed the snail on purpose, giving it more energy than is necessary, based on its planned race entries during the day (to make sure it has enough energy to stay healthy as it races)
Feeding is going to be interesting to make. In real life you can’t feed a specific snail unless it has its own jar with no other snails. Other snails will come and eat as they please. In the Gastropoda simulation it will be the same - unless you are directly injecting a snail with nutrients (a somewhat drastic measure), you will only be able to put food inside the snail’s jar. Which snail eats the food is then totally up to the snails' own tendencies and “desires”. This is why it will be important to isolate weak snails that may not be able to get to the food in time, put a sufficient amount of food into the jar, and try to match snails that like certain types of food in the same jars.