0ad/binaries/data/mods/public/gamesettings/attributes/StartTime.js
vyordan a3bd3bd680 Replay: name replay folders after matchID instead of a per-machine index
Replay folders were named YYYY-MM-DD_NNNN, a per-machine sequence
counter. The same multiplayer match got a different folder name per
participant, and unrelated matches could share a name, making it hard
to correlate replays across players (rating aggregation, replay
sharing, bug reports) without parsing commands.txt first.

The engine already generates a matchID once per match, synced to all
participants before the match starts. Replay folders are now named
YYYY-MM-DD_<matchID>, so the same match produces the same folder name
everywhere.

The date comes from a new "startTime" attribute, set once by the host
(StartTime.js, alongside MatchID.js) and synced like matchID, instead
of each machine reading its own local clock. createDateIndexSubdirectory
is untouched (still used by OOS logs and serialization tests); a new
createReplaySubdirectory is added for replays only, following the same
collision-handling pattern (incrementing suffix) as the existing
function. This also means resuming a match (network rejoin, or a
singleplayer game reloaded via StartSavedGame, both of which reuse the
same matchID) saves an additional replay instead of overwriting the
original.

Fixes #8922
2026-08-04 14:39:04 -06:00

7 lines
148 B
JavaScript

GameSettings.prototype.Attributes.StartTime = class extends GameSetting
{
onFinalizeAttributes(attribs)
{
attribs.startTime = Date.now();
}
};