Skip to content

bugfix: Prevent the game from freezing during scripted camera movements in multiplayer - #3390

Open
Caball009 wants to merge 1 commit into
TheSuperHackers:mainfrom
Caball009:Caball009/fix_game_freeze_scripted_camera
Open

Caball009 wants to merge 1 commit into
TheSuperHackers:mainfrom
Caball009:Caball009/fix_game_freeze_scripted_camera

Conversation

@Caball009

Copy link
Copy Markdown

Bool freezeTime = isTimeFrozen();
->
Bool freezeTime = TheGameEngine->isTimeFrozen() || TheGameEngine->isGameHalted();

#1528 added isGameHalted() which may return true during multiplayer, which would turn the loop that's determined by the value of freezeTime into an infinite loop freezing the game.

I used the map that I included in the issue thread to verify that the game lockup is fixed.

@Caball009 Caball009 added Bug Something is not working right, typically is user facing Critical Severity: Minor < Major < Critical < Blocker Gen Relates to Generals ZH Relates to Zero Hour ThisProject The issue was introduced by this project, or this task is specific to this project Script Is related to Script Engine, SCB labels Sep 30, 2026
@coderabbitai

coderabbitai Bot commented Sep 30, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

Navigate logical layers of code changes, visualize relationships, and explore their blast radius.

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review

Walkthrough

W3DDisplay::update and W3DDisplay::draw now derive freezeTime from isTimeFrozen(). Their fast-time camera-update path also runs when the game is halted. The draw loop exits when it detects debug/script freeze or pause.

Changes

Camera movement rendering

Layer / File(s) Summary
Update frozen-time and camera-loop conditions
Core/GameEngineDevice/Source/W3DDevice/GameClient/W3DDisplay.cpp
update and draw derive freezeTime from isTimeFrozen() and allow the fast-time camera-update path when the game is halted. The draw loop exits when debug/script freeze or pause is detected.

Priority: ➖ Normal

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix · Severity of issue fixed: Medium

Suggested reviewers: mirelle7

Merge Risk: 🔵 Low · up to f3f37

Scripted camera motion can continue while the game is halted in fast-time mode. Excluding halted games from that update path is a small, localized fix.

Architecture Summary

Architecture risk: 🔵 Low · up to f3f37

The change affects 1 system.

Changed systems: Core

Architecture concerns
No architecture-level concerns identified.

Review details

Systems and components

  • observed — Core (service) was modified; 1 changed file maps to changed impact.

Before / after behavior

  • observed — Modified behavior in Core/GameEngineDevice/Source/W3DDevice/GameClient/W3DDisplay.cpp: W3DDisplay::update now treats only isTimeFrozen() as frozen; when fast time is active, the camera-update-and-return path also runs if the game is halted. Previously, halted state was folded into freezeTime and prevented that path.
  • observed — Modified behavior in Core/GameEngineDevice/Source/W3DDevice/GameClient/W3DDisplay.cpp: W3DDisplay::draw now derives freezeTime only from isTimeFrozen(), and its fast-time early return also applies when the game is halted. Previously, halted state was included in freezeTime, preventing this return.
  • observed — Modified behavior in Core/GameEngineDevice/Source/W3DDevice/GameClient/W3DDisplay.cpp: When debug/script freeze or pause is detected, the draw loop now exits directly with break rather than setting freezeTime to false; the loop still repeats only while freezeTime is true and camera movement is unfinished.
🚥 Pre-merge checks | ✅ 4
✅ Passed checks (4 passed)
Check name Status Explanation
Description check ✅ Passed The description directly addresses the multiplayer scripted-camera freeze and explains the relationship to isTimeFrozen() and isGameHalted().
Title check ✅ Passed The title clearly identifies the bug fix and its multiplayer scripted-camera context. It accurately summarizes the primary change.
Linked Issues check ✅ Passed The whole-PR diff changes W3DDisplay::update and W3DDisplay::draw. The camera path no longer treats isGameHalted() as freezeTime, and the loop now exits when debug freeze or pause is detected.…
Out of Scope Changes check ✅ Passed The whole-PR diff contains six additions and six deletions in W3DDisplay.cpp. All changes modify freeze-time and camera-loop control for the reported lockup in issue [#1995]. No unrelated production…
  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Autopilot is currently an internal CodeRabbit preview.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

Comment thread Core/GameEngineDevice/Source/W3DDevice/GameClient/W3DDisplay.cpp Outdated
@greptile-apps

greptile-apps Bot commented Sep 30, 2026 •

Copy link
Copy Markdown

RetriggerConfidence Score: 5/5

[Medium risk] Changes game loop timing logic during camera movements.

The PR appears safe to merge based on this review, with no outstanding finding or distinct new issue to report.

Summary

The PR separates frozen time from a halted game when deciding whether to repeat scripted-camera rendering. It also revises the fast-forward guards in display update and draw, and makes the debug/script-freeze or pause loop exit explicit.

Reviews (3) · Last reviewed commit: "bugfix: Prevent the game from freezing d..."

Comment thread Core/GameEngineDevice/Source/W3DDevice/GameClient/W3DDisplay.cpp Outdated
Comment thread Core/GameEngineDevice/Source/W3DDevice/GameClient/W3DDisplay.cpp Outdated

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1


ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Advanced

Run ID: 3519fa09-dc2b-4704-8431-c5ca9fba45a8

📥 Commits

Reviewing files that changed from the base of the PR and between b0c29eb and 0a2d17e.

📒 Files selected for processing (1)
  • Core/GameEngineDevice/Source/W3DDevice/GameClient/W3DDisplay.cpp

Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 3 remain after this review.

Comment thread Core/GameEngineDevice/Source/W3DDevice/GameClient/W3DDisplay.cpp Outdated
@Caball009
Caball009 force-pushed the Caball009/fix_game_freeze_scripted_camera branch 2 times, most recently from 1d546d6 to f3f3760 Compare September 30, 2026 20:43

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Caution

Some comments are outside the diff and can’t be posted inline due to GitHub limitations.

⚠️ Outside diff range comments (1)

🟡 Minor · Exclude halted games from the fast-time camera update. · W3DDisplay.cpp:1798-1803

Core/GameEngineDevice/Source/W3DDevice/GameClient/W3DDisplay.cpp:1798-1803
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Exclude halted games from the fast-time camera update.

When fast time is active and the game is halted, this branch calls updateCameraMovements(). The method advances scripted zoom, pitch, and rotation frames and changes camera values without checking the halted state. This conflicts with FramePacer::setGameHalted(), which documents that halted games do not allow scripted camera movement. The exception is for frozen time only: waypoint movement passes IgnoreFrozenTime, not IgnoreHaltedGame, and therefore receives a zero step while halted.

Suggested fix
-if ((!freezeTime || TheFramePacer->isGameHalted()) && TheScriptEngine->isTimeFast())
+if (!freezeTime && !TheFramePacer->isGameHalted() && TheScriptEngine->isTimeFast())

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Advanced

Run ID: e69b2172-9ef3-4b65-9620-24f30c4ba0df

📥 Commits

Reviewing files that changed from the base of the PR and between 1d546d6 and f3f3760.

📒 Files selected for processing (1)
  • Core/GameEngineDevice/Source/W3DDevice/GameClient/W3DDisplay.cpp

Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 1 remain after this review.

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

Labels

Bug Something is not working right, typically is user facing Critical Severity: Minor < Major < Critical < Blocker Gen Relates to Generals Script Is related to Script Engine, SCB ThisProject The issue was introduced by this project, or this task is specific to this project ZH Relates to Zero Hour

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Game lock up During Scripted Camera Intro/Outro

1 participant