65 lines
2.2 KiB
Markdown
65 lines
2.2 KiB
Markdown
Hockey Manager Match Engine
|
|
|
|
Framework: PhaserJS
|
|
|
|
Rink size: international (60x30m). Coordinate system: 0,0 = center.
|
|
-60, 0 = left side of the rink, etc. 1 = meter. Use floats though.
|
|
|
|
Continuous Position + Behavior Trees (Moderate Complexity)
|
|
Best for: Realistic tactics, good visual feedback, manageable scope
|
|
Core Concept:
|
|
|
|
Players have exact X/Y coordinates on a 2D rink
|
|
No physics engine, but movement is interpolated curves (bezier/spline)
|
|
Each player runs a behavior tree every update tick (60+ times per second)
|
|
|
|
Behavior Tree Structure:
|
|
Root: Team Strategy (e.g., "Dump and Chase")
|
|
├─ Player Role (e.g., "Left Winger - Offensive Zone")
|
|
│ ├─ Offensive Positioning
|
|
│ │ ├─ Is puck in our possession? → Move to scoring position
|
|
│ │ └─ Is puck loose? → Move to forecheck target
|
|
│ └─ Defensive Transition
|
|
│ └─ Backcheck to defensive coverage position
|
|
└─ Puck Carrier Actions
|
|
├─ Pass decision (weighted by attributes + open teammates)
|
|
├─ Shoot decision (scoring chance % calculation)
|
|
└─ Carry decision (move toward better position)
|
|
Key Systems:
|
|
A) Tactical Positioning System:
|
|
|
|
Define "heat maps" for each strategy/situation
|
|
Example: 1-2-2 forecheck = F1 pressures puck carrier, F2/F3 position at blue line
|
|
Players move toward their heat map "ideal position" modified by:
|
|
|
|
Puck location
|
|
Teammate positions (spacing)
|
|
Opponent threats
|
|
Player stamina/speed
|
|
|
|
|
|
|
|
B) Puck Movement:
|
|
|
|
No physics! Puck "teleports" but with travel time
|
|
Pass success = f(passer skill, pass distance, pressure, receiver skill)
|
|
Shots = trajectory calculation with goalie save probability
|
|
|
|
C) Decision-Making Engine:
|
|
javascriptEvery tick:
|
|
1. Evaluate situation (game state, ice time, score, etc.)
|
|
2. Query behavior tree for action
|
|
3. Weight options by:
|
|
- Player attributes (Hockey IQ, Creativity)
|
|
- Coaching instructions (Risk level, Passing %)
|
|
- Fatigue & injury status
|
|
4. Execute highest-weighted valid action
|
|
5. Apply outcome (deterministic + dice roll)
|
|
Visualization:
|
|
|
|
Smooth interpolation between positions (easing functions)
|
|
Player sprites with orientation/animations
|
|
Puck trails for passes/shots
|
|
Think: Football Manager 2D but more fluid
|
|
|