Mods
Counterbeat is a web page. There is no binary to patch, so a mod is a folder of files the game knows how to read: JSON for content, and one optional JavaScript file for behaviour.
What a mod can change
| Part | What it adds | State in 1.0.0 |
|---|---|---|
| Fights | Fight packs: a chart in beats plus a song | Works |
| Music | Another song for a fight that is already in the game: a recording, or a score for the game’s band | Works |
| Looks | How a boxer is drawn: skin, build, hair, trunks, boots | Works |
| Arena | Colours of the arena: background, fog, lamps, lights | Colours work. Signs and textures are planned |
| Cues | Colours of the two hands and of his punches | Colours are wired. Sizes are planned |
| Campaign | Extra campaign levels that play a fight or one round of it | Works |
| Scripts | One JavaScript file that listens to game events | Works, after the player allows it |
Three ways to load a mod
- A link. Add
?mod=and the address of the mod to the game’s address. The mod lasts for that visit and is not stored. - The MODS panel on the start screen. ADD MOD takes the mod’s files or one zip of the folder. The mod is stored in the browser and comes back on every visit.
- A mod index. BROWSE lists the mods in an index file, and INSTALL stores one.
On a Quest, do this before pressing ENTER VR. There is no MODS screen inside the headset yet. Storage is per browser and per site, so a mod installed on the desktop is not on the headset.
Fight packs and your own music
A fight pack is one fight.json, with one audio file or with a song for the game’s own band written into it. The times in the pack are counted in beats of the song, so a punch written on beat 12 is cued on beat 12 of the music at any tempo.
You can also play a fight that is already in the game to your own recording. You give the song’s BPM and the time of its first beat.
Only share music you have the right to share.
Scripts and trust
A script runs with the same privileges as the game. It can read the page and the browser storage for this site, and it can send requests. Scripts are not sandboxed.
- A script never runs because a link named it. The start screen shows the mod’s name, its author and where it came from, with ALLOW SCRIPT and NOT NOW.
- The permission is for that exact script text. If the file changes, the game asks again.
- A fight with a script running is marked MODDED on the results card and does not record campaign progress.
- Only allow scripts from people you trust. A script is one file, so read it first.
When a mod is broken
The game checks every mod when the page loads. A mod with a missing requirement or a bad manifest is not loaded, and the MODS panel says why. If one file is bad, that one fight, song or level is left out and the rest of the mod loads. Other mods and the game itself are not affected.
Tools
The project has command-line tools that start a new mod folder and check one before you share it. The modding guide lists them.
The full guides
These three pages are the project’s own guides, shown in full. They are written for people who will edit files.