Boundary System
The boundary defines the arena in which orbs interact.
Configuration Parameters
| Parameter | Description | Effect |
|---|---|---|
| shape | Arena geometry | Collision math and visuals |
| radius | Circle boundary radius in pixels | Larger = more open arena |
| restitution | Energy multiplier on wall bounce | >1.0 accelerates, <1.0 dampens |
| tangentImpulse | Sideways kick on wall collision | Higher = more chaotic bounces |
| minSpeed | Floor velocity magnitude | Prevents stalling |
| maxSpeed | Ceiling velocity magnitude | Caps maximum speed |
| twoOrbsMaxSpeed | Elevated speed cap for endgame | Faster final confrontations |
| twoOrbsRampFrames | Transition duration | Smooths speed increase |
Current Configuration
Shape: Circle
Radius: 190px
Restitution: 1.08 (slightly accelerating)
Tangent Impulse: 0.02 (minimal sideways kick)
Min Speed: 4.0
Max Speed: 9.5 (normal), 25.0 (endgame)
Endgame Ramp: 300 frames (~2.5 seconds)
Wall Collision Physics
When an orb hits the boundary:
1. Detect Collision
distance_from_center > radius - orb_radius
2. Calculate Response
normal = normalize(position - center) // For circle
velocity_normal = dot(velocity, normal)
velocity_tangent = velocity - (velocity_normal * normal)
3. Apply Restitution
new_velocity_normal = -velocity_normal * restitution
new_velocity = new_velocity_normal * normal + velocity_tangent
4. Apply Tangent Impulse
tangent_direction = perpendicular(normal)
new_velocity += tangent_direction * tangentImpulse
Next Steps
- Gravity System - Central gravity
- Collision Physics - Orb-orb collisions
- Sudden Death - Endgame mechanics