mirror of
https://gitea.wildfiregames.com/0ad/0ad
synced 2026-08-15 14:43:32 -07:00
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
7 lines
148 B
JavaScript
7 lines
148 B
JavaScript
GameSettings.prototype.Attributes.StartTime = class extends GameSetting
|
|
{
|
|
onFinalizeAttributes(attribs)
|
|
{
|
|
attribs.startTime = Date.now();
|
|
}
|
|
};
|