Files
zkldi_Tachi/old-docs/docs/codebase/implementation-details/songs-charts.md
T
zk e363bd2532 docs: migrate from mkdocs to mdbook (#1558)
* docs: migrate from mkdocs to mdbook

- Rename old mkdocs docs/ to old-docs/ for reference
- Set up new docs/ with mdbook (book.toml + src/ tree)
- Mirror full nav structure from mkdocs.yml into SUMMARY.md
- Add Justfile-docs with docs-serve, docs-build, docs-check, docs-install recipes
- Import Justfile-docs from root Justfile
- Rewrite .github/workflows/docs.yml: build step uses taiki-e/install-action
  to install mdbook, split into separate build + deploy jobs, PR builds
  run the check step too

* ci(docs): pin actions to SHAs, install mdbook via release binary

* ci(docs): install mdbook from apt instead of curling a release binary

* dev: replace mkdocs python stack with mdbook in dev image

* ci(docs): apt only works on Debian; restore release binary install for Ubuntu CI

* docs: fix duplicate file entries in SUMMARY.md

* docs: remove docs-install recipe

* docs: remove site-url from book.toml to fix asset loading

* dev: install mdbook from upstream release binary, not Debian apt

The Debian package (0.4.x+ds) strips bundled font assets, leaving the
built site without fonts/fonts.css. Use the upstream tarball (same as CI)
so the theme is complete. Handles x86_64 and aarch64.

* docs: vendor mdbook tarballs in dev/mdbook/, install from there

Dockerfile.dev uses COPY + tar to install the right arch at build time.
CI extracts the x86_64 tarball directly from the checkout.
No network access required for either — and no stripped-fonts Debian package.

* fix: unwritten
2026-05-22 20:43:07 +01:00

122 lines
2.3 KiB
Markdown

# Songs And Charts
Tachi structures its song and chart data in a specific
manner in order to avoid copying properties all over
the place.
*****
## Songs
Songs look like this:
```json
{
"title": "5.1.1.",
"artist": "dj nagureo",
"id": 1,
"firstVersion": "0",
"alt-titles": [],
"search-titles": [],
"data": {
"genre": "PIANO AMBIENT"
}
}
```
They're relatively small documents, and contain some metadata.
Depending on the game, the `data` prop will contain
game-specific properties (i.e. not all games have
song genres!)
Songs, however, don't contain any information about
their *charts*. The charts are what people actually play.
In short, songs are *just* a collection of metadata that
parents a chart document!
*****
## Chart Documents
Chart Documents **MUST** belong to a song. In the below
chart, `songID` refers to the above song document:
```json
{
"chartID": "c2311194e3897ddb5745b1760d2c0141f933e683",
"difficulty": "ANOTHER",
"songID": 1,
"playtype": "SP",
"levelNum": 10,
"level": "10",
"data": {
"inGameID": 1000,
"notecount": 786,
},
"isPrimary": true,
"versions": [
"27-omni",
"26-omni",
"27",
"26",
"inf",
"16-cs",
"12-cs",
"10-cs",
"8-cs",
"7-cs",
"bmus"
]
}
```
Songs can have multiple charts, but charts can only have
one song.
## Primary
Sometimes, games like to rechart things and release them
under the exact same song. Sometimes, they even do this
under the *exact* same internal songID!
A 'Primary' chart refers to a chart that is the *current*
variant of that chart for this game. Non-Primary charts
are not eligible for any rating calculations, nor do they
contribute to profile rating.
To check if a chart is primary or not, the `isPrimary` property
handles that.
For example:
```json
{
"chartID": "103ff8bb004e1a8a005f808c025c3feb",
"difficulty": "ANOTHER",
"songID": 1,
"playtype": "SP",
"levelNum": 5,
"level": "5",
"data": {
"inGameID": 1000,
"notecount": 433
},
"isPrimary": false,
"versions": [
"1"
]
}
```
Notice that the chartID is different, and `isPrimary`
is set to false.
Even though this chart is "5.1.1 (SP ANOTHER)", it isn't
the primary chart for this songID + playtype + difficulty.
For the UI, Tachi will hide non-primary charts by default.
Realistically, they only exist to support legacy scores
without having to throw them away when a rechart occurs.