Skip to content

Furniture collision, cafe chairs/stools, and sit spot animations#1

Merged
JMRussas merged 4 commits intomainfrom
feature/collision-and-furniture
Feb 27, 2026
Merged

Furniture collision, cafe chairs/stools, and sit spot animations#1
JMRussas merged 4 commits intomainfrom
feature/collision-and-furniture

Conversation

@JMRussas
Copy link
Owner

Summary

  • Obstacle collision detection — Circle and AABB collision shapes for all 3 rooms (tables, bars, couches, benches, plants). Multi-pass push-out resolution shared between client and server. Creatures bypass obstacles when walking to a sit spot.
  • Cafe furniture geometry — 8 chairs around 2 tables, 2 bar stools in front of bar counter. All face the correct direction (chairs face into table, stools face bar).
  • Sit spot improvements — Per-spot animation field (eat at tables, idle at bar, rest on couch). Sit spots use Y position for elevated surfaces (couch at Y=0.2). Couch has 3 seats instead of 1.
  • Convenience scriptstools/start.sh and tools/stop.sh for launching/stopping the full dev stack.

Files changed

Area Files
Shared types room.ts (obstacle types, sit spot animation field)
Collision collision.ts + collision.test.ts (new)
Room data rooms.ts (13 cafe sit spots, obstacle arrays for all rooms), rooms.test.ts
Client movement Creature.tsx, RemoteCreature.tsx (collision, sit Y + animation)
Client input ClickPlane.tsx (obstacles prop, clampAndResolve)
Environments CozyCafe.tsx (Chair, BarStool components), RooftopGarden.tsx, StarlightLounge.tsx
Server connectionHandler.ts (server-side collision validation)
Scripts tools/start.sh, tools/stop.sh

Test plan

  • pnpm test — 402 tests passing (36 files)
  • Open Cozy Cafe: verify chairs visible around tables, stools at bar
  • Click table chair → creature walks to chair, plays eat animation facing table
  • Click bar stool → creature plays idle facing bar counter
  • Click couch → 3 clickable seats, creature rests ON couch surface (elevated)
  • Walk into table/bar/couch → creature slides around obstacle
  • Switch to Rooftop Garden / Starlight Lounge → collision works on benches, sofas, plants

🤖 Generated with Claude Code

Add obstacle collision detection (circle + AABB shapes) for all three
rooms so creatures can't walk through tables, bars, and couches. Cafe
environment now has chairs around tables, bar stools, and 3 couch seats
with per-spot animations (eat at tables, idle at bar, rest on couch).
Sitting creatures use the sit spot's Y position for elevated surfaces.

Also adds start/stop convenience scripts in tools/.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@JMRussas
Copy link
Owner Author

JMRussas commented Feb 27, 2026

Review Findings

H1 — Server-side obstacle collision causes rubber-banding on sit-walk
connectionHandler.ts:212 applies full obstacle collision on player:move, but the client skips obstacles when walking to a sit spot (e.g. chair inside a table's collision circle). The server pushes the position back out → creature rubber-bands. Fix: server should only enforce bounds clamping, not obstacle collision — collision is a client UX concern, not a security boundary.

M1 — start.sh / stop.sh missing executable bit
Scripts were committed without +x. ./tools/start.sh would fail on a fresh clone.

L1 — No validation test for room obstacle data
collision.test.ts tests the functions with synthetic data, but nothing verifies the actual obstacle definitions in rooms.ts are well-formed (no zero-radius circles, no inverted AABBs). Adding a test to catch malformed obstacle data.

All three fixed in follow-up commit.

JMRussas and others added 2 commits February 27, 2026 01:50
Server was applying obstacle collision on player:move, causing
rubber-banding when creatures walked to sit spots inside obstacle
zones (e.g. chairs inside table collision circles). Server now only
enforces bounds clamping — obstacle collision is a client UX concern.

Also: set executable bit on tools scripts, add obstacle data
validation test.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The `satisfies` on ROOMS preserves narrow literal types, so rooms
without `animation` on sit spots exclude it from the union. Explicitly
typing roomConfig as RoomConfig widens to the SitSpot interface which
has `animation?`.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@JMRussas
Copy link
Owner Author

Review Findings

L1 — collision.ts header and JSDoc reference server usage that was removed
collision.ts:8 says Used by: server (connectionHandler.ts) and the clampAndResolve JSDoc says "the single function both client and server should call" — but the server no longer uses it after the rubber-banding fix. Both stale.

Fixed in follow-up commit.

Server no longer calls clampAndResolve after the rubber-banding fix.
Updated file header and JSDoc to reflect client-only usage.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@JMRussas JMRussas merged commit 585b460 into main Feb 27, 2026
1 check passed
@JMRussas JMRussas deleted the feature/collision-and-furniture branch February 27, 2026 06:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant