2P PENNY PUSHER 1986: Simulating Multi-Layer Coin Shingles, Anti-Wedge Pins, and Cliff Ledge Avalanches in Canvas
"Deconstructing the mechanical physics of classic British seaside coin pushers: multi-layer Z-shingle stacking, continuous cam shelf kinematics, anti-clamping pinboard geometry, and the psychological engineering of cliff overhangs."

01.The Seaside Optical Illusion: Why Rigid 2D Discs Fail
Anyone who spent their childhood summer holidays in Blackpool, Great Yarmouth, or Brighton knows the irresistible magnetic pull of the 2p penny pusher. You peer through the scratched acrylic front glass at rows of copper pennies hanging mere millimeters over a stainless steel cliff edge, drop a 2p down the swinging chute, and watch in agony as the motorized shelf nudges the mass without dislodging a single coin.
When you attempt to simulate a coin pusher in code, a naive 2D physics engine fails immediately. If you treat coins as rigid 2D circles on a flat plane, coins repel each other sideways like billiard balls. Instead of forming tall, stepped, overlapping mounds that slide forward as a unified mass, the coins scatter into the operator side gutters and jam the playfield.
To capture the genuine physical feel of an electro-mechanical cascade machine, we had to engineer a custom multi-layer Z-stacking collision solver, tangential pinboard deflection physics, and an authentic 18Hz AC-coupled soundscape.
02.1. Multi-Layer Z-Stacking & Stepped Shingle Physics
Real coins in a pusher do not exist in a single flat 2D plane: they overlap, forming stepped shingles and multi-layer stacks (z in [0, 3]).
In our Canvas physics engine, each coin tracks a discrete integer vertical elevation layer:
- ★Isometric Visual Shingle Offset: Stacked coins are rendered with an isometric elevation shift:
const offsetY = -coin.z * 3.5;
ctx.translate(coin.x, coin.y + offsetY);- ★Layer-Selective Hard Collision: Hard radial disc repulsion is enforced only between coins sharing the identical z-layer.
- ★Stack Promotion & Shingle Compression: When two coins on the same layer are squeezed by the advancing pusher bar with velocity magnitude > 0.4, the trailing coin is promoted to the upper stack layer (z = z + 1).
- ★Unified Mass Friction Transmission: When a coin rests on top of another (z1 > z2), it transmits 30% of its forward and lateral momentum down to the coin beneath it:
const cTop = c1.z > c2.z ? c1 : c2;
const cBottom = c1.z > c2.z ? c2 : c1;
cTop.vx += cBottom.vx * 0.3;
cTop.vy += cBottom.vy * 0.3;This creates the authentic mechanical behavior where an entire bed of copper coins creeps forward as a dense, shifting continental shelf.
03.2. Pinboard Geometry & Anti-Clamping Tangential Deflection
Before coins hit the upper motorized shelf, they drop through a 3-row staggered brass pachinko pinboard.
In early testing, coins frequently became clamped in triangular 3-pin traps or bounced up and down vertically in endless loops. To achieve realistic pachinko tumble behavior:
- 1.Geometric Clearance: Horizontal pin spacing was fixed at 52px and vertical row pitch at 29px (comfortably wider than the 27px coin diameter).
- 2.Enforced Tangential Deflection: When a falling coin collides with a brass peg, normal reflection velocity is clamped to preserve positive downward travel (vy >= 1.2 px/frame) while imparting lateral roll:
dc.vx = nx * (2.8 + Math.random() * 1.0);
dc.vy = Math.max(1.2, Math.abs(dc.vy) * 0.7 + ny * 0.4);- 1.Anti-Stuck Failsafe: If a coin lingers in the pinboard for longer than 1.2 seconds, an automatic lateral impulse dislodges it, ensuring fluid drop pacing.
04.3. The 167px Buffer: Preventing Frame 0 Spills
A common flaw in digital coin pushers is spawning the starting coin bed too close to the front edge or over-extending the pusher bar stroke, causing coins to immediately spill into the payout tray on frame 1 before the player has inserted a single penny.
To ensure authentic arcade tension:
- ★Calibrated Pusher Stroke: The motorized pusher stroke is restricted to y in [108, 162]. Because the upper shelf step is at y = 242, this leaves an 80px buffer on Tier 1 so moving the empty shelf never dumps coins forward without active insertions.
- ★Staggered Grid Placement: The lower bed initializes 42 coins across 4 rows terminating at y = 335. With the front payout cliff at y = 502, this guarantees a generous 167px safety buffer.
- ★20-Pass Static Pre-Relaxation: Before rendering the opening frame, the physics engine executes 20 relaxation passes with strict boundary clamps (y <= 345) and zeroes all initial velocities (vx = 0, vy = 0).
- ★Out-of-Coins Grace Resolver: When your coin purse hits zero, the game does not abruptly terminate. A 7.5-second grace window allows your final dropped coins to tumble through the pins, push the upper shelf, and resolve lingering overhang avalanches.
05.4. Procedural Audio: 18Hz AC-Coupling & Metallic Plucks
Digital square and triangle oscillators produce sudden step changes that can introduce unwanted sub-bass pops in web audio visualizers.
In accordance with our hardware standard, the master audio chain passes all synthesized voices through an 18Hz Butterworth highpass filter (Q = 0.707) to mimic the AC-coupling capacitors of 1980s arcade soundcards:
- ★Brass Peg Pings: High-Q sine pulses decaying in 80ms with frequency scaling based on peg vertical depth (2.8kHz to 4.2kHz).
- ★Copper Coin Clinks: Triangle waves starting at 2.2kHz and ramping downward in 60ms to model the mechanical acoustic pluck of colliding bronze coins.
- ★Cabinet Nudge Thud: A 140Hz downward sawtooth sweep decaying in 200ms, paired with dynamic canvas screen shake and staggered multi-coin rattling clicks.