Cricket Manager
IPL franchise simulation

The 0.98 was the problem.

I’m building a detailed simulation of running an IPL franchise, playable live with friends. A suspiciously clean model result was the clue that the game still needed work.


In short

Problem
How do you make a simulated cricketer behave like the real one — and how would you know if you had failed?
Constraint
T20 is the most chaotic format in the sport, and the engine has to be perfectly deterministic.
Decided
Adapt the rating model from the Earth Similarity Index. Abandon min-max normalisation for reference-value deviation. Measure instead of eyeballing. Fit the upset rate, not the season correlation. Event-source the auction, and later every live decision.
Rejected
Keeping the min-max version because it was already built and its outputs looked reasonable — and reporting ρ = 0.98 as the headline validation result.
Hardest
Proving single-writer correctness before trusting the event log, and getting net run rate exactly right.
Outcome
A playable manager game built from 2.07M real deliveries. Fitting the upset rate took season correlation from 0.87 to 0.42. Nobody but me has played it yet, and I rate its strategic depth at about 5 out of 10.

Question

How do you make a simulated cricketer behave like the real one — and how would you know if you had failed?

The first half of that is a modelling problem and the second half is the harder one. Any management simulation can produce plausible-looking scorecards. Plausible is the trap: a scorecard that reads correctly tells you nothing about whether the engine underneath is reproducing the sport or merely imitating its output format.

So the project is really two things. A game — you own an IPL franchise, build a squad through a live auction, and manage a season ball by ball against other real owners. And a validation problem, which is where nearly all the interesting work went.

The reference points are Football Manager and OOTP Baseball rather than anything on a phone: for people who would rather agonise over whether to burn an RTM card on a death-overs specialist than bowl the yorker themselves.

Constraint

T20 is the most chaotic format in the sport, and the engine has to be perfectly deterministic.

Those pull in opposite directions, and holding both is the entire technical problem.

Determinism is non-negotiable for a multiplayer simulation: the same inputs must produce the same match everywhere, forever, or an auction result cannot be trusted and a bug cannot be reproduced. But the sport being modelled is one where a single over flips a match, and a system built for reproducibility will drift toward tidiness if nobody is watching the right number.

The second constraint is data volume, which is a gift with a bill attached. Roughly 797MB of ball-by-ball Cricsheet data, 11,190 match files in all, is enough to calibrate against reality rather than taste. The engine’s first base rates came from 2.07 million deliveries across 9,058 men’s matches; since October its default rates come from the IPL’s 2023–26 seasons, because the all-T20 average left IPL first innings more than 30 runs short. It is also enough that "it looks about right" stops being an acceptable answer, because you now have the means to check.

Squad data covers all 10 IPL franchises and 248 active players with batting and bowling statistics each.

Decision

Thirteen decisions. The tenth is the only one I would call judgment rather than engineering, and the last three are what changed once it became a game.

Decision 01

Steal the rating model from astronomy

Player ratings are built on an adaptation of the Earth Similarity Index — the astronomy metric that scores how closely an exoplanet resembles Earth on a 0-to-1 scale. Swap the planet for a cricketer and Earth for an ideal statistical profile, and you have a rating system with a defensible shape rather than a set of numbers someone felt were about right.

Batting Similarity Index and its bowling counterpart are the result. The appeal is not novelty; it is that the model forces you to state what an ideal player is, numerically and per format, before you can score anyone against it. A hand-tuned rating hides that judgment. This one has to publish it.

Decision 02

Abandon min-max normalisation for reference-value deviation

The first formulation was a min-max normalised weighted sum: each statistic scaled against its historical range, weighted, and combined across formats.

It works, and it has a flaw that matters. Min-max normalisation scores a player against the population, so a rating silently moves when the population changes, and a "90" means nothing more specific than "near the top of whoever else is in the dataset."

The refined model scores each statistic by how far it sits from a fixed ideal instead, so a rating means the same thing whoever else is in the game. Ability has since moved to a ratio against fixed benchmarks, capped at 1.5 times the benchmark, because a score that stopped at the ideal could not separate the best players from each other.

Traded away: automatic recalibration. A reference-value model has to be revisited by hand as the sport changes, where a min-max model drifts along with it for free.

Rejected: keeping the min-max version because it was already built and its outputs looked reasonable. Reasonable-looking output from a model whose scale has no fixed meaning is exactly the failure this project is about.

Decision 03

Publish the model's own weaknesses alongside it

The design documents state the limitations rather than leaving them to be discovered. The reference values and weights are subjective and high-leverage — small changes there move every rating in the system. The model collapses a multidimensional career into one number. It began by ignoring opposition quality and recency entirely; both are weighted now, and an adjustment across competitions and eras is approved but switched off. It is also most valid comparing players of similar role and vintage, which is one reason the player pools now hold only active players.

Three extensions were specified and held back at first. A longevity factor and an all-rounder split have since been built. A peak-performance index, from best-innings and best-match figures, still hasn’t.

10 more decisions inside Continue the Cricket Manager case study Decisions 04–13 · rating model · build phases · about 2,000 words Show all 10 remaining decisions ↓ Hide the full record ↑

Decision 04

Make Spearman correlation the acceptance criterion, not eyeballing

Calibration against the ball-by-ball corpus and real auction data produced three separate rating models — Ability, Market Value and Form. Only Market Value has a real-world label to check against, which is sold prices. Its first fit reached a Spearman correlation of 0.661 on 184 sold players; the refit on the world’s ratings reached 0.782, or 0.735 under ten-fold cross-validation. Ability and Form have no such check.

Splitting the rating into three is the substantive decision. A single number cannot simultaneously answer "how good is this player", "what will he cost" and "how is he playing right now", and collapsing them is how simulations end up with a squad of statistically excellent players who lose. Market value has to be able to disagree with ability — that gap is where the auction game actually lives.

0.65 is the honest number, not a flattering one. Checking ratings against real auction prices and real match outcomes means a 90-rated player has to have actually played like one, and that is a bar you can fail publicly.

Decision 05

Treat determinism as sacred in the engine

The ball-by-ball engine is fully deterministic, and the rules protecting that are absolute: one seeded source of randomness, nothing random outside it, and no I/O inside the engine at all.

Guarding it are golden-master tests pinned to reproducible scorecards. Any change that shifts one is a behavioural change, whether or not it was meant to be. With every tilt set to zero, aggregate output reproduces the data’s base rates to within ±0.2 percentage points, which checks the machinery and says nothing about whether the cricket is realistic. That was Decision 10’s job.

Decision 06

Event-source the auction

The auction core is deterministic and event-sourced: bids are processed as an ordered event log rather than by mutating shared state. For a live room where several people bid within the same second, the log is the truth — replayable, auditable, and impossible to disagree about after the fact.

It carries the real mechanics rather than an abstraction of them: retentions before the open market, RTM cards, the capped, uncapped and overseas categories, and a hard budget cap so every rupee spent on one player is one you cannot spend on the next. Stress-tested with 8-bidder race scenarios.

Decision 07

Damp the AI bidders on purpose

AI franchises run a saturation damper built specifically to stop them hoarding. Without it, bots with a budget and an objective function buy everything worth buying, and the market stops behaving like a market.

The intended effect is that prices rise on genuine scarcity rather than because a bot got greedy — which matters because the auction is the marquee moment of the product. An unrealistic auction does not just play badly; it invalidates every squad decision that follows from it.

Decision 08

Get net run rate exactly right

The league engine uses circle-method round-robin scheduling and an IPL-style playoff bracket — Qualifier 1, Qualifier 2, Eliminator, Final. It also implements the net run rate rule that most implementations get wrong: a side bowled out counts as having faced its full quota of overs, not the number it actually used.

That single rule decides qualification in real seasons. Getting it wrong produces a league table that looks right all year and sends the wrong team to the playoffs.

Decision 09

Prove single-writer correctness before trusting the log

The engine and the auction were built against in-memory adapters first, so they could be tested without any real infrastructure. Wiring them to a real database and a real-time layer meant the event log's central guarantee had to be proved rather than assumed.

The database itself refuses two events at the same position in the same stream, and a test fires 8 simultaneous append attempts to prove it. If two bids can occupy the same version of the same stream, event sourcing has bought nothing.

Identity in the live room follows the same posture: server-derived identity — client-asserted user IDs are never trusted. In a room where identity determines who owns a bid, accepting the client's word for who it is would be the whole vulnerability.

Decision 10

Treat a suspiciously good score as a defect

The season-sanity probe compared simulated season outcomes against real-world plausibility by Spearman correlation and returned 0.885 to 0.981.

That is a very strong result, and it is the finding I acted on. In most simulations a 0.98 would close the ticket. In T20 it means the model is too orderly: a format famous for a single over flipping a match should not produce seasons that correlate that cleanly with expectation. Real T20 seasons contain results nobody would have ranked correctly beforehand.

Earlier work had proved the simulation is monotonic: better players do produce better outcomes. It never proved the magnitude of that tilt was realistic. Going down a level from seasons to single matches found the cause. With a small ability gap the weaker side won 23% of the time, and with a larger one 3.5%. In real T20 the weaker side wins roughly 35–45% of typical matches.

So I fitted one number, a global scale on how decisively ability separates outcomes, against the single-match upset rate and not against the season correlation. At 0.30 the upset rates came to 39.9% and 28.6%. The season figures then settled on their own: mean Spearman fell from 0.87 to 0.42, ranging from −0.39 to 0.94, and the best squad’s share of titles fell from 50% to 31%.

Rejected: reporting 0.98 as the headline validation result. It is the most flattering number the project has produced and it was evidence of a problem.

Traded away: sharpness. Scaling every ability effect down flattens the slope as well as the noise: tail-enders strike at about 141 at the death against a real 128, and I have accepted that as a known limit.

Decision 11

Freeze the team sheet, and make every live decision an event

Managing a match live broke assumptions the engine had been allowed to make. The innings state indexes batters by position, so a selection saved mid-match could credit runs to the wrong player. Either manager could make the other side’s decisions, and a retried request could play a step twice.

Now a match runs from a frozen team sheet, decisions happen only at stoppages, each one goes into an event-sourced log, and one function answers for humans and AI alike, so “Hand to AI” is the same code path. If a human opponent doesn’t answer, a 60-second timeout hands the decision to the plan.

Traded away: 150–300 extra events a match and a new table, plus polling instead of push for the live match page.

Decision 12

Ship batting intent with its exploit on the record

I wanted five levels of batting intent, priced so that no level dominates. I declared a convex pricing model in advance, the data didn’t support it, and the declared fallback, a linear price, stands. That cut always batting Aggressive from +9.0 to +5.5 percentage points (±0.6) of win rate, and it is still positive for all ten teams, so “no dominant intent” is unmet.

I switched the feature off for the closed beta on 1 November, then played the game and switched it back on the next day. Without it, batting had nothing to decide.

Traded away: balance, knowingly. The AI always bats Balanced, intent applies to the whole team, and the win predictor under-calls the risk away from Balanced. Whether players just leave it on Aggressive is one of the first things the alpha has to answer, and it’s an open bet.

Decision 13

Stop tuning, and go and find out from people

A 22-season soak across two simulated worlds held up: IPL first innings averaged 188.3 over 4,136 innings with almost no drift. The first configuration tried had failed that test, with West Indies’ best XI falling from 79 to 56–59. I then froze the foundation on 30 October, including the engine and Ability. Tuning reopens only for a material defect.

My own verdict at that point was about 8 out of 10 on tactical functionality and about 5 out of 10 on strategic depth. It is closer to squad usage and avoiding mistakes than to out-thinking an opponent. More synthetic matches won’t improve that estimate, so the next step is a short alpha with five to ten real players.

Traded away: the chance to polish known limits, which include IPL sides slowly strengthening over the long run, thinning elite wicket-keepers and a few unresolved nationalities. They are now monitored instead of worked on.

The rating model

The reference values are the argument. Everything else is arithmetic.

From dataset to acceptance criterion in the simulation's calibration chain A corpus of 2.07 million real T20 deliveries feeds a rating model built on reference-value deviation, adapted from the Earth Similarity Index after min-max normalisation was abandoned. The model drives a deterministic ball-by-ball engine, whose season output is checked by Spearman rank correlation rather than by inspection, with a floor that 0.98 easily cleared. The 0.98 was treated as evidence of a defect rather than as a validation result, and fitting the single-match upset rate brought it down to a mean of 0.42. 2.07Mreal T20 deliveriesRATING MODELreference-value deviationadapted from the Earth Similarity Index;min-max normalisation abandonedENGINEdeterministic, ball-by-ballSPEARMAN ρacceptance criterionnot eyeballing — a floor of ρ > 0.4that 0.98 easily clearedρ = 0.98 came back. It was read as evidence of a leak rather than as a validation, and never published as the headline.Fitting the upset rate took it to 0.42.
Fig. 01 — The test passed. What rejected the number was knowing how often the favourite loses in real T20.

The anchors are where the judgment lives, and they are chosen per format. That is what decides whether a model is a translation of the sport or an imposition on it: a T20 bowler is scored against what twenty overs make achievable, not against milestones borrowed from the longer formats, which would flatten every bowler in the game towards zero on that component.

What each phase built

Design documents precede implementation for anything touching the attribute-to-outcome mapping. That rule produced the order below.

Phase history and what each one proved
PhaseBuiltProved
RatingsBatting and bowling indices calibrated against the ball-by-ball corpus and real auction data; Ability, Market Value and Form modelsMarket Value at Spearman 0.661 vs sold prices, later 0.782 (0.735 cross-validated)
Match engineDeterministic ball-by-ball simulationMonotonicity; zero-tilt aggregates within ±0.2pp of base rates; a pinned golden master
AuctionEvent-sourced auction with retentions, RTM and damped AI biddingCorrect under 8-bidder race conditions
LeagueRound-robin scheduling, exact NRR, IPL playoff bracketSeason sanity at Spearman 0.885–0.981 — and the flag it raised
InfrastructureModular design with in-memory adaptersTestability without real infrastructure
PersistenceA real database and real-time layer behind the same interfacesSingle-writer correctness under 8 concurrent appends
Auth & roomsAuthenticated live auction roomServer-derived identity end to end
StatsLeaderboards and value-for-money analytics on the same career data as the ratingsPoints per crore as an auction-strategy measure
VarianceA single scale on how decisively ability separates outcomes, fitted to real upset ratesUpsets 39.9% and 28.6%; season Spearman 0.87 down to 0.42
The manager gameSelection, tactics plans, injuries, training, transfers, finance, Impact Player, pitch types, a win predictor, next-season rollover25 web pages; the full loop runs end to end
Internationals12 Full Members, T20Is, the T20 World Cup, national jobs, 12 domestic competitionsT20I within tolerance on a soak; ODIs and Tests appear in the calendar but are not simulated
Live decisionsFrozen team sheet, event-sourced decision log, stoppages, Hand to AI, batting intentA scripted three-user browser journey, which found real stalls and wrongly refused answers
CommissionerMatch days, readiness and exactly-once rollover, after any member could previously play the season for everyone1,069 tests passed, 2 skipped, at that point

How it is built

A TypeScript monorepo, with a real-time layer for the live auction room. Live matches poll.

Development runs through Claude Code against a persistent context file holding stable project information, with task-scoped prompts issued per phase — a deliberate discipline for keeping long-running, multi-session AI-assisted development coherent rather than letting each session re-derive the architecture. Every phase closes with a summary and an open-items review before the next one opens. The tilt-magnitude problem stayed visible across three phases precisely because that review exists.

What it looks like

The interface is a control room rather than an arcade: dark, data-dense, purposeful, closer in spirit to Cricket Captain than to anything designed for a thirty-second session. It is built to be lived in for a whole season, and the visual design follows from that rather than from what screenshots well.

Outcome

  • 2.07MDeliveries in the first calibration
  • 11,190Match files in the corpus
  • 0.735Spearman, market value vs sold prices, cross-validated
  • ±0.2ppZero-tilt output vs base rates
  • 248Players, 10 franchises
  • 8Concurrent appends, log correct

Every system described above was built and tested: the rating models against real outcomes, the engine against real aggregates, the auction under race conditions, the league against real qualification rules, the event log under concurrency, and the auction room under an authenticated multiplayer session.

The problem the strongest number exposed is closed: seasons are now as noisy as the sport they model. What isn’t settled is whether the game is any good. Always batting Aggressive still pays, the AI’s bowling plan is hard to beat, and fatigue affects injury risk but not play.

Nobody but me has played it. The build evidence here is unusually complete and the usage evidence is nil: no seasons completed outside testing, no live auction room with other people in it. Scripts have played three managers at once, and scripts aren’t people. I’ve decided to run a short alpha with five to ten testers, which first needs a hosted deployment, because everything still runs locally. Here’s how to be one of them.

Why a simulation is worth building at all

This is the least commercial thing on this site and the most useful thing I have built for thinking. A simulation is systems design with nowhere to hide: you are not shipping features, you are building a small economy with its own internal logic, and if any part of it is unbalanced players find the exploit within hours.

Every subsystem turns out to be a familiar problem wearing a cricket shirt. The auction is a market. The rating system is a model, with the same bias and edge-case failures as any other model. Scheduling is constraint satisfaction. The domain changes; the thinking does not — which is the argument for building outside your field rather than a hobby that needs excusing.

A simulation that gets the ranking right and the chaos wrong is a spreadsheet wearing a scorecard. It took a worse-looking number to fix that.

typescript · next.js · real-time multiplayer · event sourcing · deterministic simulation · spearman validation · cricsheet

Next