GREEN Swings

In short

A swing is GREEN when the ball meets the bat’s perfect zone (within 0.04 m of the sweet spot, x Contact) and timing is at least 0.80 (SwingResolver.GreenTiming): the ball goes within 9 degrees of dead centre. The comment puts that at about a 14 ms window on a middle fastball. Greens always get the replay, and a green home run scores x1.25 at base stats, more with a streak. The timing ring uses the exact same rule, so a green ring always means a green swing.

How it works

The rule

SwingResolver.Classify sets isGreen = zone == Perfect && timing >= GreenTiming. Timing is 1 - |spray| / 45, where spray is the direction the bat face sent the ball. See Batting Explained.

Every GREEN is graded PERFECT underneath (perfect-zone quality is 0.9 or more). Only contact can be green. A green foul or a green out still counts as a green swing; it just scores nothing.

The streak

AtBatController.GreenStreak counts greens in a row this round. Any non-green swing (including a whiff or a non-green contact) resets it to 0. A take does not break it. Each SwingResult.greenStreak is the streak including that swing (0 if not green). The streak resets at the start of every round.

Feedback

  • Hit stop: 0.16 s real time instead of 0.09 s. See Hit stop.
  • Instant replay: every green earns it (EarnsReplay). A green home run is a big moment, so it gets the full replay after the play; any other green gets the contact close-up before the flight. The replay tag reads “GREEN!“. See Hit Show.
  • HUD: the grade pops as “GREEN!” (or “GREEN! xn” from a streak of 2), bigger and harder than other grades. A green-white flash washes the screen for 0.25 s. A “GREEN STREAK xn” pill sits under the score from 2 in a row.
  • Camera shake (GreenFeedback): 0.22 s, 0.035 m, 38 Hz, fading out; never under the pause menu.
  • Trail: the batted ball’s trail turns green.
  • Sound (Audio/GameAudio): the green crack, a ping, plus a small cheer that gets louder and higher with the streak (capped at 5).
  • Score stack: on a home run the counter adds a “GREEN” or “GREEN xn STREAK” step with its multiplier.

All feedback, outcome by outcome: Batting Feedback.

Scoring

ScoreCalculator.GreenMultiplier: 1 + GreenBonus + GreenStreakBonus x (greenStreak - 1) on a green home run, else 1. Base GreenBonus is 0.25 (+25%); base GreenStreakBonus is 0. Example from the code comment: base 25% plus a +10% streak upgrade on your 3rd green in a row = x1.45. See Scoring.

Upgrades and synergies tagged “Green” raise these stats. See Upgrades and Synergies.

Timing ring agreement (TimingWindowScanner)

The ring (see Timing ring (optional assist)) does not use hand-tuned windows. For one pitch and one aim, TimingWindowScanner test-swings the real bat code (BatSwing, BatJiggle, BatCollision) and grades each press with SwingResolver.Classify, which has no random rolls:

  1. Simulate the swing once per aim (the bat’s motion only depends on time since the press) and reuse it for every press time.
  2. Coarse pass every 1/160 s (about 6 ms) from 0.45 s before arrival to 0.05 s after.
  3. Refine every 1/480 s (about 2 ms) wherever the result changes (miss / contact, green / not green) and around the best moment.

It returns the yellow window (any contact), the green window and the best press (scored timing + 0.1 x quality: best timed first, then squarest). Because green also needs the perfect zone, the green window depends on the aim: aim the helper’s sweet spot off the ball and the ring can’t go green. The ring re-scans as the aim moves (at most every 0.1 s, when it moves more than 0.015 m). Because the green window is shorter than a 60 fps frame, the ring shows green if a press in the coming frame would green.

Numbers

WhatValueWhere to tune
Timing threshold0.80 (about 14 ms on a middle fastball; 0.85 = 10 ms, 0.75 = 19 ms)SwingResolver.GreenTiming
Perfect zonewithin 0.04 m of the sweet spot, x max(0.2, Contact)HitTables.PerfectHalfWidth
Replay for a non-green PERFECTtiming >= 0.6SwingResolver.ReplayTiming
Green hit stop0.16 sAtBatController.GreenHitStopSeconds
Green HR bonus (base)+25%StatInfo.BaseValue(GreenBonus)
Green streak bonus (base)0StatInfo.BaseValue default
Screen flash0.25 sHudView.GreenFlashSeconds
Camera shake0.22 s, 0.035 m, 38 HzGreenFeedback constants
Green trail colour(0.35, 1, 0.45)AtBatController.GreenTrailColor
Scanner stepscoarse 1/160 s, fine 1/480 sTimingWindowScanner

In the code

FileWhat it does
Assets/_Project/Scripts/Batting/SwingResolver.csGreenTiming, Classify (isGreen), EarnsReplay
Assets/_Project/Scripts/Batting/HitTables.csPerfectHalfWidth
Assets/_Project/Scripts/Batting/AtBatController.csGreenStreak, green hit stop and trail
Assets/_Project/Scripts/UI/TimingWindowScanner.csFinds yellow and green press windows by test-swinging
Assets/_Project/Scripts/UI/TimingIndicator.csDraws the ring from those windows
Assets/_Project/Scripts/UI/GreenFeedback.csCamera shake on a green
Assets/_Project/Scripts/UI/HudView.cs”GREEN!” grade, flash, streak pill, replay tag
Assets/_Project/Scripts/Ballparks/ScoreCalculator.csGreenMultiplier
Assets/_Project/Scripts/Stats/StatType.csGreenBonus, GreenStreakBonus base values and display

Gotchas

  • Two things make GREEN harder: raising GreenTiming (tighter timing) or lowering HitTables.PerfectHalfWidth (smaller sweet spot). The ring follows either.
  • The old rule (timing >= 0.80 and sweet spot quality >= 0.70, GreenSweetSpot) is gone; GreenSweetSpot no longer exists.
  • The play card’s timing line says “ON TIME” up to 18.75 degrees of spray, but GREEN needs 9. A PERFECT that missed GREEN on timing can still read “TIMING: ON TIME”.
  • In co-op spectating the streak comes from the batter’s swing (max(1, swing.greenStreak)), not counted locally.
  • The README says the green sound is set on GreenFeedback.GreenClip. There is no such field; the green crack comes from SoundBank.CrackFor via GameAudio.