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

PartWhat it addsState in 1.0.0
FightsFight packs: a chart in beats plus a songWorks
MusicAnother song for a fight that is already in the game: a recording, or a score for the game’s bandWorks
LooksHow a boxer is drawn: skin, build, hair, trunks, bootsWorks
ArenaColours of the arena: background, fog, lamps, lightsColours work. Signs and textures are planned
CuesColours of the two hands and of his punchesColours are wired. Sizes are planned
CampaignExtra campaign levels that play a fight or one round of itWorks
ScriptsOne JavaScript file that listens to game eventsWorks, after the player allows it

Three ways to load a mod

  1. 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.
  2. 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.
  3. 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.