Modding for power users

You know how mods work elsewhere and want the exact rules. This page states what loads when, which mod wins a conflict, what a visitor sees, how compatibility is kept and how to ship from your own tooling. Each section links to the detail.

The model in five lines #

  1. A mod is a ZIP with a mod.json. The game checks it at install and reads it once at start. No mod is read in the middle of play.
  2. Content is data in typed formats, named under content: "textures", "messages", "shops", "items", "letters", "calendar" and "talk". Logic is Lua 5.4 in a sandbox with no files, no network and no code loading.
  3. Scripts answer 20 kinds of event with data. They change the game only through commands (send_letter, give_item, show_line, ask, take_item, take_bells, save, set_weather, play_sound, set_shop_goods, set_shop_open, set_hat, set_shirt and react). A mod declares its commands in mod.json, and the game applies them between frames.
  4. Every mod names its API level, "api": 1 today. The game runs level 1. The game tells the player clearly when a mod is too old or too new.
  5. Players only ever download our reviewed, hashed copy of a shared mod.

Load order and who wins #

The Mods tab lists installed mods in load order. The arrows change the order, and depends moves a mod below what it needs. The rule differs by content.

ContentTwo mods touch the same thing
TexturesThe mod lower in the list wins. Any mod beats the HD texture pack.
The flower shop, Nook's stockThe mod lower in the list wins.
Talk linesEach place in a talk takes one line. The first mod (highest in the list) whose villager_talked handler returns a line for a place takes it. Every mod's handler runs, until a conversation takes the whole talk.
command_finished, question_answered, data_migrated, timer_fired, villager_answeredEach goes to one mod. A result or an answer goes to the mod that asked. data_migrated goes to the mod whose data version moved. timer_fired goes to the mod that set the timer. villager_answered goes to the mod whose conversation asked.
Other eventsEvery mod's handlers run, in list order.
Messages, letters, itemsEach mod's names are its own (id:key), so they never collide.

The two rules run in opposite directions for a reason. A texture or a shop has one slot. Each mod in turn writes its version over the one before, so the lowest mod's version stays. A talk is a question the game asks each mod in turn, and it uses the first answer. Move your mod down to make its shop win. Move it up to make its script's lines win. Talk pools are not ranked: they fill the places no script took, and every mod's lines for a place go in together. See when two mods want the same talk.

A mod can also refuse to run beside another. See conflicts in Dependencies.

Just you mods and World mods, visits and The City #

  • A Just you mod ("scope": "client"): only the player who installed it sees it.
  • A World mod ("scope": "world"): it changes the town for visitors too. A shop and a bulletin board notice must be in a World mod. A Just you mod with one is refused.
  • A friend visit needs both towns to have the same World mods that count, in the same versions and the same order, or none. Just you mods never block a visit. A visitor can load the host's published World mods for one visit.
  • In The City, the shops and board notices of World mods are switched off, mod items are off, and every command is refused. Textures, lines and scripts keep running.

The detail is in Multiplayer and The City.

Compatibility #

  • api is required in every mod.json. A mod made for a level the game no longer runs shows made for an older game on its row. A mod made for a level above the game's shows needs a newer game. Neither loads, and nothing else breaks.
  • A level is read for at least 12 months after the next level ships.
  • An API feature is deprecated before it is removed, for at least two more levels and at least 90 days, whichever is later. Old levels keep running through shims that log a deprecation once. Nothing outside the published reference is promised.
  • "game" and "save" are reserved for planned features. A mod.json with either is refused at every level, so no mod can rely on a rule nothing enforces.
  • Any other key the game does not know is refused too, with the closest key named: mod.json: unknown key "permisions" (did you mean "permissions"?).

The detail is in API levels and the changelog.

Your own tooling #

A mod is plain files, so any build setup works. Keep the source in git, generate textures with a script or run a formatter. The game needs only the ZIP. Every check it applies is on Limits and in the guides. The game checks the same rules in the player's browser as the site does at upload. The JSON schemas and Lua type hints (Downloads) plug into any editor.

  • Publishing from GitHub: paste github.com/you/your-mod@v1.2.0 under Import from GitHub in the Mods tab's Share a mod, instead of uploading a ZIP. It shows there once you have entered a two-factor code, under the upload form. The site fetches that tag once, builds it and records where it came from. Players still get only our reviewed copy. See Publishing.
  • playac-mod pack makes the same bytes every time and prints the content hash, so CI can build and compare releases.
  • The Mods tab's share section shows the state of each version you uploaded, and withdraws or lists one again.
  • A library and a mod that needs it: developer mode loads one folder, and that copy counts as installed for depends. Install one of the two from its ZIP and load the other in developer mode, either way round (one folder at a time). A library lists what it offers in exports. See exports.

All of this needs the game running with a town loaded. The game runs from your own disc file. See Your disc and Set up your computer.

Get the playac-mod tool (optional) #

playac-mod is a command line tool that checks a mod folder with the game's own rules, reloads it in the game as you save, and packs the ZIP. It needs Node.js 18.17 or newer (free, from nodejs.org; node --version says which you have). Nothing on this path needs it: installing a ZIP in the Mods tab runs the same checks.

terminal
npm install -g https://github.com/Play-AC-Online/playac-mods/releases/download/cli-v1.1.0/playac-mod-1.1.0.tgz
cd my-mod            # your mod's folder
playac-mod check     # every rule the game checks, each problem with its file
playac-mod dev       # serve the folder to the game's developer mode (see Testing)
playac-mod pack      # the ZIP to install or share, the same bytes every time

Every command and option is on The playac-mod tool.

Keep a mod in a GitHub repository #

Start from an example repository: each is laid out as a mod repository of yours. Or copy a starter kit into a new one.

  • CHANGELOG.md, if you like: one ## 1.2.0 section per version. The GitHub import sends that section as the version's changelog line, which is optional. It is never packed into the mod, so editing it does not change the content hash.
  • 1 to 4 screenshots in .playac/screenshots/. The import reads them from the tag. Each is an ordinary 8 bit PNG or a standard JPEG, 200 to 4096 pixels a side, with at most a 4K screen of pixels.
  • README.md, LICENSE and a media/ folder for the README's pictures. None of them goes in the mod. The repository files pack leaves out, and the game ignores in any ZIP, are hidden files and folders (a name starting with a dot, such as .git, .github, .gitignore, .vscode, .playac and .DS_Store), __MACOSX, Thumbs.db and node_modules anywhere, and at the top of the mod README.md, CHANGELOG.md, LICENSE or LICENCE with any extension and the media/ folder.
  • A CI job can install the tool with its install line and run playac-mod check on every push.

For each release:

  1. Raise "version".
  2. Add its CHANGELOG.md section, if you keep one.
  3. Commit, tag and push the tag.
  4. In the game, open Settings, then Mods, and scroll to Share a mod. Import from GitHub shows there, under the upload form, once you are signed in, have answered the age question, have accepted the mod rules and have entered a code from your authenticator app. Paste github.com/you/your-mod@v1.2.0 there.

What is built #

API level 1 has:

Each guide documents what the game does today. Developer mode and the Mod log are in Testing. What we will not build is on the overview, under what a mod cannot do.