Skip to content

feat(desktop): calmer, more realistic pet roam + split roam modules - #55400

Merged
OutThisLife merged 2 commits into
mainfrom
bb/pet-roam-calmer
Jun 30, 2026
Merged

feat(desktop): calmer, more realistic pet roam + split roam modules#55400
OutThisLife merged 2 commits into
mainfrom
bb/pet-roam-calmer

Conversation

@OutThisLife

@OutThisLife OutThisLife commented Jun 30, 2026

Copy link
Copy Markdown
Collaborator

Summary

The floating desktop pet wandered almost constantly — it works, but it never sat still. Two causes: every idle beat picked a new walk, and hops fired ~45% of the time. The result read as nervous, not alive. This makes movement the exception, not the default, and splits the overgrown roam hook into focused modules.

Behavior — calmer & more realistic

Grounded in ambient game-AI practice (GameAIPro ch.36 "Breathing Life into Your Background Characters" + standard idle/wander state machines, where idle dwell times are modeled as exponential/memoryless):

  • Loaf, don't pace. Most decision beats now just keep resting (REST_CHANCE = 0.62) instead of always re-walking.
  • Memoryless dwell times. Pauses draw from an exponential distribution (mostly short rests, the occasional long loaf) instead of a uniform 1.8–5.2s window, so the cadence never reads as a metronome.
  • Fewer hops. Hop chance dialed back 0.45 → 0.2 (hopping is the jumpiest, noisiest motion).

Net effect: the pet still strolls, hops, and falls exactly as before — just far less often, with natural variation between bouts.

Structure — no god-file

The 459-line use-pet-roam.ts mixed DOM surface measurement, behavior decisions, and the physics loop. Per the repo TS style ("a hook should own one narrow job; prefer colocated modules over god hooks") it's now three focused files:

  • roam-behavior.tswhat to do & when: dwellMs, chooseMove, pickStrollTarget + tuning constants. Pure, rng-injectable.
  • roam-geometry.tswhere it can stand: snapshotLedges, overlayLedge, resolveLedge, overlapsX, groundTop. DOM measurement + pure ledge math.
  • use-pet-roam.tsthe physics/RAF loop only.

Tests

Deterministic, rng-seeded unit coverage for the decision + geometry helpers — behavior contracts (clamping, rest-bias majority, ledge resolution), not snapshots. apps/desktop vitest: 25 passed.

Test plan

  • vitest run on the new + existing pet tests — 25 passed
  • tsc -p . --noEmit — clean
  • eslint on all touched files — clean
  • Manual: enable pet roam in the desktop app and confirm it loafs in place most of the time, with occasional strolls/hops, and still falls/settles correctly across the composer, profile rail, status bar, and route overlays.

The floating pet wandered almost constantly: every idle beat picked a new
walk and hops fired ~45% of the time, so it read as nervous rather than
alive. Make movement the exception, not the default, and split the
overgrown roam hook into focused modules.

Behavior (per ambient game-AI: GameAIPro ch.36 + idle/wander state
machines):
- Loaf, don't pace: most decision beats just keep resting (REST_CHANCE
  0.62) instead of always re-walking.
- Memoryless dwell: pauses now draw from an exponential distribution
  (mostly short rests, the occasional long loaf) instead of a uniform
  1.8-5.2s window, so the cadence never reads as a metronome.
- Hops dialed back 0.45 -> 0.2 (the jumpiest, noisiest motion).

Structure (no god-file; a hook should own one narrow job):
- roam-behavior.ts - what to do & when (dwellMs, chooseMove,
  pickStrollTarget) + tuning. Pure, rng-injectable.
- roam-geometry.ts - where it can stand (snapshotLedges, overlayLedge,
  resolveLedge, overlapsX, groundTop). DOM measurement + pure ledge math.
- use-pet-roam.ts - the physics/RAF loop only.

Tests: deterministic, rng-seeded unit coverage for the decision + geometry
helpers (behavior contracts, not snapshots).
@OutThisLife
OutThisLife enabled auto-merge June 30, 2026 03:52
@OutThisLife
OutThisLife disabled auto-merge June 30, 2026 03:53
DRY: the roomier-side bias computed its probability two ways
(STROLL_TOWARD_ROOM and 1 - STROLL_TOWARD_ROOM). One draw XNOR'd against
the roomier side says the same thing more plainly.
@OutThisLife
OutThisLife enabled auto-merge June 30, 2026 03:54
@OutThisLife
OutThisLife merged commit 33d044c into main Jun 30, 2026
20 checks passed
@OutThisLife
OutThisLife deleted the bb/pet-roam-calmer branch June 30, 2026 03:55
@alt-glitch alt-glitch added type/feature New feature or request comp/desktop Electron desktop app (apps/desktop/*) P3 Low — cosmetic, nice to have labels Jun 30, 2026
waefrebeorn pushed a commit to waefrebeorn/slermes that referenced this pull request Jul 2, 2026
…almer

feat(desktop): calmer, more realistic pet roam + split roam modules
habarmc1223-sudo pushed a commit to habarmc1223-sudo/hermes-agent-fluxmem that referenced this pull request Jul 8, 2026
…almer

feat(desktop): calmer, more realistic pet roam + split roam modules
santhreal pushed a commit to santhreal/hermes-agent that referenced this pull request Jul 13, 2026
…almer

feat(desktop): calmer, more realistic pet roam + split roam modules
Gravezzz pushed a commit to Gravezzz/hermes-agent that referenced this pull request Jul 21, 2026
…almer

feat(desktop): calmer, more realistic pet roam + split roam modules
leewenjie pushed a commit to leewenjie/hermes-agent that referenced this pull request Aug 7, 2026
…almer

feat(desktop): calmer, more realistic pet roam + split roam modules
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp/desktop Electron desktop app (apps/desktop/*) P3 Low — cosmetic, nice to have type/feature New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants