Scoring

In short

A home run scores round((distanceFt x targetMultiplier + targetBonus) x HR Multiplier x greenMultiplier). Anything else scores 0. Distance is carry (where the ball first lands). Targets are landing zones or things in the air that pay extra. Reach the inning’s goal and the inning ends. See Run Structure.

How it works

  1. HitPhysics.Simulate flags a home run and, if so, calls ScoreCalculator.FindTarget for the best target. See Hit Physics.
  2. ScoreCalculator.Score(hit, stats) turns it into points right after the swing, before the flight is shown.
  3. When the ball lands, ResolvePlay adds the score to RoundScore and counts the home run.
  4. On screen, the live counter builds the score step by step under “HOME RUN!”: DISTANCE (feet), the target, GREEN (or GREEN xn STREAK), HR POWER, each with its chip, ending exactly on the points (HitTally.BuildStack rounds like Score). The total “+points” then flies into the score panel, which only counts it up as it arrives. See Hit Show.

Targets (OutfieldTarget)

Each ballpark has a list of targets. Each target has a spray angle, distance, radius, multiplier (default 2), flat bonus, and heightM.

  • Landing zone (heightM = 0): earned if the ball’s first landing point is within the radius (on the ground plane).
  • Aerial target (heightM > 0, for example the moon’s space station): earned if any point of the flight before landing passes within the radius of that point in the air.
  • If several are earned, the one worth the most extra points wins: value = distanceFt x (multiplier - 1) + bonus. This lets multipliers and flat bonuses compare fairly. TargetValue exposes the same number (the match intro shows it as a target’s “worth”).
  • The HUD shows a target’s reward as “+150” (bonus) or “x2” (multiplier).

Per-park targets: see Ballparks and each park note.

Multipliers

  • HR Multiplier stat (base 1). See Stats.
  • Green multiplier: 1 + GreenBonus + GreenStreakBonus x (greenStreak - 1) on a GREEN, else 1. Base GreenBonus is 0.25. See GREEN Swings.

Example (derived from the formula): a 400 ft home run with no target and base stats scores 400. The same hit as a first GREEN scores 500.

Coins

Coins are paid when the inning ends, by RunManager.InningCoins: homeRuns x (coinsPerHomeRun + CoinBonus) + bonusCoins, and if the inning was cleared, + coinsPerInning + outsLeft x coinsPerLeftoverOut (+ bossBonusCoins on a boss inning). bonusCoins are the extra coins from home runs off $$$ balls (see Special Balls). Full economy: Shop and Economy.

Numbers

WhatValueWhere to tune
Non-home-run score0ScoreCalculator.Score
Target multiplier default2OutfieldTarget.multiplier
Target radius / distance defaults30 ft / 420 ftOutfieldTarget
HR Multiplier base1StatInfo.BaseValue
Green bonus base+25%StatInfo.BaseValue(GreenBonus)
Coins per home run1 + CoinBonusRunConfig.coinsPerHomeRun
$$$ ball home run+3 coinsBallEffects.MoneyBallCoins
Inning cleared+4 coinsRunConfig.coinsPerInning
Per unused out (cleared)+1 coinRunConfig.coinsPerLeftoverOut
Boss inning cleared+5 coinsRunConfig.bossBonusCoins

In the code

FileWhat it does
Assets/_Project/Scripts/Ballparks/ScoreCalculator.csFindTarget, Earned, Value, TargetValue, Score, GreenMultiplier
Assets/_Project/Scripts/Data/BallparkDefinition.csOutfieldTarget fields, Reward, IsAerial
Assets/_Project/Scripts/Batting/AtBatController.csResolvePlay adds the score, home runs, $$$ coins, longest hit
Assets/_Project/Scripts/Run/RunManager.csInningCoins
Assets/_Project/Scripts/UI/HudView.csScore card with GOAL and progress bar (shows HitCounter.DisplayScore), play summary card
Assets/_Project/Scripts/Batting/HitTally.csThe on-screen score stack for a home run

Gotchas

  • The score is computed at contact but only added when the ball lands, so a skipped flight still scores. The score panel lags a little more: it counts a home run’s points as the counter’s total arrives.
  • PR #46 rebuilt batting but did not change scoring: only the exit velocity, launch and spray that feed the distance changed. See Batting Explained.
  • Distance on the play card and banner is carry (distanceFt), not where the ball stops rolling.
  • A landing zone checks only the first landing point. A ball that bounces into a zone doesn’t earn it.
  • The ScoreCalculator class comment invites new scoring rules (streak bonuses and so on) to go here.
  • In co-op the round score starts at the team’s score so far (RoundContext.startingScore). See Co-op Rules.