About this game DIAMOND RUSH
Development notes
One rulebook for every screen
Rules, ball flight and fielding are shared modules loaded by the Node server, the WebGL view and the Canvas fallback. The flight is stepped every 10 ms with gravity, drag, bounces, rolling friction and wall rebounds, so only a short launch description crosses the network. In friend matches the server accepts a swing stamped at most 180 ms before or 30 ms after its message arrives, and recomputes pitch-meter accuracy itself, so a modified client can't claim a PERFECT PITCH.
Results wait for the play
Hits, outs and runs are recorded when the play ends, not at contact. I slowed fielders (0.45 s reaction, chasing at 75% of sprint speed) and made exit speed grow with the square of contact quality. In a simulation with human-like error (±80 ms timing, 0.3 aim), about 9% of fair balls left the park, 28% fell for hits and 63% were outs.
Teaching the AI the count
The first AI ignored the count. Its deliberate balls always went to one spot and its batter swung at anything near the zone, so painting corners struck out every batter on any difficulty. Both sides now read the count and the previous pitch: in my Normal simulations, centre fastballs give up about 1.5 runs per half inning, a mix about 0.4, and nibbling corners 3.6, mostly on walks.
Updated: