For this week, I created a virtual pet simulator in which players speak commands like "sit," "play," "eat," and "sleep" to manage three interconnected stats: mood, energy, and hunger. The goal is to maintain a happy, healthy pet by balancing these needs through thoughtful interaction. This project explores how machine learning can create more natural human-computer interactions while teaching players about responsibility and consequence through game mechanics.
The mood represents the pet's general happiness and decays slowly over time at a rate of 0.007 per frame, accelerating if other needs are neglected. Energy decreases constantly at 0.010 per frame, representing natural tiredness, and can only be restored through the sleep command. Hunger increases over time at 0.012 per frame, and when it exceeds 70 points, it causes mood to decay even faster, simulating the distress of a hungry pet. The game-over condition triggers when either mood or energy drops to 20 or below.
The sit command provides a calm, gentle boost of 6 mood points and 2 energy points, and the play command offers the largest mood increase at 10 points but costs 4 energy. Eating reduces hunger by 18 points and adds 8 mood, with a food bowl appearing during the animation. Sleep provides the most significant energy restoration at 14 points plus 4 mood, accompanied by floating Z particles. For the background color, I used a warm gradient from cream to soft pink, which boosts an intimate feeling of the experience. The pet's body color dynamically transfers between blue, yellow, and green based on mood.




Video Demo:
https://drive.google.com/file/d/1uBlSKIaaT9Yye5o1ZhHCqPciM0WYpn0o/view?usp=sharing
p5.js Sketch:
https://editor.p5js.org/zw3421/sketches/GhY3_7BWe
Teachable Machine: