← Back to Projects
Collapse Factor cover
Web Game · 3D Cash-Out Ladder

Collapse Factor

Think Jenga, but as a betting game. It’s drawn to look like an engineering blueprint, and it shows you the risk on a gauge before every move you make.

Role
  • Developer
  • Game designer
Genre
  • Cash-out ladder
  • 2 markets
Return
97% at every rung
Stack
  • Next.js 15
  • React 19
  • three.js
Audio
Synthesised WebAudio
Fairness
Block seed, sealed per tower

01The Game

A tower of 48 blocks stands on a measured test plate, lit by a single lamp. On every turn, a robotic claw pulls a block from near the bottom and places it on top. The tower keeps getting taller, while the part holding it up keeps getting thinner.

Most cash-out games have two problems. First, you’re asked whether you want to go one more step without ever being told how risky that step is. Second, once you cash out, there’s nothing left for you to care about. Collapse Factor fixes both. It shows the chance of collapse on a gauge before each pull, it sets the payouts using that same curve, and it adds a second bet on when the tower will fall.

Publish the risk

Before you commit, the gauge shows you the chance that this pull will bring the tower down, so you’re making a real judgement instead of guessing.

Price it honestly

The payouts come straight from the published risk curve, so no step is a better deal than any other.

Fake the physics, honestly

Whether the tower falls is decided before the claw even moves, and the animation never pretends that it isn’t.

02Screenshots

These screenshots were captured straight from the game. Tap any of them to see it bigger.

03Core Loop

  1. 1

    Build

    A new 48-block tower is built and its seed is locked in.

  2. 2

    Stake

    Buy a climb ticket, a tumble ticket, or both.

  3. 3

    Pull

    The claw pulls a block from the bottom 68% of the tower and puts it on top.

  4. 4

    Hold

    You get 8 seconds to decide whether to keep going or cash out. If you let the timer run out, you’re cashed out automatically.

  5. 5

    Tumble

    When the tower falls, the seed is revealed so every roll can be checked.

04Key Features

A 16-rung ladder

The climb maxes out at pull 16, paying 484.85×. Roughly one tower in 500 gets that far.

Tumble bands

A separate bet on which pull will knock the tower down: 1-3, 4-6, 7-9 or 10 and up.

Safe by default

If you run out of time, you’re cashed out rather than losing. You can also set a plan to ride to a certain pull, so the game doesn’t become a test of how fast you can tap.

One number, every channel

The collapse factor controls almost everything you see and hear: how much the tower sways, the colour of the floor ring, the claw’s lamp, the vignette, the dust, the pitch of the background hum and the gauge itself.

An engineering sheet

The whole look sticks to navy, cyan and amber, with sharp corners, monospaced numbers and an interface grid that lines up with the floor texture, just like a technical drawing.

Run record

The fairness panel lists every roll in the run next to the collapse factor it was tested against.

05The Maths

Everything in the game comes from a single function, hazard(n), which gives the collapse factor for pull number n.

The hazard ramp

The risk starts at 4% and goes up by 3.5 percentage points with each pull, until collapse is certain at pull 29. That end point is calculated from the curve rather than typed in, so if the step size changes, every table updates itself.

The climb

The payout is climbPays(n) = RTP / SURVIVAL[n], with an RTP of 0.97. In other words, the multiplier you’re paid is the fair one scaled by a fixed amount, so the return is the same at every step.

Truncated, never rounded up

Prices are shown to two decimal places and always rounded down, never up. A check() function then works out the real return from those rounded prices: between 96.42% and 97.00% on the climb, and between 96.66% and 96.91% on the tumble bets.

Tumble bands

1-3 Brittle 20.97% → 4.62× · 4-6 Shaky 35.54% → 2.72× · 7-9 Sturdy 27.64% → 3.50× · 10+ Monolith 15.86% → 6.11×. The ranges are split where most collapses actually happen, so none of them is a long-shot lottery ticket.

One seal per tower

drawRun uses one seeded stream to draw all 29 rolls at the very start. The block value is locked in when the tower is built and revealed when it falls.

06Under the Hood

Strict layering

React looks after the wallet, the tickets and the current phase, and it gives the 3D world a single read-only WorldView. Apart from that, the only way the two talk is through four one-off cues: build, pull, tumble and cashOut. The engine/ folder never imports React, and the components/ folder never imports three.js.

Three effects, no solver

Swaying, settling and falling all move the blocks more the higher up they are. That one property is what makes a pile of blocks look like a real stack.

Camera fit

The camera works out how to frame the tower based on its current height, so as the tower grows it never gets cut off.

Real DOM controls

Buttons, keyboard focus and screen reader support are all real HTML sitting on top of a transparent canvas, not drawn pixels.

07Challenges & Solutions

ChallengeA real physics engine would have to be told the outcome in advance anyway.
SolutionInstead, I used three simple effects that scale with height and play out the result that’s already been decided.
ChallengeIf the risk curve is public, players could hunt for the step with the best value.
SolutionEvery step is priced from the curve at the same return, so there’s no clever place to stop.
ChallengeIf the visuals look more nervous than the maths says they should, that gives something away. If they look calmer, that’s misleading.
SolutionOnly one function is allowed to choose a colour, a sway amount or a pitch for the current level of risk.

08Results & Takeaways

97%
RTP at every rung, by construction
484.85×
top of the climb at pull 16
2
markets settled by one tower
0
physics solvers
Next.js 15React 19TypeScript (strict)three.jsWebAudiomulberry32
  • A complete 3D betting game with a 48-block tower, a robotic claw, a public risk gauge, a 16-step ladder, four tumble bets and a background hum that tightens as the risk goes up.
  • Provably fair towers, each locked to a block value for the whole run.
  • Next up: publishing a hash of the seed before each run, settling bets on the server, and a shared tower that several players can ride together.

What I learned

  • Showing players the odds isn’t giving anything away. It’s a design feature, and it forces the payouts to be honest.
  • Build the maths first. The visuals should show what the numbers say, not come up with their own idea of risk.
  • Sometimes the most important product decision is a default. Here, it was making sure that running out of time is safe.