Some time ago I tweeted that I am working on a cool, small feature to do with whales. Here it is:
I could not resist adding this little gem, even though it took me an entire day to tweak the blowing particle system and add a new AI behavior to make whales surface.
In 1.25 and earlier, whales are fish, which is embarrassingly unrealistic. No longer! In 1.26, it will be possible to drown a whale.
To digress a bit, the AI in Survivalcraft is a fairly complicated affair, but it’s structured into multiple, simple behaviors, making it easy to maintain and extend. Only one behavior may be active at any time for a creature. As a result, each behavior competes for “activity” with others. The behaviors do it by advertising an “importance value”, and the behavior with highest one is activated.
For example, breathing reflex behavior in whales bases its importance on amount of air left in the whale lungs. When a whale is near drowning, the importance of breathing behavior is so high that it will trump anything else. The whale will abandon whatever it was doing, including chasing or running away from the player, in order to surface. As soon as the air is replenished, breathing importance drops to zero and next most important behavior is resumed.