Making Sugarcoated: How Building a T1D Game Made Me Excited for My Pump
A note on terminology: This article uses T1D jargon. Hover over bolded terms for definitions. If you find yourself overwhelmed, that’s the point - imagine learning all this in a doctor’s office, minutes after diagnosis.
The Problem: Explaining an Invisible Condition
When I was diagnosed with Type 1 Diabetes in 2024, I quickly discovered that most people don’t really understand what it involves. They know it has something to do with sugar and insulin, but the constant mental load is invisible.
“Just take your insulin, right?”
Well, yes. But also: calculate the carbs in this meal. Consider how fast those carbs will absorb. Factor in that I’m stressed today. Remember that I exercised this morning. Notice that it’s 3am and my CGM is alarming because I’m trending low. Wake up, eat glucose tablets, wait, check again, try to sleep.
Every day. Forever.
I wanted a way to show people this, not just tell them. So I built a game.
The Game: Sugarcoated
TOO HIGH (HYPER):
IRRITABILITY → KETONES → DKA
TOO LOW (HYPO):
SHAKINESS → CONFUSION → COLLAPSE
LONG TERM: Your A1C reflects average BG. High A1C = risk of complications over years.
Sugarcoated — play fullscreen
The game is a browser-based simulation where you manage blood glucose levels through a compressed day (60 real seconds = 1 game day). Meals approach on a timeline. You bolus insulin before eating. You correct highs. You treat lows. You try to stay in range.
The visual style mimics the old Game Boy - partly aesthetic choice, partly because it felt right for something that demands constant attention.
Making It Realistic Made It Hard
I started with a simple model: carbs raise BG, insulin lowers it. But that’s not how it actually works.
Insulin Timing
Insulin takes 20-30 minutes to start working, peaks around 2 hours, and has a long tail lasting 5-6 hours:
Insulin activity curve: fast rise to peak at ~2h, gradual tail to 5-6h
The maths behind insulin absorption
The simulation uses a gamma-like function to model rapid-acting insulin (Novorapid/Humalog):
effect = t² × e^(-5t) (normalized)This creates the right-skewed curve - fast rise, slow decay - that matches real insulin pharmacokinetics. The peak occurs at t = 2/5 of the duration, roughly 2 hours after injection.
Carbohydrate Speeds
Different foods absorb at wildly different rates:
- Fast (juice, glucose): spikes you in minutes
- Medium (bread, rice): steady rise over 30-45 minutes
- Slow (pasta, pizza): gradual climb over 1-2 hours
Same total carbs, different absorption speeds
When BG is very low, carbs absorb even faster - your body is desperate for glucose. Protein causes a delayed secondary rise 2-3 hours later.
The Complications
I added events that reduce insulin sensitivity - your insulin just works less well:
- Ketones: up to 40% resistance
- Menstrual cycle (luteal phase): up to 35% resistance (toggle in OPTIONS)
- Illness: 30% resistance + accelerates ketone production
- Bad sleep: 25% resistance
- Stress: 20% resistance
- Coeliac/gluten exposure: unpredictable carb absorption
The dawn phenomenon spikes your BG at 6am. Exercise drops BG during cardio but raises it during weights (adrenaline). Night interventions cascade - if you had to wake up to treat a low, you get “bad sleep” resistance the next day.
Each addition made the game more realistic. Each addition also made it harder to play.
I found myself being hospitalised constantly. Partly because time is sped up, but mostly because it required my full attention - and real life doesn’t pause while you manage diabetes.

The Pump Algorithm Made It Easier
In frustration, I added a “pump mode” - a simplified hybrid closed-loop algorithm inspired by OpenAPS oref0 and systems like CamAPS FX.
The algorithm does three things:
- Adjusts basal rate: Suspends insulin delivery when trending low, increases when high
- Auto-corrections: Small SMB boluses every ~8 minutes when BG is elevated
- Safety checks: Won’t deliver insulin if any prediction shows you might go hypo

The pump algorithm code
Here’s the simplified version of how the auto-correction logic works. Every few minutes, the pump asks: “Where is BG heading, and is it safe to give a small correction?”
// CamAPS-style SMB calculation
const eventualBG = currentBG - (IOB * sensitivity);
const minPredBG = Math.min(current, predicted, eventual);
if (minPredBG > 4.5) { // Only if safe
const insulinReq = (minPredBG - target) / sensitivity;
const SMB = Math.min(1.5, insulinReq * 0.8); // Aggressive
}The key safety rule from oref0: corrections are disabled if any prediction shows BG might drop below 4.5. This prevents hypos from stacking corrections.
CamAPS FX is known for being relatively aggressive - that’s what I’ve modeled here.
With pump mode enabled, the game became dramatically easier. Not easy - you still need to bolus for meals. But the constant micro-corrections? The 3am lows? The slow creep upward overnight? The pump handles those.
The Revelation
Building this made something click for me.
I’ve been on multiple daily injections (MDI) since diagnosis. I’m getting an insulin pump in about a month. I knew intellectually that pumps were “better” - tighter control, fewer injections. But I didn’t feel it.
Now I do.
Playing Sugarcoated without pump mode is exhausting. You’re constantly watching, correcting, second-guessing. Playing with pump mode, you can actually relax. The algorithm catches the small stuff. You focus on the big decisions and trust the system for the rest.
That’s what I’m getting in a month. Not a cure, but partial automation of the mental load.
Why The Numbers Matter
The game tracks TIR (Time In Range) and estimates A1C at your “endo appointments.”
A1C measures average BG over ~3 months. The clinical target is under 7% because the DCCT study proved this dramatically reduces long-term complications - retinopathy, nephropathy, neuropathy, cardiovascular disease - by 50-76%.
TIR (typically 4-10 mmol/L) captures what A1C misses: variability. You could have an A1C of 7% by spending half your time dangerously low and half dangerously high. TIR of 70%+ means fewer swings, less time in danger zones, and generally feeling better.
The game rewards this juggling act:
■ Survive longer
■ Stay in range
■ Keep A1C low
■ Minimise disruptions
Night interventions count triple - waking at 3am to treat a low hurts more than a daytime correction.
The Honeymoon Complication
There’s a twist in my story. I’m currently in the “honeymoon period” - my pancreas still produces some insulin. I’m also on a clinical trial aimed at preserving this remaining function.
I added a “honeymoon mode” where remaining beta cells provide background correction, slowly decaying over game-days. Most T1Ds reading this have been doing full manual management for years - the game without honeymoon mode is closer to their reality.
What I Learned
Building Sugarcoated taught me:
-
The mental load is real and constant. Quantifying it in game mechanics made it visceral.
-
Pump algorithms are genuinely impressive. The oref0 logic I implemented is simplified, and it still transforms the game.
-
T1D is harder than I give myself credit for. When friends play and struggle, it validates what I experience daily.
-
Technology helps. My pump will automate hundreds of decisions I currently make manually.
What the simulation simplifies
Real T1D management is even harder than this. To keep the game playable, I’ve left out:
- CGM is mostly accurate - in reality, readings are often 10-20% off and you don’t know which way
- Supplies are infinite - no prescriptions, pharmacy shortages, or finding gluten-free carbs when you need them
- Basal rate is constant (reality: varies by time of day)
- No insulin stacking warnings
- No site absorption variability
- No altitude/temperature effects
The simulation is tuned to my own T1D experience (diagnosed 2024, ~1:15 carb ratio, extended honeymoon due to clinical trial). The mental load depicted - constant vigilance, planning ahead, interrupted sleep - is accurate regardless.
Try it without pump mode first. See how long you survive. Then turn on pump mode (in OPTIONS) and feel the difference.
That difference is what I’m getting in a month. I can’t wait.
If you have ideas for what could be added, feel free to reach out.