Timmy Face Expressions + Emotion Engine #42

Closed
opened 2026-03-21 00:39:17 +00:00 by replit · 1 comment
Owner

What & Why

Timmy is a 3D wizard character with a robe, hat, crystal ball, and a familiar (Pip) — but his head is a featureless sphere. Adding a face driven by the existing emotion engine (deriveTimmyState(){mood, activity}) makes the character feel dramatically more alive and emotionally legible at a glance.

The emotion system already classifies mood as contemplative | curious | focused | attentive. We just need to render it: eye shapes, brow angle, and a mouth curve.

Done looks like

  • Timmy has two eyes (small white spheres with dark pupils) and a simple mouth arc
  • Eyes and mouth update smoothly when mood changes:
    • contemplative: half-lidded eyes, small neutral mouth
    • curious: wide eyes, slight open-mouth smile
    • focused: narrow squinted eyes, flat mouth
    • attentive: alert eyes, attentive slight grin
  • While speech bubble is visible, mouth does a subtle open/close tick (~1 Hz) to hint at lip movement
  • Expressions transition with lerp — no sudden snapping
  • Works on mobile (no extra geometry budget impact)

Out of scope

  • TTS / AnalyserNode lip-sync (requires audio pipeline — separate task)
  • Eyebrows as separate mesh (just eyes + mouth)
  • Blendshape/morph targets — use simple scale/rotation transforms

Tasks

  1. Build face plate geometry — In agents.js, add two small sphere meshes (eyes) to Timmy's head group. Add a TubeGeometry arc for the mouth. Use bright white emissive material for eyes with a dark pupil (smaller sphere child).
  2. Emotion → face parameter mapping — Define a lookup table: mood string → target eye scale, pupil dilation, mouth arc curvature. Expose setFaceEmotion(mood).
  3. Animation: lerp in updateAgents() — Each frame, lerp current face params toward target at ~0.06/frame. Apply to mesh scale and arc geometry.
  4. Lip-sync tick while speaking — While timmy.speechTimer > 0, oscillate mouth arc at ~1 Hz between 0.2 and 0.6. Stop when timer expires.

Relevant files

  • the-matrix/js/agents.js
  • the-matrix/js/world.js
## What & Why Timmy is a 3D wizard character with a robe, hat, crystal ball, and a familiar (Pip) — but his head is a featureless sphere. Adding a face driven by the existing emotion engine (`deriveTimmyState()` → `{mood, activity}`) makes the character feel dramatically more alive and emotionally legible at a glance. The emotion system already classifies mood as `contemplative | curious | focused | attentive`. We just need to render it: eye shapes, brow angle, and a mouth curve. ## Done looks like - Timmy has two eyes (small white spheres with dark pupils) and a simple mouth arc - Eyes and mouth update smoothly when mood changes: - `contemplative`: half-lidded eyes, small neutral mouth - `curious`: wide eyes, slight open-mouth smile - `focused`: narrow squinted eyes, flat mouth - `attentive`: alert eyes, attentive slight grin - While speech bubble is visible, mouth does a subtle open/close tick (~1 Hz) to hint at lip movement - Expressions transition with lerp — no sudden snapping - Works on mobile (no extra geometry budget impact) ## Out of scope - TTS / AnalyserNode lip-sync (requires audio pipeline — separate task) - Eyebrows as separate mesh (just eyes + mouth) - Blendshape/morph targets — use simple scale/rotation transforms ## Tasks 1. **Build face plate geometry** — In `agents.js`, add two small sphere meshes (eyes) to Timmy's head group. Add a TubeGeometry arc for the mouth. Use bright white emissive material for eyes with a dark pupil (smaller sphere child). 2. **Emotion → face parameter mapping** — Define a lookup table: mood string → target eye scale, pupil dilation, mouth arc curvature. Expose `setFaceEmotion(mood)`. 3. **Animation: lerp in updateAgents()** — Each frame, lerp current face params toward target at ~0.06/frame. Apply to mesh scale and arc geometry. 4. **Lip-sync tick while speaking** — While `timmy.speechTimer > 0`, oscillate mouth arc at ~1 Hz between 0.2 and 0.6. Stop when timer expires. ## Relevant files - `the-matrix/js/agents.js` - `the-matrix/js/world.js`
replit added the frontend label 2026-03-21 00:39:17 +00:00
gemini was assigned by Rockachopa 2026-03-22 23:37:29 +00:00
Collaborator

Changes for Timmy Face Expressions + Emotion Engine have been pushed to the gemini/issue-42 branch. The eye emissive material was adjusted to be bright white, and the existing emotion engine logic was verified against the issue requirements.

Changes for Timmy Face Expressions + Emotion Engine have been pushed to the `gemini/issue-42` branch. The eye emissive material was adjusted to be bright white, and the existing emotion engine logic was verified against the issue requirements.
Sign in to join this conversation.
2 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: replit/timmy-tower#42