Scoreboard

In short

Every park has a scoreboard out in center field showing the park, inning, score against the goal, home runs and outs. A ball whose flight crosses its face smashes a jagged hole in it, drops back dead in front of it, and still counts as a home run carrying at least to the board. The board’s look is purely visual; the physics only uses Scoreboard.Face.

How it works

What it shows

Scoreboard.Update writes three TextMesh lines each frame (only when they change):

SituationTitleLine 1Line 2
Not battingpark nameWELCOMEPLAY BALL!
In a runpark nameINN n SCORE s / goalHR n OUTS o/allowed
Batting cageBATTING CAGEHR nBEST n FT
3 s after a home run (HitLanded)HOME RUN! (flashing yellow / white)as aboveas above
A cutscene message (ShowMessage)the given title, flashing yellow / white every 0.8 sgivengiven

A cutscene message wins over everything else until it times out or ClearMessage() is called. OutroDirector uses it through BallparkBuilder.Board and clears it when the scene ends (Cutscenes).

Where it stands

  • scoreboardDistanceFt > 0 on the park: there, plus half the frame depth.
  • Else a stadium: just behind the outfield bleachers in center (over the batter’s eye), 3 m past their back row.
  • Else (open field): 140 ft past the center-field fence.
  • Legs: scoreboardLegHeightM, or 15 m (clear of the top bleacher row).

The smash, step by step

  1. HitPhysics.Simulate gets Scoreboard.Face(park, out frontZ, out area): the plane facing home plate and the frame’s rectangle on it.
  2. During the flight, when the ball moves toward center and crosses frontZ - BallRadius inside the rectangle, it records scoreboardIndex (path index) and scoreboardPoint, then bounces the ball back: z speed reversed x 0.15, x and y speed x 0.35. The ball drops out in front, dead.
  3. If the smash came before the first landing, distanceFt is raised to at least the distance to the smash point.
  4. AtBatController.BallInPlay plays the path back. When playback reaches scoreboardIndex (or at once on a skip), it raises GameEvents.ScoreboardHit(hit).
  5. Scoreboard.OnScoreboardHit calls Smash(point, exitVelocityMph); GameAudio plays the smash sound.
  6. Smash builds one damage mesh at the point: a jagged dark hole, a ring of shattered panel and cracks running out to the board’s edges (three submeshes, two-sided, drawn just in front of the text). It throws 18 shards (every third a lit LED) that fall under the park’s gravity and settle on the ground or a step, flickers the text for 1.6 s and shakes the board for 0.45 s.

Because spectators replay the same flight, a teammate’s smash breaks the board on every screen (Live Spectating).

Numbers

WhatValueWhere to tune
Board face44 x 17 m, 1 m frame border, 1.2 m deepScoreboard.WidthM, HeightM, FrameBorderM, FrameDepthM
Default leg height15 mDefaultLegHeightM
Open-field distancewall + 140 ftOpenFieldGapFt
Hole radiuslerp 1.1 to 1.9 m over 105 to 145 mph exit velocityScoreboard.Smash
Holes kept12 (the oldest is removed)MaxSmashes
Shards18, live 4 s (x 0.7 to 1)ShardCount, ShardSeconds
Flicker / shake1.6 s / 0.45 s, 0.35 mGlitchSeconds, ShakeSeconds, ShakeM
Bounce off the facerestitution 0.15, friction 0.35HitPhysics.BoardRestitution, BoardFriction
HOME RUN! flash3 sFlashSeconds
Practice map (Scoreboard Smash)board at 330 ft, 5 m legsDefaultContent (smash)

In the code

FileWhat it does
Scripts/Ballparks/Scoreboard.csFace, Build, Update, Smash, RandomFacePoint, ShowMessage, ClearMessage, damage mesh and shards.
Scripts/Batting/HitPhysics.csThe face crossing; HitOutcome.scoreboardIndex, scoreboardPoint, HitScoreboard.
Scripts/Batting/AtBatController.csRaises ScoreboardHit during BallInPlay.
Scripts/Data/BallparkDefinition.csscoreboardDistanceFt, scoreboardLegHeightM.
Editor/ScoreboardSmashTest.csThe test and the Play-mode smash.

Testing it

  • Tools > Home Run Derby > Run Scoreboard Smash Test: for every run park and practice park, finds the softest straightaway hit that reaches the board and checks it is a home run, smashes before landing, drops in front of the board and carries to it; checks a ball 20 deg off center flies past; checks an ordinary 106 mph / 28 deg home run falls short in a real park but smashes the practice map’s board. Logs how hard you must hit each park’s board. Headless: see Editor Tools and Tests.
  • Tools > Home Run Derby > Smash Scoreboard (Play mode): breaks the current board at a random spot through the real ScoreboardHit event (enabled only in Play mode).
  • In game: the batting cage’s Scoreboard Smash park (Scoreboard Smash).

Gotchas

Damage lasts the whole run

The class comment says holes stay “until the park is rebuilt (the next round)“. But BallparkBuilder.Build skips a park that is already built, and a run is one park, so holes stay from inning to inning until another park is built (for example the main menu). Up to 12 holes; the oldest goes first.

  • Smash shapes and shards use UnityEngine.Random, so they differ every time; the physics (where and whether it hits) is deterministic.
  • The board has no collider; only HitPhysics knows it exists.
  • Text uses Unity’s built-in LegacyRuntime.ttf.
  • A smash counts in the live hit counter as a chip and makes the hit a big moment that gets the instant replay (Hit Show); TEST HITS has a SCOREBOARD option to force one (Dev Menu and Shortcuts).
  • Since #46 a hit can curve in the air, and fair or foul is decided by where the ball actually goes; the board check itself (Scoreboard.Face) is unchanged (Hit Physics).