Most fitness apps stop at data ingestion: read step counts from the OS health API, store an integer, and draw a bar chart. For Fitness Quest (fitnessquest.io), we wanted raw pedometer telemetry to drive a living virtual companion—meaning every real-world walk had to translate into meaningful state transitions without feeling broken or exploitable.
Here is how we structured the state engine and progression logic behind Fitness Quest.
- Decoupling Raw Telemetry from Progression XP Hardware step counters are noisy—bursts arrive in batches when the OS wakes up, or trickle in during active foreground sessions. Instead of mutating companion stats directly on every sensor event, we separated the pipeline into three layers:
Ingestion Layer: Normalizes delta step counts from platform health APIs and deduplicates overlapping time windows.
Energy/XP Ledger: Converts validated step deltas into discrete progression units (steps -> stamina/XP) using an idempotent transaction log so background syncs never double-credit movement.
Companion State Machine: Evaluates threshold triggers for mood, energy, and level-up animations (e.g., evolving stats for companions like Lumi the deer or your virtual lion).
- Dynamic Goal Calibration (Avoiding Static Thresholds) Hardcoding 10,000 steps = success creates a terrible user experience: it’s trivial for runners and discouraging for beginners. Instead, we built an adaptive baseline algorithm:
Rolling Window Baseline: Evaluates a trailing multi-day median rather than a strict average so a single outlier hike doesn't artificially spike tomorrow's target.
Gradual Step-Up Curve: Increases daily quest targets incrementally when a user consistently hits 100% completion, and gently scales back after prolonged inactivity to keep the feedback loop achievable.
- Balancing Decay Mechanics Without Punishing Users In virtual pet mechanics, harsh decay (like a companion "dying" after 48 hours of missed steps) causes immediate churn. We tuned the state decay curve to use soft visual states—the companion gets sleepy or low-energy rather than resetting progress—so the next short walk immediately restores momentum.
Top comments (0)