On this page

← All documentation

The .pvreplay file

The binary container of a recorded play: magic, version, zstd frame, rkyv archive, limits, field order, metadata JSON, how chart_hash is computed, and the errors.

A .pvreplay stores the physical inputs of one play and enough information to find the exact chart it was played on. Prism replays it by re-judging the inputs, so the file carries no scores. The container is binary and strict: nothing is half-read.

Container layout

Bytes Content
0 to 3 Magic PVRZ (50 56 52 5A)
4 Format version, one byte. This build writes and reads 1. Version 0 is damaged; a higher one is refused as newer
5 to end One zstd frame (level 9 when written) holding an rkyv archive

The archive is validated with bytecheck before any field is read. The game also requires the decompressed archive to fit its limit, so a small file cannot expand without bound.

Limits

Limit Value
File size (compressed) 8 MiB
Decompressed archive 32 MiB
Inputs 2,000,000
Pause marks 1024
Metadata JSON 1 MiB
Input time within 24 hours of the song's zero
Columns 255 at most; every input names a column of the chart
Playback rate 0.5 to 2
Texts of the chart identity (title, artist, difficulty, creator) 256 characters, no control characters
Player name, extension keys 64 characters
Extensions 32
Keys of the chart 1 to 64

The archive

The archive holds these fields, in this order.

Field Type Meaning
chart_hash 32 bytes Chart hash of the chart as it was played
note_hash 32 bytes Note hash, the key of the online boards
playback_rate f64 The rate of the play, 0.5 to 2
pauses optional list None means not recorded (an old recording), never "no pause". Some([]) means the play had no pause. Each mark has at_us, duration_us (-1 when the length was not recorded) and focus (a pause caused by a lost window focus)
inputs list Delta events: microseconds since the previous event, the column (one byte), and whether the key went down. The first delta is the signed time in the song
meta JSON text A JSON object, see below

Hashes are 64 lowercase hexadecimal characters in text, 32 bytes in the file.

The metadata

meta is a JSON object. Unknown fields are ignored, so a later version can add some.

Field Type Meaning
chart object title, artist, difficulty, creator, keys: human-readable fallbacks for the chart
rules string Ruleset of the recording: 1 to 64 characters among letters, digits, ., _, -
playerName string, optional Absent when the recording did not know who played; never invented
chartMods object, optional The chart modifiers of the play (mirror, random with its seed, long notes). Absent for a play on the map as it is
judgement object, optional The judgement the play was recorded with. It is metadata of the original result and never ranks
scrollTimeMs number, optional The scroll time, above 0 and at most 60000
playedAtMs integer, optional When the play was made, in Unix milliseconds, when the file knows it. A receiver that ranks plays reads it as a claim
extensions object, optional Optional data a later version may define
{
  "chart": {
    "title": "Example Song",
    "artist": "Example Artist",
    "difficulty": "Hard",
    "creator": "mapper",
    "keys": 4
  },
  "rules": "prism",
  "playerName": "alice",
  "scrollTimeMs": 520.0,
  "playedAtMs": 1760000000000
}

Reading a replay

The chart_hash pins the exact chart, notes and timing, to the microsecond. The receiver rebuilds the chart it finds under that hash (with chartMods applied) and judges the inputs on it. If the chart is missing, the game says so; it does not guess. The game imports a .pvreplay by the replay import button, by dropping it on the window, or by double-clicking it (file associations). Opening a replay never starts a play.

The game server judges a play on the exact version of the chart the player used, named by this hash, and keeps the file it stored. See Rox files and hashes for which identity each API takes.

How chart_hash is computed

The hash is BLAKE3 in key-derivation mode with the context string pvng chart content v1 (hash version 1). It is fed, in this order:

  1. The key count, one byte.
  2. The number of notes, as a little-endian u64.
  3. Every note, sorted by (time_us, column, kind, duration_us): time as a little-endian i64, then the column byte and the kind byte, then the duration as a little-endian i64. The kind is 0 for a tap, 1 for a hold, 2 for a burst and 3 for a mine. The duration is 0 for a tap and a mine.
  4. The number of timing points, as a little-endian u64.
  5. Every timing point, sorted by (time_us, kind, value bits, signature): time, then a byte 0 (BPM) or 1 (scroll velocity) and the signature byte (0 for a scroll velocity), then the f32 bits of the BPM or the scroll speed as little-endian u32.

Times are exact microseconds and no global offset is removed. Mines, bursts and timing points count. Metadata, audio and hitsounds do not. A stored hash of another hash version is recomputed rather than trusted.

Errors

These are the messages when you import a file.

Message Cause
The replay file is too large (N bytes, at most 8388608) Over 8 MiB
The file is not a Prism replay The first four bytes are not PVRZ
The replay was made by a newer version of the game (format version N, this build reads up to 1) Version byte above 1
Invalid replay file: <reason> Damaged or invalid content

The reason after Invalid replay file: is one of the following:

Reason Cause
the replay file is damaged: the compressed frame: … The zstd frame is broken, or inflates past 32 MiB
the replay file is damaged: the archive: … The archive fails validation
the replay file is damaged: the metadata is not an object meta is not a JSON object
the replay file is damaged: too many pauses More than 1024 pause marks
the chart hash is not 64 lowercase hexadecimal digits Bad chart hash in chart
the note hash is not 64 lowercase hexadecimal digits Bad note hash
N keys is not a chart size keys outside 1 to 64
the chart title is too long or has control characters Same for artist, difficulty, creator
the player name is empty, too long or has control characters Bad playerName
the rules name is not a plain identifier Bad rules
the scroll time is out of range scrollTimeMs outside 0 to 60000
too many extensions, or an extension with an invalid name More than 32, or a key over 64 characters

When the game reads the inputs against the chart, an input beyond 24 hours from the song's zero is refused with Replay input N is outside the song's time range. The lower-level messages this is not a Prism replay file, the replay file is too large and this replay was saved by a newer version of the game (format N) come from the container reader and appear in logs.

Pitfalls

  • The file holds no score. Two machines judge the same inputs the same way only if they have the same chart, hence the exact chart_hash.
  • note_hash is not chart_hash. The note hash ignores a global offset and timing; the chart hash does not. A map that exists under two offsets has one note hash and two chart hashes.
  • Do not edit a replay with a JSON tool. It is a binary archive, and the sizes are checked.

Source in the game repository: crates/replay/src/formats/replay_file.rs,crates/replay/src/formats/share.rs,crates/replay/src/formats/replay.rs,crates/core/src/chart_identity.rs,crates/core/src/rate.rs,crates/note_hash/src/lib.rs