Code Map

In short

All game code is in Assets/_Project/Scripts/ (assembly HomeRunDerby), all editor tooling in Assets/_Project/Editor/ (assembly HomeRunDerby.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:

FolderWhat lives thereMain note
Scripts/Audio/Code-synthesized sound and the event-to-sound glueAudio
Scripts/Ballparks/Building parks, the scoreboard, scoring, skyBallpark Building
Scripts/Batting/The at-bat, swing, bat, ball flight, batter figures, cosmetics on figuresAt-Bat Loop
Scripts/Core/Boot, composition root, events, RNG, camera, visualsArchitecture
Scripts/Data/ScriptableObject definitions and DefaultContentBallparks, Upgrades
Scripts/FitMode/The dev-only fit editorFit Mode
Scripts/Intro/The match intro and the end-of-game cutscenes (namespace HomeRunDerby.Intro)Cutscenes
Scripts/Modes/Game modes and the batting cageBatting Cage
Scripts/Net/Transports, lobby session, messagesCo-op Overview
Scripts/Pitching/Pitch choice, pitch path, strike zone, pitcher figuresPitching
Scripts/Progression/Saves, meta unlocks, XP, daily seed, leaderboardMeta Progression
Scripts/Run/Solo and co-op run drivers, run state, inningsRun Structure
Scripts/Stats/The stat stacking systemStats System
Scripts/UI/IMGUI views, theme, overlaysUI System
Scripts/Upgrades/Shop and synergiesShop and Economy
Editor/Tools menu, tests, build, setupEditor Tools and Tests

Scripts/Audio

FileRoleNote
AudioSynth.csDSP kit: oscillators, noise, filters, envelopes, mixing, ToClipAudio
BallparkOrgan.csThe organ loop and the “Charge!” fanfare from note tablesAudio
GameAudio.csTurns GameEvents into sounds; UI sound one-linersAudio
SoundBank.csBuilds and caches every sound effectAudio

Scripts/Ballparks

FileRoleNote
BallparkBuilder.csBuilds a park from its definitionBallpark Building
BallparkMath.csFeet/metres, polar field coordinates, FlightEnvironmentHit Physics
Fireworks.csCode-built HDR fireworks, dust and confetti for the outrosBallpark Building, Cutscenes
MeteorShower.csVisual meteors for the moon’s Meteor Shower bonusBallpark Building
ParkDressing.csProps around the field: prefab or code layout, glow, spin/yaw/bobBallpark Building
ParkLayouts.csCode layouts of the farm and moon propsBallpark Building
ParkTextures.csGenerated grass, dirt and regolith texturesRendering
ScoreCalculator.csHome run score: distance x target x HR multiplier x greenScoring
Scoreboard.csThe center-field scoreboard and its smashingScoreboard
SkyBuilder.csProcedural sky per SkyPreset, ambient from skyRendering
StadiumAmbience.csFlags, clouds, gullsBallpark Building
StadiumCrowd.csStands and the GPU-instanced crowdBallpark Building
StadiumLayout.csStand geometry shared with the ball physicsBallpark Building

Scripts/Batting

FileRoleNote
AtBatController.csOne round: pitch, swing, flight, count, scoreAt-Bat Loop
AtBatController.HitShow.csThe hit show: live counter, tracer, flight camera, big-moment replayHit Show
AtBatController.Outro.csStages batter, pitcher and replay ball for the outrosCutscenes, Characters and Rigs
AtBatController.Spectate.csReplays another player’s at-bat in co-opLive Spectating
AimBat.csThe aim helper: gold curves at the ends of the barrel on the mouse aimBatting Feedback
BallEffectLook.csColour, glow and trail of a special ballSpecial Balls
BallShadow.csThe disc under the ballHit Physics
BallSpin.csThe ball model and its spinPitching
BallTracer.csThe glowing arc behind a batted ballHit Show
BatCollision.csBat-ball contact test (BatPose, BatContact)Swing and Timing
BatJiggle.csSpringy wrist: the bat lags and wobblesSwing and Timing
BatSwing.csBat shape and swing motion as a function of timeSwing and Timing
BeanBatter.csCode-built bean batterCharacters and Rigs
BeanRig.csRigged bean model to Unity Humanoid; bean socketsCharacters and Rigs
CosmeticBuilder.csCosmeticAnchor(s); builds code-built hats, glasses, shoesCharacters and Rigs
CosmeticPop.csScale bounce when an item landsCharacters and Rigs
CosmeticWardrobe.csWhat a figure wears; hat knock-offCharacters and Rigs
CountTracker.csBalls, strikes, outs (CountState)Count and Outs
DecoyBalls.csThe Phantom’s fake balls that split off mid-flightSpecial Balls, Pitchers and Bosses
DevHits.csDevHit kinds for the dev menu’s TEST HITS, found from the park’s physicsDev Menu and Shortcuts
FitMeasurer.csAutomatic cosmetic fit on a HumanoidFit Mode
FlightCamera.csThe TV-style camera that follows a batted ball (springs, bank, drift)Hit Show
FlyingHat.csA knocked-off hat tumbling and flying backCharacters and Rigs
HitCounter.csThe live distance counter’s state and score build-upHit Show
HitPhysics.csDeterministic batted-ball flight, curve, bounces, wall, stands, scoreboard (HitOutcome)Hit Physics
HitTables.csContact zones, exit velocity, launch odds, aim and curve numbersBatting Explained
HitTally.csA batted ball’s events along its flight and its score stack; the big-moment ruleHit Show
HumanBatter.csAnimated Humanoid batter with IKCharacters and Rigs
IBatterFigure.csBatter figure contractCharacters and Rigs
InstantReplay.csSlow-motion replay of contactAt-Bat Loop
NoodleArm.csRubber-hose arm IKCharacters and Rigs
RoundTypes.csRoundContext, PlayReport, RoundResultAt-Bat Loop
SpectateFeed.csSpectator playback bufferLive Spectating
SwingInput.csTimestamped swing press, mouse aim and the held hit aim (WASD / arrows / stick)Controls
SwingLog.csEvery pitch you see to swings.csvSwing Log
SwingResolver.csContact to SwingResult: zone, grade, direction, launch, exit velocity, curve; green ruleBatting Explained, Swing and Timing
SwingResult.csSwingOutcome, SwingResultSwing and Timing

Scripts/Core

FileRoleNote
CameraRig.csBatter, menu, cinematic, orbit and follow viewsRendering
GameBootstrap.csSpawns the game after any scene loadsBoot and GameRoot
GameEvents.csThe event busGame Events
GameRoot.csComposition root and navigationBoot and GameRoot
GameState.csThe screen statesGame States and Screens
HumanRig.csSpawn, size, loop clips and IK for HumanoidsCharacters and Rigs
PostFx.csBloom, vignette, tonemapping volumeRendering
SeededRandom.csDeterministic RNG and DeriveSeeds and Determinism
Visuals.csToon materials, Toonify, primitives, linesRendering

Scripts/Data

FileRoleNote
BallEffect.csBallEffect, BallModifier, BallEffectsSpecial Balls
BallparkDefinition.csA park: walls, wind, gravity, targets, sky, ground, scoreboard spotBallparks
BatModelLibrary.csBat prefab per Bat upgrade and alignmentCharacters and Rigs
BatterDefinition.csA batter: stats, model, unlocks, level perksBatters
CallSignDefinition.csA name-tag title unlocked by account levelCall Signs
CharacterFitProfile.csHand-tuned sockets for one modelFit Mode
CharacterLibrary.csBatter / pitcher prefabs, clips, useBeansCharacters and Rigs
ContentDatabase.csAll content lists; LoadOrDefaultArchitecture
CosmeticDefinition.csA cosmetic: slot, style, prefab, offsets, price, levelCosmetics
DefaultContent.csAll starter content built in codeBallparks, Batters, Upgrades
Difficulty.csNormal / Medium / Hard multipliersDifficulty
IndexCatalog.csIndexCategory, IndexEntry and every entry of the INDEX screen, built from content plus planned linesIndex Screen
PitchTypeDefinition.csA pitch type: speed and breakPitch Types
PitcherDefinition.csA pitcher: repertoire, rates, boss modifiersPitchers and Bosses
RunConfig.csRun length, goals, coin economyRun Config
SynergyDefinition.csA tag synergy and its bonusSynergies
UpgradeDefinition.csA shop item: slot, rarity, modifiers, tagsUpgrades

Scripts/FitMode

FileRoleNote
FitModeView.csThe Fit Mode panel and socket ringFit Mode
FitOverrides.csJSON fit overrides loaded at bootFit Mode
FitTargets.csSocket, item and bat targetsFit Mode
IFitTarget.csFitValues, IFitTargetFit Mode

Scripts/Intro

FileRoleNote
CutsceneRunner.csWalks a list of Beats: auto beats, reading stops, wipes, fast-forwardCutscenes
IntroCamera.csEvery cutscene camera shot and the easing curvesCutscenes
IntroGate.csCo-op: holds the first turn until every player is through the intro (or a deadline)Cutscenes, Co-op Run Flow
IntroScript.csThe match intro’s beat list and lengthsCutscenes
MatchIntroCard.csThe intro’s pre-formatted data: park, map bonuses, pitcher, lineup cardsCutscenes
MatchIntroDirector.csPlays the match intro, the walk-up, skip and dev previewCutscenes
OutroCard.csOutroKind and the outro’s data: winning hit, line score, rewardsCutscenes
OutroDirector.csPlays BOSS DOWN, MAP BEATEN, GAME OVER: camera, crowd, board, fireworks, moodCutscenes
OutroScript.csThe outros’ beat lists and lengthsCutscenes

Scripts/Modes

FileRoleNote
BattingCage.csEndless practice on the at-batBatting Cage
GameModes.csSolo, Co-op, Head-to-Head (not playable)Core Loop, Co-op Overview

Scripts/Net

FileRoleNote
INetTransport.csStar-network transport contractTransports
LocalTransport.csUDP transport with a reliable channelTransports
NetBuffers.csNetWriter, NetReaderNet Messages
NetMessages.csMsgId, PlayerInfo, message buildersNet Messages
NetRuntime.csOwns and polls the transport and sessionTransports
NetSession.csCo-op lobby: roster, version check, run startLobby and Session
SteamTransport.csSteam lobby + relay; SteamOverlayJoin (needs HOMERUNDERBY_STEAM)Transports

Scripts/Pitching

FileRoleNote
BeanPitcher.csBean pitcher figureCharacters and Rigs
HumanPitcher.csHumanoid pitcher, clip or scripted deliveryCharacters and Rigs
IPitcherFigure.csPitcher figure contractCharacters and Rigs
PitchData.csOne thrown pitch and its path (PositionAt)Pitching
PitcherAI.csPicks pitch type, location, speed, special ballPitching
StrikeZone.csZone size and random locationsPitching

Scripts/Progression

FileRoleNote
DailySeed.csToday’s UTC seed and date keyDaily Seed and Leaderboard
Leaderboard.csILeaderboardService, local boardsDaily Seed and Leaderboard
Leveling.csAccount and character XP curvesXP and Levels
MetaProgression.csUnlocks, maps, XP awards, dev toolsMeta Progression
RunSaveData.csThe run checkpoint shapeSave System
SaveData.csThe save shape and GameSettingsSave System
SaveSystem.csCrash-safe JSON filesSave System

Scripts/Run

FileRoleNote
CoopRules.csHost referee for co-op roundsCo-op Rules
CoopRun.csA co-op run on this machineCo-op Run Flow
IRunDriver.csWhat in-run screens talk toArchitecture
RunManager.csThe solo run loop, checkpoints, dev run toolsRun Structure
RunMapGenerator.csBuilds the innings and picks pitchersRun Structure
RunNode.csOne inningRun Structure
RunState.csThe run in progress; goals; seedsRun Structure, Seeds and Determinism
RunSummary.csA finished run for results and XPRun Structure

Scripts/Stats

FileRoleNote
PlayerStats.csSums modifiers into a stat valueStats System
StatModifier.csOne change to one statStats System
StatType.csThe stats, base values, namesStats System

Scripts/UI

FileRoleNote
BroadcastDraw.csThe cutscenes’ TV-graphics kitUI System, Cutscenes
BuildPanel.csCoins, score, equipment, synergies, statsUI System
CoopWatchView.csCo-op screen while someone else batsCo-op Run Flow
CustomizeView.csDress-up screen; hosts Fit ModeCustomization
DevMenu.csF1 developer menuDev Menu and Shortcuts
DisplaySettings.csApplies fullscreen, resolution, V-Sync, FPS capSave System
FpsCounter.csFPS counter overlayUI System
GreenFeedback.csCamera shake on a greenGREEN Swings
HitCounterView.csDraws the live hit counter, GONE!, chips and the score build-upHit Show
HudView.csIn-round HUDAt-Bat Loop
IndexView.csThe INDEX screenIndex Screen
IntroOverlayView.csThe match intro’s graphics and the walk-up transitionCutscenes
LobbyNav.csTop bar and its popupsUI System
LobbyView.csCo-op lobby screenLobby and Session
MainMenuView.csTitle screenGame States and Screens
MapSelectView.csThe ballpark carousel: map and difficulty pickerMap Select and Unlocks
NetTestView.csNET TEST transport overlayTransports
OutroOverlayView.csThe end-of-game cutscenes’ graphicsCutscenes
ParkSnapshots.csBallpark pictures for the map-select cardsUI System, Map Select and Unlocks
RunMapView.csBetween-innings screen (and the Editor-only cutscene preview keys)Run Structure
RunOverView.csResults and XP barsRun Structure, XP and Levels
ScreenFade.csFade-in on screen changeUI System
SettingsView.csThe optionsAdd a Setting
ShopView.csBetween-innings shopShop and Economy
ThumbnailRenderer.csItem pictures for CustomizeUI System
TimingIndicator.csThe swing-timing ringSwing and Timing
TimingWindowScanner.csFinds contact and green press timesSwing and Timing
UIRoot.csPicks the view; pauseGame States and Screens
Theme/UIDraw.csDrawing toolkitUI System
Theme/UIGlyphs.csVector iconsUI System
Theme/UITextures.csGenerated rounded texturesUI System
Theme/UITheme.csColours, scale, fontUI System

Scripts/Upgrades

FileRoleNote
ShopService.csOffers, buying, rerollsShop and Economy
SynergyResolver.csActive synergies from tagsUpgrades and Synergies

Editor

FileRoleNote
BallEffectTest.csSpecial-ball, boss-ball and decoy testEditor Tools and Tests
BattingModelTest.csBatting model testEditor Tools and Tests, Batting Explained
BuildPlayer.csWindows Player (zip)Build and Release
ContentExporter.csExport Default Content; Delete Save FileEditor Tools and Tests
CoopRulesTest.csCo-op referee testEditor Tools and Tests
FitProfileTools.csGenerate Fit Profile For BatterFit Mode
HitTallyTest.csHit counter, flight camera and TEST HITS testEditor Tools and Tests, Hit Show
MatchIntroTest.csMatch intro testEditor Tools and Tests, Cutscenes
MatchIntroTools.csPreview Match Intro / Preview Outro menu itemsCutscenes
NetSelfTest.csLocal transport testEditor Tools and Tests
NetSessionTest.csLobby session testEditor Tools and Tests
OutroTest.csEnd-of-game cutscenes testEditor Tools and Tests, Cutscenes
ParkDressingTools.csDressing inspector; Bake Park DressingBallpark Building
ProgressionXpTest.csXP and levels testEditor Tools and Tests
RunStructureTest.csRun structure testEditor Tools and Tests
ScoreboardSmashTest.csScoreboard test and Play-mode smashScoreboard
SkyShaderInclude.csKeeps the sky shader in buildsRendering
SpectateFeedTest.csSpectator buffer testEditor Tools and Tests
SteamSetup.csEnable / Disable SteamBuild and Release
UrpSetup.csSet Up URPRendering

Outside the code folders

PathRoleNote
Assets/_Project/Resources/Shaders/BeanToon.shaderThe toon shaderRendering
Assets/_Project/Resources/CharacterLibrary.asset, BatModelLibrary.assetCharacter and bat librariesCharacters and Rigs
Assets/_Project/Resources/Characters/, Props/, Ball/Rigged beans, park props, ball modelCharacters and Rigs, Ballpark Building
Assets/_Project/Settings/URP pipeline and renderer assetsRendering
Assets/_Project/Content/Characters/The library batter’s fit profileFit Mode
Assets/Plugins/Steamworks/Facepunch.Steamworks DLLsBuild and Release
Tools/Blender/Bean, farm kit and moon kit generatorsCharacters and Rigs
docs/MULTIPLAYER-PLAN.mdThe co-op design planCo-op Overview

Gotchas

  • AtBatController is split across four files (partial class): the main loop, AtBatController.Spectate.cs (co-op spectating), AtBatController.HitShow.cs (the hit show) and AtBatController.Outro.cs (cutscene staging).
  • Fireworks.cs lives in Ballparks/ but is not built with the park: OutroDirector adds it to [Game].
  • SteamTransport.cs also holds SteamOverlayJoin; both compile only with HOMERUNDERBY_STEAM.
  • Some class comments are older than the code (for example GameModes.cs still says co-op is not playable; CoopMode.IsAvailable is true). Trust the code.