You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
# Final10-Countdown — Puck mod
Displays a big on-screen countdown during the **last 10 seconds** of any period (configurable),
and plays a **beep for each of the last 5 seconds** (configurable; countdown turns red for
those). Each number animates in — it starts oversized and transparent, then scales down to
regular size while fading in. Numbers are rendered in
[Graduate](https://fonts.google.com/specimen/Graduate) (SIL Open Font License, see
`assets/OFL.txt`), a varsity block font in the style of hockey jersey numbers; if the TTF is
missing next to the DLL, the mod falls back to the default bold font.
## Settings (Mod Hub)
Options are exposed through the in-game **Mod Hub** menu (the framework provided by Ponce's
mods, e.g. Player QOL): open `MOD HUB` from the main or pause menu → `FINAL10-COUNTDOWN`.
- Countdown enabled (master on/off)
- Font size
- Vertical position (% from top)
- Countdown starts at (seconds remaining when the numbers appear)
- Beep for last (how many trailing seconds beep — 0 disables the beeps)
- Beep volume
- Beep sound (Sine, Buzzer, Chirp, Double — cycle with ◀ ▶, plays a preview on each change).
Defaults to Buzzer: a pure sine reads as soft even at full volume, so the beeps are
synthesized as louder square/swept waveforms.
- Outline width
- One-minute warning (its own panel section) → Play audio + Volume, Show text + Text size + Text
position (independent toggles; turning a toggle on, or dragging the text sliders, previews it).
Fires once when the period clock crosses 60s during play.
Plus **Preview** (runs a fake countdown so you can see your changes live), **Reset**, and
**Close**. Changes apply live and persist to
`config/ModHub/Final10Countdown/settings.json` ([CountdownSettings.cs](src/CountdownSettings.cs)).
The Mod Hub is Ponce's `PonceMods.Shared.ModMenuHub` framework, not base-game code. This mod
plugs into it purely by **reflection** ([ModHubIntegration.cs](src/ModHubIntegration.cs)) — it
bundles none of that framework's code. If no Ponce mod is installed there is no hub button, but
the countdown still runs and its settings can be edited by hand in the JSON file above.
## How it works
- The game replicates a `GameState` network variable (`Phase`, `Tick`, `Period`, scores).
`Tick` is the game clock in seconds remaining, decremented once per second by the server.
- Every change fires the `Event_Everyone_OnGameStateChanged` event through Puck's
`EventManager` — the mod listens to it ([CountdownBehaviour.cs](src/CountdownBehaviour.cs)).
- When `Phase == Play` and `Tick` is within the configured countdown window, a UI Toolkit
`Label` is shown on top of the game's own `UIDocument` (so it follows the game's UI scale).
Inside the beep window a procedurally generated sine beep is played through `UIManager`'s
audio source (so it respects the UI volume setting).
- The countdown hides automatically when the phase changes (goal, period end, etc.) or
when the game UI is hidden via the game's own setting.
- A separate **one-minute warning** fires once as the clock crosses 60s in play: a voice
clip (`assets/oneminuteremaining.wav`) and/or an on-screen "ONE MINUTE REMAINING" text, each
independently toggled. The WAV is parsed directly (`ParseWav`, 8/16/24/32-bit PCM + float) and
loudness-maximized (normalize + tanh soft-limit in `Maximize`) so the voice's average level
matches the square-wave beeps — a raw voice recording has hot peaks but a low RMS, so it sounds
quiet otherwise. The voice (with its own volume slider) and the beeps both play through one
shared AudioSource routed to the **Master** mixer group (resolved by reflection from
`AudioManager`), not the game's quiet UI audio source.
Note: the current game version loads plugins via the `IPuckPlugin` interface
(`bool OnEnable()` / `bool OnDisable()`), not the `IPuckMod` name used in older wiki pages.
## Build
```
dotnet build
```
Requires the game installed at the path set in `` in
[Final10Countdown.csproj](Final10Countdown.csproj) (currently `D:\SteamLibrary\steamapps\common\Puck`).
The build automatically copies `Final10Countdown.dll` into `\Plugins\Final10Countdown\`,
where the game picks it up on launch (local plugins are enabled by default — check the
MODS menu in game).
## Test
1. Build, then launch Puck.
2. Check `\Logs\Puck.log` for `[Final10Countdown] Enabled`.
3. Host a practice/local game; when the period clock goes under 0:10 the countdown appears,
and beeps play from 5 down to 1.
## Tweaks
Most knobs are in the in-game settings panel (see above). For things not exposed there,
constants at the top of [CountdownBehaviour.cs](src/CountdownBehaviour.cs): `TransitionDuration`
(0.4 s) and `StartScale` (1.8×) for the scale-down/fade-in animation, and the urgent/normal
colors. The beep waveforms are synthesized in `GenerateSamples`. Setting defaults and ranges
live in [CountdownSettings.cs](src/CountdownSettings.cs).
## Preview image
[preview.png](preview.png) is the Steam Workshop preview (1024×1024, ~230 KB) — a 3D jersey-style
"FINAL10 / COUNTDOWN" title over a stylized center-ice rink. It is generated programmatically by
the tool in `tools/PreviewGen` (SkiaSharp, uses the same Graduate font as the title):
```
dotnet run --project tools/PreviewGen
```
When publishing to the Workshop, place this image in the uploader's `WorkshopContent` directory.
## Repo layout
- `src/` — mod source: plugin entry, countdown behaviour, settings model, settings panel,
Mod Hub integration
- `assets/` — jersey font (Graduate) + OFL license and the one-minute warning MP3, all deployed
next to the DLL
- `tools/PreviewGen/` — standalone net10 SkiaSharp tool that renders `preview.png`
- `preview.png` — generated Steam Workshop preview image
- `decompiled/` — ILSpy decompilation of the game's `Puck.dll`, for API reference only
(excluded from the build)
- `ref-playerqol/` — ILSpy decompilation of the Player QOL mod, used only to learn the Mod Hub
API (excluded from the build; not redistributed)
# Puck_Final10countdown_mod