Count and Outs
In short
These are derby rules, not real baseball. Only home runs are good: any fair ball that stays in the park is an out. Three strikes is an out. A foul is a strike but can’t be strike three. Four balls just reset the count (no walk). An inning has 3 outs by default, plus the Extra Outs stat, minus one on Hard.
How it works
CountTracker holds a CountState (balls, strikes, outs, outsAllowed). Every change raises GameEvents.CountChanged for the HUD.
| What happened | Rule | Headline |
|---|---|---|
| Take, pitch in the zone | strike; the third is an out | STRIKE LOOKING / STRUCK OUT LOOKING |
| Take, pitch out of the zone | ball; the fourth resets balls and strikes | BALL / BALL FOUR - COUNT RESETS |
| Swing and miss | strike; the third is an out | SWING AND A MISS / STRUCK OUT! |
| Foul (contact, lands outside the foul lines) | strike, but not with 2 strikes already | FOUL BALL |
| Cleared the wall on the fly, inside the poles | home run: score it, reset the count | HOME RUN! |
| Fair, anything else | out, reset the count | OFF THE WALL - OUT / GROUND OUT / FLY BALL - OUT |
- In the zone is decided when the pitch is created:
StrikeZone.Contains(plateLocation). The zone counts a pitch that touches it (the ball’s radius is added to every edge). See Pitching. - Fair or foul comes from where the ball actually goes: a home run if it clears the wall inside the poles, else fair if it first lands within 45 degrees of centre. A ball can start fair and hook foul (see Hit Physics). A swing way early or late (spray beyond 45 degrees) heads foul, and holding A/D can’t aim it back (see Batting Explained).
- Out type: “OFF THE WALL” if the ball hit the outfield wall before it landed; “GROUND OUT” if it never got 12 ft high; otherwise “FLY BALL”.
- Any out (strikeout or ball in play) resets balls and strikes.
- The round ends when
outs >= outsAllowed(checked between pitches). See At-Bat Loop.
Outs per inning
- Solo:
max(1, RunConfig.outsPerInning + Difficulties.OutsDelta(difficulty)) + ExtraOuts. - Co-op: each turn gets
CoopRules.OutsForTurnouts from a shared team pool. See Co-op Rules. - Batting cage: 999 outs (never ends in practice). See Batting Cage.
- Outs you didn’t need pay a coin each when you clear an inning. See Shop and Economy.
The HUD draws outs as baseballs (white = left, red = used) and balls / strikes as lights: 3 for balls, 2 for strikes.
Numbers
| What | Value | Where to tune |
|---|---|---|
| Strikes for an out | 3 | CountTracker.StrikesForOut |
| Balls that reset the count | 4 | CountTracker.BallsForWalk |
| Outs per inning (Normal, Medium) | 3 | RunConfig.outsPerInning |
| Outs change on Hard | -1 (never below 1) | Difficulties.OutsDelta |
| Extra outs | + ExtraOuts stat (base 0) | upgrades, synergies, batter perks |
| Co-op outs per turn | 2 if ExtraOuts > 0, else 1 | CoopRules.OutsForTurn |
| Ground-out height | below 12 ft max height | AtBatController.GroundBallMaxHeightFt |
| Fair territory | landing point within +/-45 degrees, or over the wall inside the poles | HitPhysics.FoulLineDeg |
In the code
| File | What it does |
|---|---|
Assets/_Project/Scripts/Batting/CountTracker.cs | AddStrike(isFoul), AddBall(), AddOut(), ResetCount(), AddOutsAllowed() (dev) |
Assets/_Project/Scripts/Batting/AtBatController.cs | PlayOutcome (takes and whiffs), ResolvePlay (balls in play) |
Assets/_Project/Scripts/Run/RunManager.cs | OutsPerInning, sets context.outsAllowed |
Assets/_Project/Scripts/UI/HudView.cs | DrawCount: outs, B and S lights, coins, HR count |
Gotchas
- Ball four gives the batter nothing except a fresh count. There is no walk and no base runner.
- A foul with 2 strikes leaves the count unchanged but still raises
CountChanged. - A foul or an out can still be a GREEN and keeps the green streak going. It just scores nothing.
- Each result also has its own stamp, sound and play card. See Batting Feedback.
- The
ExtraOutsstat is rounded withGetInt(Mathf.RoundToInt). AddOutsAllowed(dev menu) never drops outs allowed below the outs already made. See Dev Menu and Shortcuts.
Related
- At-Bat Loop: where the count is updated
- Pitching: strike rate and the strike zone
- Hit Physics: fair, foul, wall and home run
- Batting Feedback: how each result is shown
- Difficulty: Hard takes an out away
- Stats: the Extra Outs stat