The motion core is a discrete-time rigid-body loop where delivery state evolves under gravity, drag, spin drift, and stick contact impulses. Each frame integrates velocity first-order (`ballX += ballVX * dt`, `ballY += ballVY * dt`) while gravity continuously perturbs the vertical component, and per-delivery style coefficients (speed, curvature, spin, friction) act like a parametric force field so no two balls share the same phase portrait. Contact resolution projects the bat-ball relative velocity onto a collision normal and tangent, applies a restitution impulse to preserve sharp rebound energy, then applies tangential damping to simulate seam-grip and shot "english," producing emergent trajectories rather than canned arcs.
The "edgeless" behavior is handled by boundary logic that avoids sticky-wall artifacts: outfield scoring is inferred from top-exit and behind-bowler escape manifolds instead of hard stop walls, while ground interactions use controlled restitution (`groundRestitution`) and low-amplitude velocity floor clamping so the ball never numerically dies into jitter. That means speed decay is intentional, not abrupt; high-energy strikes preserve kinetic character long enough to generate six/four outcomes, and low-energy mis-hits collapse into wicket/catch risk as horizontal momentum and vertical bounce amplitude fall below safe thresholds. The result is a hybrid arcade-physics envelope where shot timing, bat angle, and charge duration nonlinearly map to run probability.
Identity and scoring are split across local persistence and remote aggregation. A generated username plus selected flag are stored in profile state and mirrored through API writes (`/player`, `/score`, `/attempt`) keyed by a stable `playerId`, so identity can rotate without corrupting historical entries. Leaderboard hydration concurrently pulls players and flag aggregates, then computes display metrics such as run-rate from `total_runs / total_attempts`; this lets us rank both individual ceiling (best score) and collective nation-level consistency. The flag picker and name generator therefore are not cosmetic: they seed the data model used to bucket attempts, attach attribution, and keep the scoreboard mathematically coherent even through offline windows or profile changes.
Welcome New Player
We generated a fun name for you. Pick your flag, then continue.