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):
| Situation | Title | Line 1 | Line 2 |
|---|---|---|---|
| Not batting | park name | WELCOME | PLAY BALL! |
| In a run | park name | INN n SCORE s / goal | HR n OUTS o/allowed |
| Batting cage | BATTING CAGE | HR n | BEST n FT |
3 s after a home run (HitLanded) | HOME RUN! (flashing yellow / white) | as above | as above |
A cutscene message (ShowMessage) | the given title, flashing yellow / white every 0.8 s | given | given |
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 > 0on 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
HitPhysics.SimulategetsScoreboard.Face(park, out frontZ, out area): the plane facing home plate and the frame’s rectangle on it.- During the flight, when the ball moves toward center and crosses
frontZ - BallRadiusinside the rectangle, it recordsscoreboardIndex(path index) andscoreboardPoint, 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. - If the smash came before the first landing,
distanceFtis raised to at least the distance to the smash point. AtBatController.BallInPlayplays the path back. When playback reachesscoreboardIndex(or at once on a skip), it raisesGameEvents.ScoreboardHit(hit).Scoreboard.OnScoreboardHitcallsSmash(point, exitVelocityMph);GameAudioplays the smash sound.Smashbuilds 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
| What | Value | Where to tune |
|---|---|---|
| Board face | 44 x 17 m, 1 m frame border, 1.2 m deep | Scoreboard.WidthM, HeightM, FrameBorderM, FrameDepthM |
| Default leg height | 15 m | DefaultLegHeightM |
| Open-field distance | wall + 140 ft | OpenFieldGapFt |
| Hole radius | lerp 1.1 to 1.9 m over 105 to 145 mph exit velocity | Scoreboard.Smash |
| Holes kept | 12 (the oldest is removed) | MaxSmashes |
| Shards | 18, live 4 s (x 0.7 to 1) | ShardCount, ShardSeconds |
| Flicker / shake | 1.6 s / 0.45 s, 0.35 m | GlitchSeconds, ShakeSeconds, ShakeM |
| Bounce off the face | restitution 0.15, friction 0.35 | HitPhysics.BoardRestitution, BoardFriction |
| HOME RUN! flash | 3 s | FlashSeconds |
| Practice map (Scoreboard Smash) | board at 330 ft, 5 m legs | DefaultContent (smash) |
In the code
| File | What it does |
|---|---|
Scripts/Ballparks/Scoreboard.cs | Face, Build, Update, Smash, RandomFacePoint, ShowMessage, ClearMessage, damage mesh and shards. |
Scripts/Batting/HitPhysics.cs | The face crossing; HitOutcome.scoreboardIndex, scoreboardPoint, HitScoreboard. |
Scripts/Batting/AtBatController.cs | Raises ScoreboardHit during BallInPlay. |
Scripts/Data/BallparkDefinition.cs | scoreboardDistanceFt, scoreboardLegHeightM. |
Editor/ScoreboardSmashTest.cs | The 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
ScoreboardHitevent (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.Buildskips 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
HitPhysicsknows 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).
Related
- Scoreboard Smash: the practice map built to be smashed
- Hit Physics: the flight simulation
- Game Events:
ScoreboardHit - Ballpark Building: where the board is built
- Audio: the smash sound
- Cutscenes: the board’s cutscene messages