Skip to content

Headless replay player#1950

Open
MichalLabuda wants to merge 1 commit into
Return-To-The-Roots:masterfrom
MichalLabuda:headless-replay-player
Open

Headless replay player#1950
MichalLabuda wants to merge 1 commit into
Return-To-The-Roots:masterfrom
MichalLabuda:headless-replay-player

Conversation

@MichalLabuda

Copy link
Copy Markdown
Contributor

Summary

Adds a new headless replay-player tool that loads and plays back .rpl replay files without a GUI, reporting live progress and detecting desyncs.

New files

  • extras/replay-player/CMakeLists.txt - build target linking against s25Main and Boost; includes DLL gathering on Windows.
  • extras/replay-player/HeadlessReplay.h/.cpp - supporting types and helpers:
    • HeadlessGameState - minimal ILocalGameState implementation (player 0 / host); forwards Lua SystemChat messages to stdout.
    • ReplayStatus - tracks game reference, total GF count, wall-clock start time, and last-reported GF for progress display.
    • printConsole() - cross-platform console output: uses WriteConsoleA with VT100 mode enabled on Windows, boost::nowide::cout elsewhere.
    • printTable() - live-updating stats table using ANSI cursor-up escape codes, refreshed every second. Shows current GF / total GFs, game clock, wall clock, GF/sec, and per-player Country / Buildings / Military / Gold statistics. Defeated players are shown with strikethrough.
    • printInitialInfo() - prints replay metadata (map name, version, type, size, seed, GF range) and a player roster before playback begins.
  • extras/replay-player/main.cpp - main program:
    • Accepts the replay path via --replay / -r or as a positional argument.
    • Supports both new-game replays (decompresses embedded map data and Lua script to temp files) and savegame-based replays.
    • Applies the fish-fix skip for replays predating version 8.3.
    • Executes all game commands frame by frame, verifying async checksums on each GameCommand.
    • Reports the first desync with GF number and actual-vs-stored checksum; --verbose / -V additionally dumps the full async log.
    • Exits with code 0 if no desyncs were found, 1 otherwise (also 1 on any load/parse error).
    • Replay path argument supports <RTTR_X> placeholders and leading ~ via RTTRCONFIG.ExpandPath().
    • Two-tier help: brief usage on no-args or parse error; full option list with path expansion reference on --help / -h.
    • --version / -v prints title, version, revision, compiler, and OS.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant