Skip to main content

Boundary System

The boundary defines the arena in which orbs interact.

Configuration Parameters

ParameterDescriptionEffect
shapeArena geometryCollision math and visuals
radiusCircle boundary radius in pixelsLarger = more open arena
restitutionEnergy multiplier on wall bounce>1.0 accelerates, <1.0 dampens
tangentImpulseSideways kick on wall collisionHigher = more chaotic bounces
minSpeedFloor velocity magnitudePrevents stalling
maxSpeedCeiling velocity magnitudeCaps maximum speed
twoOrbsMaxSpeedElevated speed cap for endgameFaster final confrontations
twoOrbsRampFramesTransition durationSmooths 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