Code Map
In short
All game code is in
Assets/_Project/Scripts/(assemblyHomeRunDerby), all editor tooling inAssets/_Project/Editor/(assemblyHomeRunDerby.Editor). Paths below are relative to those two folders. Each row links to the note that explains the file.
How it works
Folders at a glance:
| Folder | What lives there | Main note |
|---|---|---|
Scripts/Audio/ | Code-synthesized sound and the event-to-sound glue | Audio |
Scripts/Ballparks/ | Building parks, the scoreboard, scoring, sky | Ballpark Building |
Scripts/Batting/ | The at-bat, swing, bat, ball flight, batter figures, cosmetics on figures | At-Bat Loop |
Scripts/Core/ | Boot, composition root, events, RNG, camera, visuals | Architecture |
Scripts/Data/ | ScriptableObject definitions and DefaultContent | Ballparks, Upgrades |
Scripts/FitMode/ | The dev-only fit editor | Fit Mode |
Scripts/Intro/ | The match intro and the end-of-game cutscenes (namespace HomeRunDerby.Intro) | Cutscenes |
Scripts/Modes/ | Game modes and the batting cage | Batting Cage |
Scripts/Net/ | Transports, lobby session, messages | Co-op Overview |
Scripts/Pitching/ | Pitch choice, pitch path, strike zone, pitcher figures | Pitching |
Scripts/Progression/ | Saves, meta unlocks, XP, daily seed, leaderboard | Meta Progression |
Scripts/Run/ | Solo and co-op run drivers, run state, innings | Run Structure |
Scripts/Stats/ | The stat stacking system | Stats System |
Scripts/UI/ | IMGUI views, theme, overlays | UI System |
Scripts/Upgrades/ | Shop and synergies | Shop and Economy |
Editor/ | Tools menu, tests, build, setup | Editor Tools and Tests |
Scripts/Audio
| File | Role | Note |
|---|---|---|
AudioSynth.cs | DSP kit: oscillators, noise, filters, envelopes, mixing, ToClip | Audio |
BallparkOrgan.cs | The organ loop and the “Charge!” fanfare from note tables | Audio |
GameAudio.cs | Turns GameEvents into sounds; UI sound one-liners | Audio |
SoundBank.cs | Builds and caches every sound effect | Audio |
Scripts/Ballparks
| File | Role | Note |
|---|---|---|
BallparkBuilder.cs | Builds a park from its definition | Ballpark Building |
BallparkMath.cs | Feet/metres, polar field coordinates, FlightEnvironment | Hit Physics |
Fireworks.cs | Code-built HDR fireworks, dust and confetti for the outros | Ballpark Building, Cutscenes |
MeteorShower.cs | Visual meteors for the moon’s Meteor Shower bonus | Ballpark Building |
ParkDressing.cs | Props around the field: prefab or code layout, glow, spin/yaw/bob | Ballpark Building |
ParkLayouts.cs | Code layouts of the farm and moon props | Ballpark Building |
ParkTextures.cs | Generated grass, dirt and regolith textures | Rendering |
ScoreCalculator.cs | Home run score: distance x target x HR multiplier x green | Scoring |
Scoreboard.cs | The center-field scoreboard and its smashing | Scoreboard |
SkyBuilder.cs | Procedural sky per SkyPreset, ambient from sky | Rendering |
StadiumAmbience.cs | Flags, clouds, gulls | Ballpark Building |
StadiumCrowd.cs | Stands and the GPU-instanced crowd | Ballpark Building |
StadiumLayout.cs | Stand geometry shared with the ball physics | Ballpark Building |
Scripts/Batting
| File | Role | Note |
|---|---|---|
AtBatController.cs | One round: pitch, swing, flight, count, score | At-Bat Loop |
AtBatController.HitShow.cs | The hit show: live counter, tracer, flight camera, big-moment replay | Hit Show |
AtBatController.Outro.cs | Stages batter, pitcher and replay ball for the outros | Cutscenes, Characters and Rigs |
AtBatController.Spectate.cs | Replays another player’s at-bat in co-op | Live Spectating |
AimBat.cs | The aim helper: gold curves at the ends of the barrel on the mouse aim | Batting Feedback |
BallEffectLook.cs | Colour, glow and trail of a special ball | Special Balls |
BallShadow.cs | The disc under the ball | Hit Physics |
BallSpin.cs | The ball model and its spin | Pitching |
BallTracer.cs | The glowing arc behind a batted ball | Hit Show |
BatCollision.cs | Bat-ball contact test (BatPose, BatContact) | Swing and Timing |
BatJiggle.cs | Springy wrist: the bat lags and wobbles | Swing and Timing |
BatSwing.cs | Bat shape and swing motion as a function of time | Swing and Timing |
BeanBatter.cs | Code-built bean batter | Characters and Rigs |
BeanRig.cs | Rigged bean model to Unity Humanoid; bean sockets | Characters and Rigs |
CosmeticBuilder.cs | CosmeticAnchor(s); builds code-built hats, glasses, shoes | Characters and Rigs |
CosmeticPop.cs | Scale bounce when an item lands | Characters and Rigs |
CosmeticWardrobe.cs | What a figure wears; hat knock-off | Characters and Rigs |
CountTracker.cs | Balls, strikes, outs (CountState) | Count and Outs |
DecoyBalls.cs | The Phantom’s fake balls that split off mid-flight | Special Balls, Pitchers and Bosses |
DevHits.cs | DevHit kinds for the dev menu’s TEST HITS, found from the park’s physics | Dev Menu and Shortcuts |
FitMeasurer.cs | Automatic cosmetic fit on a Humanoid | Fit Mode |
FlightCamera.cs | The TV-style camera that follows a batted ball (springs, bank, drift) | Hit Show |
FlyingHat.cs | A knocked-off hat tumbling and flying back | Characters and Rigs |
HitCounter.cs | The live distance counter’s state and score build-up | Hit Show |
HitPhysics.cs | Deterministic batted-ball flight, curve, bounces, wall, stands, scoreboard (HitOutcome) | Hit Physics |
HitTables.cs | Contact zones, exit velocity, launch odds, aim and curve numbers | Batting Explained |
HitTally.cs | A batted ball’s events along its flight and its score stack; the big-moment rule | Hit Show |
HumanBatter.cs | Animated Humanoid batter with IK | Characters and Rigs |
IBatterFigure.cs | Batter figure contract | Characters and Rigs |
InstantReplay.cs | Slow-motion replay of contact | At-Bat Loop |
NoodleArm.cs | Rubber-hose arm IK | Characters and Rigs |
RoundTypes.cs | RoundContext, PlayReport, RoundResult | At-Bat Loop |
SpectateFeed.cs | Spectator playback buffer | Live Spectating |
SwingInput.cs | Timestamped swing press, mouse aim and the held hit aim (WASD / arrows / stick) | Controls |
SwingLog.cs | Every pitch you see to swings.csv | Swing Log |
SwingResolver.cs | Contact to SwingResult: zone, grade, direction, launch, exit velocity, curve; green rule | Batting Explained, Swing and Timing |
SwingResult.cs | SwingOutcome, SwingResult | Swing and Timing |
Scripts/Core
| File | Role | Note |
|---|---|---|
CameraRig.cs | Batter, menu, cinematic, orbit and follow views | Rendering |
GameBootstrap.cs | Spawns the game after any scene loads | Boot and GameRoot |
GameEvents.cs | The event bus | Game Events |
GameRoot.cs | Composition root and navigation | Boot and GameRoot |
GameState.cs | The screen states | Game States and Screens |
HumanRig.cs | Spawn, size, loop clips and IK for Humanoids | Characters and Rigs |
PostFx.cs | Bloom, vignette, tonemapping volume | Rendering |
SeededRandom.cs | Deterministic RNG and Derive | Seeds and Determinism |
Visuals.cs | Toon materials, Toonify, primitives, lines | Rendering |
Scripts/Data
| File | Role | Note |
|---|---|---|
BallEffect.cs | BallEffect, BallModifier, BallEffects | Special Balls |
BallparkDefinition.cs | A park: walls, wind, gravity, targets, sky, ground, scoreboard spot | Ballparks |
BatModelLibrary.cs | Bat prefab per Bat upgrade and alignment | Characters and Rigs |
BatterDefinition.cs | A batter: stats, model, unlocks, level perks | Batters |
CallSignDefinition.cs | A name-tag title unlocked by account level | Call Signs |
CharacterFitProfile.cs | Hand-tuned sockets for one model | Fit Mode |
CharacterLibrary.cs | Batter / pitcher prefabs, clips, useBeans | Characters and Rigs |
ContentDatabase.cs | All content lists; LoadOrDefault | Architecture |
CosmeticDefinition.cs | A cosmetic: slot, style, prefab, offsets, price, level | Cosmetics |
DefaultContent.cs | All starter content built in code | Ballparks, Batters, Upgrades |
Difficulty.cs | Normal / Medium / Hard multipliers | Difficulty |
IndexCatalog.cs | IndexCategory, IndexEntry and every entry of the INDEX screen, built from content plus planned lines | Index Screen |
PitchTypeDefinition.cs | A pitch type: speed and break | Pitch Types |
PitcherDefinition.cs | A pitcher: repertoire, rates, boss modifiers | Pitchers and Bosses |
RunConfig.cs | Run length, goals, coin economy | Run Config |
SynergyDefinition.cs | A tag synergy and its bonus | Synergies |
UpgradeDefinition.cs | A shop item: slot, rarity, modifiers, tags | Upgrades |
Scripts/FitMode
| File | Role | Note |
|---|---|---|
FitModeView.cs | The Fit Mode panel and socket ring | Fit Mode |
FitOverrides.cs | JSON fit overrides loaded at boot | Fit Mode |
FitTargets.cs | Socket, item and bat targets | Fit Mode |
IFitTarget.cs | FitValues, IFitTarget | Fit Mode |
Scripts/Intro
| File | Role | Note |
|---|---|---|
CutsceneRunner.cs | Walks a list of Beats: auto beats, reading stops, wipes, fast-forward | Cutscenes |
IntroCamera.cs | Every cutscene camera shot and the easing curves | Cutscenes |
IntroGate.cs | Co-op: holds the first turn until every player is through the intro (or a deadline) | Cutscenes, Co-op Run Flow |
IntroScript.cs | The match intro’s beat list and lengths | Cutscenes |
MatchIntroCard.cs | The intro’s pre-formatted data: park, map bonuses, pitcher, lineup cards | Cutscenes |
MatchIntroDirector.cs | Plays the match intro, the walk-up, skip and dev preview | Cutscenes |
OutroCard.cs | OutroKind and the outro’s data: winning hit, line score, rewards | Cutscenes |
OutroDirector.cs | Plays BOSS DOWN, MAP BEATEN, GAME OVER: camera, crowd, board, fireworks, mood | Cutscenes |
OutroScript.cs | The outros’ beat lists and lengths | Cutscenes |
Scripts/Modes
| File | Role | Note |
|---|---|---|
BattingCage.cs | Endless practice on the at-bat | Batting Cage |
GameModes.cs | Solo, Co-op, Head-to-Head (not playable) | Core Loop, Co-op Overview |
Scripts/Net
| File | Role | Note |
|---|---|---|
INetTransport.cs | Star-network transport contract | Transports |
LocalTransport.cs | UDP transport with a reliable channel | Transports |
NetBuffers.cs | NetWriter, NetReader | Net Messages |
NetMessages.cs | MsgId, PlayerInfo, message builders | Net Messages |
NetRuntime.cs | Owns and polls the transport and session | Transports |
NetSession.cs | Co-op lobby: roster, version check, run start | Lobby and Session |
SteamTransport.cs | Steam lobby + relay; SteamOverlayJoin (needs HOMERUNDERBY_STEAM) | Transports |
Scripts/Pitching
| File | Role | Note |
|---|---|---|
BeanPitcher.cs | Bean pitcher figure | Characters and Rigs |
HumanPitcher.cs | Humanoid pitcher, clip or scripted delivery | Characters and Rigs |
IPitcherFigure.cs | Pitcher figure contract | Characters and Rigs |
PitchData.cs | One thrown pitch and its path (PositionAt) | Pitching |
PitcherAI.cs | Picks pitch type, location, speed, special ball | Pitching |
StrikeZone.cs | Zone size and random locations | Pitching |
Scripts/Progression
| File | Role | Note |
|---|---|---|
DailySeed.cs | Today’s UTC seed and date key | Daily Seed and Leaderboard |
Leaderboard.cs | ILeaderboardService, local boards | Daily Seed and Leaderboard |
Leveling.cs | Account and character XP curves | XP and Levels |
MetaProgression.cs | Unlocks, maps, XP awards, dev tools | Meta Progression |
RunSaveData.cs | The run checkpoint shape | Save System |
SaveData.cs | The save shape and GameSettings | Save System |
SaveSystem.cs | Crash-safe JSON files | Save System |
Scripts/Run
| File | Role | Note |
|---|---|---|
CoopRules.cs | Host referee for co-op rounds | Co-op Rules |
CoopRun.cs | A co-op run on this machine | Co-op Run Flow |
IRunDriver.cs | What in-run screens talk to | Architecture |
RunManager.cs | The solo run loop, checkpoints, dev run tools | Run Structure |
RunMapGenerator.cs | Builds the innings and picks pitchers | Run Structure |
RunNode.cs | One inning | Run Structure |
RunState.cs | The run in progress; goals; seeds | Run Structure, Seeds and Determinism |
RunSummary.cs | A finished run for results and XP | Run Structure |
Scripts/Stats
| File | Role | Note |
|---|---|---|
PlayerStats.cs | Sums modifiers into a stat value | Stats System |
StatModifier.cs | One change to one stat | Stats System |
StatType.cs | The stats, base values, names | Stats System |
Scripts/UI
| File | Role | Note |
|---|---|---|
BroadcastDraw.cs | The cutscenes’ TV-graphics kit | UI System, Cutscenes |
BuildPanel.cs | Coins, score, equipment, synergies, stats | UI System |
CoopWatchView.cs | Co-op screen while someone else bats | Co-op Run Flow |
CustomizeView.cs | Dress-up screen; hosts Fit Mode | Customization |
DevMenu.cs | F1 developer menu | Dev Menu and Shortcuts |
DisplaySettings.cs | Applies fullscreen, resolution, V-Sync, FPS cap | Save System |
FpsCounter.cs | FPS counter overlay | UI System |
GreenFeedback.cs | Camera shake on a green | GREEN Swings |
HitCounterView.cs | Draws the live hit counter, GONE!, chips and the score build-up | Hit Show |
HudView.cs | In-round HUD | At-Bat Loop |
IndexView.cs | The INDEX screen | Index Screen |
IntroOverlayView.cs | The match intro’s graphics and the walk-up transition | Cutscenes |
LobbyNav.cs | Top bar and its popups | UI System |
LobbyView.cs | Co-op lobby screen | Lobby and Session |
MainMenuView.cs | Title screen | Game States and Screens |
MapSelectView.cs | The ballpark carousel: map and difficulty picker | Map Select and Unlocks |
NetTestView.cs | NET TEST transport overlay | Transports |
OutroOverlayView.cs | The end-of-game cutscenes’ graphics | Cutscenes |
ParkSnapshots.cs | Ballpark pictures for the map-select cards | UI System, Map Select and Unlocks |
RunMapView.cs | Between-innings screen (and the Editor-only cutscene preview keys) | Run Structure |
RunOverView.cs | Results and XP bars | Run Structure, XP and Levels |
ScreenFade.cs | Fade-in on screen change | UI System |
SettingsView.cs | The options | Add a Setting |
ShopView.cs | Between-innings shop | Shop and Economy |
ThumbnailRenderer.cs | Item pictures for Customize | UI System |
TimingIndicator.cs | The swing-timing ring | Swing and Timing |
TimingWindowScanner.cs | Finds contact and green press times | Swing and Timing |
UIRoot.cs | Picks the view; pause | Game States and Screens |
Theme/UIDraw.cs | Drawing toolkit | UI System |
Theme/UIGlyphs.cs | Vector icons | UI System |
Theme/UITextures.cs | Generated rounded textures | UI System |
Theme/UITheme.cs | Colours, scale, font | UI System |
Scripts/Upgrades
| File | Role | Note |
|---|---|---|
ShopService.cs | Offers, buying, rerolls | Shop and Economy |
SynergyResolver.cs | Active synergies from tags | Upgrades and Synergies |
Editor
| File | Role | Note |
|---|---|---|
BallEffectTest.cs | Special-ball, boss-ball and decoy test | Editor Tools and Tests |
BattingModelTest.cs | Batting model test | Editor Tools and Tests, Batting Explained |
BuildPlayer.cs | Windows Player (zip) | Build and Release |
ContentExporter.cs | Export Default Content; Delete Save File | Editor Tools and Tests |
CoopRulesTest.cs | Co-op referee test | Editor Tools and Tests |
FitProfileTools.cs | Generate Fit Profile For Batter | Fit Mode |
HitTallyTest.cs | Hit counter, flight camera and TEST HITS test | Editor Tools and Tests, Hit Show |
MatchIntroTest.cs | Match intro test | Editor Tools and Tests, Cutscenes |
MatchIntroTools.cs | Preview Match Intro / Preview Outro menu items | Cutscenes |
NetSelfTest.cs | Local transport test | Editor Tools and Tests |
NetSessionTest.cs | Lobby session test | Editor Tools and Tests |
OutroTest.cs | End-of-game cutscenes test | Editor Tools and Tests, Cutscenes |
ParkDressingTools.cs | Dressing inspector; Bake Park Dressing | Ballpark Building |
ProgressionXpTest.cs | XP and levels test | Editor Tools and Tests |
RunStructureTest.cs | Run structure test | Editor Tools and Tests |
ScoreboardSmashTest.cs | Scoreboard test and Play-mode smash | Scoreboard |
SkyShaderInclude.cs | Keeps the sky shader in builds | Rendering |
SpectateFeedTest.cs | Spectator buffer test | Editor Tools and Tests |
SteamSetup.cs | Enable / Disable Steam | Build and Release |
UrpSetup.cs | Set Up URP | Rendering |
Outside the code folders
| Path | Role | Note |
|---|---|---|
Assets/_Project/Resources/Shaders/BeanToon.shader | The toon shader | Rendering |
Assets/_Project/Resources/CharacterLibrary.asset, BatModelLibrary.asset | Character and bat libraries | Characters and Rigs |
Assets/_Project/Resources/Characters/, Props/, Ball/ | Rigged beans, park props, ball model | Characters and Rigs, Ballpark Building |
Assets/_Project/Settings/ | URP pipeline and renderer assets | Rendering |
Assets/_Project/Content/Characters/ | The library batter’s fit profile | Fit Mode |
Assets/Plugins/Steamworks/ | Facepunch.Steamworks DLLs | Build and Release |
Tools/Blender/ | Bean, farm kit and moon kit generators | Characters and Rigs |
docs/MULTIPLAYER-PLAN.md | The co-op design plan | Co-op Overview |
Gotchas
AtBatControlleris split across four files (partial class): the main loop,AtBatController.Spectate.cs(co-op spectating),AtBatController.HitShow.cs(the hit show) andAtBatController.Outro.cs(cutscene staging).Fireworks.cslives inBallparks/but is not built with the park:OutroDirectoradds it to[Game].SteamTransport.csalso holdsSteamOverlayJoin; both compile only withHOMERUNDERBY_STEAM.- Some class comments are older than the code (for example
GameModes.csstill says co-op is not playable;CoopMode.IsAvailableis true). Trust the code.
Related
- Architecture: how the folders fit together
- All Notes: every wiki note