20 Commits

Author SHA1 Message Date
Pierre Wessman
549ac400e0 Add minimum speed requirement for tackle execution
- Players must be moving at least 2 m/s to execute a tackle
- Add TACKLE_MIN_SPEED constant (2 m/s) in constants.ts
- Add Player.getCurrentSpeed() method to expose current speed
- Check tackler speed in executeTackle() before attempting tackle
- Log speed in tackle debug output for tuning

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-02 12:59:35 +02:00
Pierre Wessman
00d3a0a4ea Implement collision avoidance for puck carrier with debug visualization
- Add threat detection system that detects opponents within 3m radius
- Puck carrier automatically evades when opponent is in path to goal
- Evasion direction (left/right) persists while opponent in threat zone
- Fix behavior tree instantiation to reuse trees per player
- Add comprehensive debug visualization (magenta circle, threat indicators)
- Fix DefensiveBehavior type errors (carrierTeam -> possession)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-02 12:50:31 +02:00
Pierre Wessman
999003b012 Add player fall mechanic after successful tackles
When a player is successfully tackled, they now experience a realistic fall animation:
- Immediately decelerate to 0 velocity
- Stay down for 500ms (configurable via TACKLE_FALL_DURATION)
- Resume normal movement after recovery period

Changes:
- Added TACKLE_FALL_DURATION constant (500ms)
- Added fall state tracking to Player class (isFallen, fallRecoveryTime)
- Implemented fall() method to trigger the fall state
- Updated update() to handle fallen state and prevent movement during recovery
- Modified executeTackle() to call fall() instead of just reducing velocity

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-02 11:14:53 +02:00
Pierre Wessman
c81e500e18 Implement player tackling system with collision detection
Added a realistic tackling system where players can physically contest for the puck:
- Player-player collisions trigger tackle calculations based on tackling vs balance attributes
- Tackle success uses skill-based formula with configurable modifier
- Successful tackles can steal puck or knock it loose (60% chance)
- Cooldown system prevents rapid successive tackles (1s between attempts)
- Tackled players experience significant momentum loss on successful tackles

Also improved player movement physics:
- Added smooth acceleration/deceleration with ease-out curves
- Players now gradually build up speed (10 m/s²) and brake quickly (20 m/s²)
- More realistic stopping behavior when reaching target positions

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-02 10:50:35 +02:00
Pierre Wessman
9e81619637 Implement defensive chase behavior and increase rotation speed
- Add defensive AI: players now chase puck carriers on opposing team
- Update DefensiveBehavior to check opponent possession and target puck position
- Increase player rotation speed from 3 to 10 rad/s for more responsive turning
- Update Claude settings permissions

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-02 10:20:00 +02:00
Pierre Wessman
ff97b227c2 Add player enhancements and debug features
- Add away team defender (LD) for testing behaviors
- Add direction indicator (white line) showing player facing direction
- Initialize player facing angle based on team (home faces right, away faces left)
- Implement speed-based turning physics (faster = wider turns, rotation drops to 30% at max speed)
- Add debug visualizations for player targets (line and X marker) when DEBUG is true
- Increase rotation speed constant from 1 to 3 rad/s for more responsive turning

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-02 10:08:00 +02:00
Pierre Wessman
a3ffc94916 Restructure behavior tree for scalability
- Separate base behavior nodes into BehaviorNodes.ts (fixes circular dependency)
- Organize behaviors by role (goalie) and context (offensive/defensive/transition)
- Add modular behavior subtrees:
  - GoalieBehavior: Track puck position near net
  - SkaterBehavior: Route to context-specific behaviors
  - PuckCarrierBehavior: Shoot/carry logic (Phase 4)
  - OffensiveSupportBehavior: Placeholder for Phase 5
  - DefensiveBehavior: Placeholder for Phase 6
  - TransitionBehavior: Chase loose puck
- Maintain backward compatibility with static evaluatePlayer()

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-02 09:42:20 +02:00
Pierre Wessman
1504dba13e remove review finings 2025-10-02 08:34:00 +02:00
Pierre Wessman
92a7b44ca9 puck diameter 2025-10-02 08:33:39 +02:00
Pierre Wessman
d17d5c594b centralised types 2025-10-02 08:29:43 +02:00
Pierre Wessman
30d7d95ccc review 2025-10-02 08:22:33 +02:00
Pierre Wessman
40d07ee68c ... 2025-10-02 08:11:21 +02:00
Pierre Wessman
8ec240333c player turning speed 2025-10-02 08:06:08 +02:00
3d15dc716b player 2025-10-01 14:54:58 +00:00
d2fb60df8d init player 2025-10-01 14:51:24 +00:00
93cb732110 goal events 2025-10-01 14:31:51 +00:00
30f2d99716 puck - circle body 2025-10-01 14:13:48 +00:00
1990d98aa2 puck 1 2025-10-01 14:12:40 +00:00
92b2d30d2b rink 2025-10-01 13:57:42 +00:00
6b881b34b1 init 2025-10-01 11:46:38 +00:00