Skip to content

Demo loading progress fills all the way on a demo with a map restart (#866) - #875

Merged
ccoventry merged 5 commits into
devfrom
fix/load-progress-first-map-866
Oct 22, 2026
Merged

ccoventry merged 5 commits into
devfrom
fix/load-progress-first-map-866

Conversation

@ccoventry

@ccoventry ccoventry commented Oct 19, 2026 •

Copy link
Copy Markdown
Owner

Release note: Fixed: the demo loading progress in the game fills all the way on a demo that recorded a map restart, instead of disappearing at about half.

Closes #866

Cause

The demo player's clock is svc_time, and viewdemo stops loading where that clock turns back at a map restart (it only plays a demo's first map). The progress divided the player's span by the directory's whole playback time, less the LOADING lead-in (#810). On solifotw-bewton the player holds 4.30 → 1956.38 s, against 2,996 s in the directory, so the bar went away at about 53%. Measured with an R&D build; the numbers are on #866.

Change

  • demo_file::loaded_span: walks every frame header and returns the svc_time span from the first network frame to the first backwards jump. It reads the file through a 1 MB BufReader with seek_relative, so the buffer survives the skips.
  • load_progress: runs it on a background thread when a demo starts loading. load_percent then divides the player's span by it, the same clock with no lead-in. Until the thread answers, the directory's estimate stands.
  • The per-frame path only uses try_lock.

Tests

  • New unit tests: the_loaded_span_ends_where_the_server_clock_turns_back (a built demo file with a restart) and with_the_loaded_span_the_percent_is_the_players_span_over_it. cargo test -p goldsrc-hooks --target i686-pc-windows-msvc: 678 passed.

  • Clippy 1.98.1 -D warnings is clean, both i686 and host. fmt is clean.

  • In game (game_probe, Brain account, DLL local\test-866\, the Playback tab's 10% log lines):

    • POST, solifotw-bewton (the restart demo): 18, 20, 30 … 90%, then loaded. It used to stop at 50%.

    • POST, solifotw-bud (no restart): 11, 20 … 90%, then loaded.

    • PRE, wsod25_grp2_h1_hltv: 10 … 90%, then loaded.

    • Re-run after merging dev (In-game commands get shorter names grouped by what they change: ds_hud_hide_scoreboard and so on (#555) #719), solifotw-bewton on PRE and POST, DLL rebuilt into local\test-866\: 0, 17/18, 20 … 90%, then loaded on both. Reports: local\game-probe\875-ds-pre\, 875-ds-post\. After the merge: hook tests (689), workspace tests, clippy (both targets), fmt and npm run test:unit pass.

    On the restart demo the first line is 18%: the directory's estimate showed until the file walk answered, about 3 s into the load.

🤖 Generated with Claude Code

… a demo with a map restart

The demo player's clock is svc_time, and viewdemo stops loading where it
turns back at a map restart; the progress divided by the directory's whole
playback time, so on solifotw-bewton it ended at about half. A background
thread now reads the svc_time span the player will hold (first network
frame to the first backwards jump), and the percent divides by that; the
directory's estimate stands until it answers.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@ccoventry

Copy link
Copy Markdown
Owner Author

Merged dev in (after #719) at 4563a4b5, with no conflicts. This PR adds and uses no console names.

  • Local checks: fmt, clippy 1.98.1 (workspace and i686), hook tests (689), workspace tests, npm run test:unit: all pass.
  • Test DLL rebuilt: local\test-866\dodstudio_goldsrc_hooks.dll.
  • game_probe re-run with viewdemo solifotw-bewton (the map-restart demo) on PRE and POST. The Playback tab logged 0, 17% (POST 18%), then 20 … 90%, then "the demo is loaded", on both. Both PASS (local\game-probe\875-ds-pre\, 875-ds-post\).

🤖 Generated with Claude Code

@ccoventry

Copy link
Copy Markdown
Owner Author

Brought up to date with dev (unattended pass). Head dd17cda1.

  • Two gh pr update-branch runs, both clean.
  • CI green on dd17cda1.

In game. DLL local\test-866\, rebuilt from dd17cda1. game_probe, Brain account, viewdemo solifotw-bewton (the map-restart demo).

  • PRE, PASS (local\game-probe\uh-875-pre\ on f863886, uh-875-pre-r2\ on dd17cda):
    • Playback tab logged 0, 18, 20, 30 ... 90%, then "the demo is loaded".
    • ds_debug_status: temp-entity fix 6 of 6, hull-trace guard on (pre-Anniversary on PRE, 25th Anniversary on POST)
  • POST, PASS (uh-875-post\, uh-875-post-r2\): the same, 0, 18, 20 ... 90%, then loaded.
  • Neither hook log shows a hook failing. The only "not installed" lines are modules that are build-specific by design: frame_esc on PRE, lightmap_gamma on POST.

🤖 Generated with Claude Code

@ccoventry
ccoventry merged commit c7ef3c6 into dev Oct 22, 2026
5 checks passed
@ccoventry
ccoventry deleted the fix/load-progress-first-map-866 branch October 22, 2026 11:01
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.

Demo loading progress stops at about half on a long demo, then disappears

1 participant