Decompose: Break down #22 into implementable work units #37
Labels
No labels
blocked:gate-implement
blocked:gate-lint
blocked:gate-plan
blocked:needs-decision
blocked:needs-human
bug
feature-request
in-progress
needs-decompose
needs-triage
quickfix
test-coverage
triage-approved
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Mark/tilt-marble-maze#37
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Assessment
Issue #22 requests physics engine integration for a marble maze game. Currently no physics at all.
Proposed Phases
P1: Physics engine selection & setup
Choose engine (Matter.js, Cannon.js, or similar). Set up the physics world, gravity, collision detection.
P2: Marble physics
Add rigid body for the marble: mass, friction, restitution. Handle rolling, tilting, and momentum.
P3: Maze obstacles & collision
Add physics bodies for maze walls, ramps, holes. Handle ball-wall interactions and triggers (e.g., falling into a hole resets position).
P4: Physics query API
Expose readouts: velocity, position, collision events. Wire to game logic (win conditions, scoring).
P5: Debug visualization
Optional overlay showing physics bodies, collision boxes, force vectors for development.
Closed as completed. All 5 phases of this decomposition were already implemented via a custom physics engine (not Matter.js/Cannon.js as suggested, but functionally equivalent):
app/src/game/physics.ts: vec2 math (add/sub/mul/dot/normalize), circle-rect collision, line-circle intersection, physics constants (PHYS object)updateMarblePhysics(): acceleration, friction, speed clamping (MAX_SPEED 8 / BOOST_MAX_SPEED 12), wall collision with bounce + tangential friction, rotation, ground detection, ice tile friction, frozen slowdown, invincibility timers, wallJump(), applyBoost()updateObstacles()+checkObstacleCollision(): 9 obstacle types (spinner, boulder, moving platform, pendulum, collapsing platform, spikes, speedgate, magnetic, gravitywell), collision routing per type inengine.tsMarbletype (pos, vel, speed, rotation, grounded, touchingWall, wallNormal), exported collision/utility functions used by engine/rendererTests:
physics.test.ts(721 lines),engine.test.ts(531 lines) — all passing.Fixed in commit. Closing.