DEV Community

汪福杰
汪福杰

Posted on

How I Built a Zero-Login Client-Side Soft-Pity Simulator for Zenless Zone Zero

Most gacha pull calculators either ask you to paste a pull-history URL or approximate odds with Monte Carlo sampling that jitters on every reload. When I built ZZZ Polychrome Calculator, I wanted an instant, zero-login web tool that runs 100% in the browser and computes exact soft-pity probabilities in under a millisecond.

Here is the core math behind the simulator.

1. Modeling the Soft-Pity Curve

In Zenless Zone Zero (ZZZ), the published base S-Rank rate is 0.6% on the Exclusive Agent channel (hard pity at pull 90, 50/50 featured split) and 1.0% on the W-Engine channel (hard pity at pull 80, 75/25 featured split).

To match the published consolidated rates (1.6% for Agents and 2.0% for W-Engines), the per-pull S-Rank probability ramps linearly once you enter soft pity:

function sRankRate(pull, channel = 'agent') {
  if (channel === 'engine') {
    if (pull >= 80) return 1.0;
    if (pull < 65) return 0.01;
    return Math.min(0.99, 0.01 + (pull - 64) * 0.07);
  }
  if (pull >= 90) return 1.0;
  if (pull < 74) return 0.006;
  return Math.min(1.0, 0.006 + (pull - 73) * 0.06);
}
Enter fullscreen mode Exit fullscreen mode

2. Exact Markov-Chain State Transition (No Monte Carlo Jitter)

Instead of running 100,000 random trials, we can track the exact probability distribution across (pity, guaranteed, copies) states on every pull:

// State key: (pity: 0..89, guaranteed: 0|1, copies: 0..target)
// On each pull:
//   1. Miss S-Rank (1 - p) -> (pity + 1, guaranteed, copies)
//   2. Hit S-Rank & win featured (p * (guaranteed ? 1 : winRate))
//        -> (0, 0, Math.min(target, copies + 1))
//   3. Hit S-Rank & lose 50/50 (p * (guaranteed ? 0 : 1 - winRate))
//        -> (0, 1, copies)
Enter fullscreen mode Exit fullscreen mode

With at most 90 * 2 * (target + 1) states, simulating 180 pulls takes < 1 ms on mobile browsers and produces deterministic, repeatable curves—including combined M0W1 (Agent + Signature W-Engine) budgets by convolving the remaining pulls after the Agent target is met.

3. Keeping Everything Local & Privacy-First

Because all math and recurring income tables (Daily Errands, Shiyu Defense, Deadly Assault, Hollow Zero, and Inter-Knot Membership) run purely client-side, players can save their stash locally in localStorage without ever logging in or sharing a UID.

You can try the live tools here:

Top comments (0)