diff --git a/README.md b/README.md
index da939bc..1dde503 100644
--- a/README.md
+++ b/README.md
@@ -40,6 +40,11 @@ reset. Page Up/Down changes the staged SCENE value by 10.
The Force Control toggle keeps Jimmy controllable during scripted control locks. See
[debug menu controls](docs/debug-menu.md).
+**F2** toggles a compact live debug overlay without pausing play. It shows frame
+timing, position/velocity, movement, control/force state, tasks, camera/clipping
+and error counters. F1 also has a Live Overlay toggle. Visibility stays selected
+across scene changes during the session; `--debug-overlay` enables it at startup.
+
The original lab pickup is internally tagged `shrinkray`; the original objective
art identifies it as the **jet pack**. Its practice prompt accepts **Y** or a click
on Yes to enter VR04, and **N** or a click on No to resume. Enter selects the
diff --git a/docs/architecture.md b/docs/architecture.md
index 64cec4d..a8e6b56 100644
--- a/docs/architecture.md
+++ b/docs/architecture.md
@@ -162,3 +162,11 @@ Effective control/tag queries expose Jimmy while forced; source shot assignments
still update the authored tag. DEFAULT uses authored ownership for its music
handoff. Disabling force reveals current script state; Begin clears the override.
The debug flag is never serialized into original saves.
+
+DebugDiagnostics is session-owned timing/visibility state passed into each Run.
+It reads DebugStatus/DebugMotion snapshots and formats bounded live text; its
+wall-frame timer is independent of the simulation clock. F2 handles only its own
+key and never enters the menu's pause/input-reset boundary. F1 selects the full
+menu layout while open, otherwise the same overlay ranges display compact live
+diagnostics. The source viewport/projection decision supplies actual camera/far
+data. No debug visibility state is written into the original TSK wire format.
diff --git a/docs/compatibility.md b/docs/compatibility.md
index 51ddfae..6aaf548 100644
--- a/docs/compatibility.md
+++ b/docs/compatibility.md
@@ -25,6 +25,7 @@ separate evidence categories. **The game is not fully reconstructed/playable yet
| Swapchain resize | Linux tested | 960x720 ->800x600, zero validation errors |
| F1 debug menu | Managed/SDL audio tests + native Linux GTX1070 window pass |Pause/actions/input capture/resume/800x600 resize, zero validation errors;33 prepared scene/start choices; intentional modern tools, no new Windows runtime claim |
| F1 Force Control | Menu/director/interaction checks + native Linux SDL pass |Persistent override through source shots; disable/reset restores normal ownership; actual movement with neutron1a active, zero Vulkan errors; music handoff regression passes |
+| F2 live debug overlay | Managed timing/layout/menu + native Linux SDL pass |Non-pausing movement, visibility/repeat/menu priority and800x600 resize; all checks true, zero Vulkan errors; session persistence; modern tools, no new Windows runtime claim |
| Focus / fullscreen | Code present, partial/unverified | Focus clears keys; fullscreen toggle not dynamically tested |
| Mouse/relative input/controller | Incomplete | SDL entry point declaration alone is not behavior |
| Audio stream | Linux dummy device | Original11025Hz mono WAV consumed10752bytes/500ms; speakers untested |
@@ -85,6 +86,14 @@ window/input/action/resize evidence is artifacts/debug-window.log; screenshots
were visually inspected. Both Linux and Windows self-contained packages publish
successfully. No new Windows/Wine runtime check was run for this addition.
+Live F2 diagnostics: artifacts/live-debug-full-tests.log passes the full suite
+and539 original hashes. Native SDL live movement/menu/visibility/resize and the
+existing force-control check pass with zero Vulkan errors. Headless lab/VR04/lab
+retains visibility and samples1/2/3 with zero errors; camera/layout/timing groups
+pass. See artifacts/live-debug-window.log and live-debug-return.log. No new
+Windows runtime claim is made.
+Both self-contained platform packages rebuild successfully with this addition.
+
Known visual/behavior limits include incomplete lighting/fog/blend/culling/material
mapping, inferred model/root pivot, provisional collision/cadence/animation timing,
close-wall camera clipping near Jimmy, incomplete class-specific triggers/interactions,
diff --git a/docs/debug-menu.md b/docs/debug-menu.md
index 43d25c8..5958591 100644
--- a/docs/debug-menu.md
+++ b/docs/debug-menu.md
@@ -1,4 +1,4 @@
-# F1 debug menu
+# Debug menu and live overlay
User-requested modern investigation tools, separate from recovered original UI.
F1 works in the game, during cutscenes and practice prompts, and in scene inspection.
@@ -8,6 +8,7 @@ audio. Closing resumes the previous mode. No new assets or dependencies are need
| Key | Action |
| --- | --- |
| F1 | Open/close |
+| F2 | Toggle live diagnostics without pausing |
| Up/Down | Select a row |
| Left/Right | Change selected level, startpoint or staged SCENE task value |
| Page Up/Down | Change staged SCENE value by10 |
@@ -62,6 +63,45 @@ It also enables Force Control through the menu and verifies actual movement whil
Carl's MCA is still playing. Director checks cover disabling the override, shot
changes, scene reset and the normal completion music handoff.
+## Live diagnostics (F2)
+
+F2 toggles a compact panel in the upper-left corner while gameplay, cutscenes and
+audio continue. The F1 menu also offers Live Overlay; opening F1 replaces the live
+panel temporarily, preserving its setting. F2 works while F1 or practice is open
+without changing their pause state. Visibility persists through resets and scene
+loads within the process; it is not stored in TSK. `--debug-overlay` starts enabled.
+
+Twelve bounded rows show measured FPS/frame milliseconds; level/start; root XYZ;
+velocity XYZ; yaw/speed/turn rate; ground/pose/energy; control/force/pause; SCENE/
+score/jetpack state and burst timer; actual camera mode/far plane; cutscene/shot/
+blocked state; movement counters; and reported issue/Vulkan-error/frame counts.
+STRT, orbit, gameplay and cutscene modes use the actual rendered view selection;
+orbit reports its own radius-derived far plane. A paused player/control lock is
+separate from pausing the whole simulation.
+
+Timing measures rendered-loop wall intervals, including rendering/presentation,
+independently of the simulation clock. It shows an initial running mean, then
+publishes half-second window averages. Text uses the preceding timing sample;
+the first frame has no measurement yet. This is frame timing, not GPU profiling.
+Timing continues while hidden so enabling the panel has current samples.
+Motion fields describe the player simulation; standalone mesh inspection has no
+running player and displays zero/default motion values.
+
+DebugDiagnostics is read-only and retains timing/visibility across scene rebuilds.
+DebugMenuOverlay reuses the existing font and fixed vertex ranges with a smaller,
+content-sized panel. Gameplay state, pause policy and original HUD stay separate.
+There are no added assets or dependencies.
+
+DebugDiagnosticsTests verifies timing, finite zero/invalid cases, live snapshots,
+camera selection, culture-independent formatting and label bounds. The24-frame
+`--smoke-debug-overlay` SDL check verifies F2/repeat handling, movement without
+pause, hide/show, F1 priority, visibility preference, menu action and800x600 resize.
+Native Linux evidence: artifacts/live-debug-window.log; zero Vulkan validation
+errors. The existing F1/force-control SDL check also passes. Full regression and
+cross-scene results are in progress.md; no new Windows runtime check is claimed.
+The headless lab/VR04/lab check preserves enabled state and frame samples1/2/3,
+with zero Vulkan errors (artifacts/live-debug-return.log).
+
Native Linux GTX1070 window test passes with zero Vulkan validation errors:
artifacts/debug-window.log. GPU screenshots debug-menu.png and debug-window.open.ppm
show the menu. Source/build/regression evidence does not constitute new native
diff --git a/docs/decisions.md b/docs/decisions.md
index c63b213..b67c56c 100644
--- a/docs/decisions.md
+++ b/docs/decisions.md
@@ -87,3 +87,8 @@
Force Control is a persistent debug override over authored ownership, with
FALSE restoring the current scripted state. Reset/new scene clears it, and
source music handoff continues to use authored ownership.
+20. **Keep live diagnostics passive and session-owned.** F2 and the F1 Live Overlay
+ action change visibility without pausing gameplay/audio. Preserve this setting
+ across scene rebuilds in memory, independently of TSK state. Reuse the existing
+ font/buffers, give F1 display priority and measure wall-frame intervals separately
+ from simulation ticks. Report the rendered camera/projection, not a guessed mode.
diff --git a/docs/progress.md b/docs/progress.md
index cce0b9d..45057b6 100644
--- a/docs/progress.md
+++ b/docs/progress.md
@@ -4,6 +4,31 @@
user-verified Windows rendering checkpoint into an interactive original lab and
jet pack tutorial flow. This is not a verified faithful complete scene or release.
+## User-requested live debug overlay
+
+F2 toggles a compact, non-pausing live diagnostics panel. F1 also offers Live
+Overlay and takes display priority while open. The setting/timing object belongs
+to the session, preserving visibility across scene rebuilds and resets without
+writing original saves. --debug-overlay enables startup visibility.
+
+The12 rows expose FPS/frame time, root/velocity, steering/pose/ground/energy,
+control/force/pause, tasks/score/jetpack, actual camera/far plane, active cutscene
+and counters/errors. Source camera and orbit projection values reflect rendering.
+The existing font/overlay buffers are reused with a smaller content-sized panel.
+
+Targeted model/renderer/diagnostics groups pass. Native Linux GTX1070 SDL checks
+pass live movement77.58 travel with visibility/menu/resize checks all true and
+zero Vulkan validation errors (artifacts/live-debug-window.log). The prior F1
+force-control check still passes. Headless GPU output was visually inspected.
+Complete scripts/test.sh passes, including41 Python checks, all managed/gameplay/
+GPU/audio regressions and539 unchanged originals (artifacts/live-debug-full-tests.log).
+The lab -> VR04 -> lab headless check retains enabled diagnostics with frame
+samples1/2/3 and zero Vulkan errors (artifacts/live-debug-return.log); exact RETURN
+root/companion placement still passes. Final authored-camera inspection also
+renders with zero errors, and targeted camera-mode/layout/timing checks pass.
+Both Linux and Windows self-contained packages are rebuilt successfully. No new
+Windows/Wine runtime check was run.
+
## User-requested F1 debug menu
Follow-up: Force Control is now a persistent TRUE/FALSE menu toggle. It overrides
diff --git a/docs/tasks.md b/docs/tasks.md
index 3d77b21..865f50b 100644
--- a/docs/tasks.md
+++ b/docs/tasks.md
@@ -33,6 +33,8 @@ compile, runtime and original-fidelity verification are separate.
camera/cutscene/energy/jetpack/task/scene/start/reset controls and input capture.
- [x] Force Control TRUE/FALSE override in F1; persists through scripted shots,
restores authored ownership when disabled, clears on reset/new scene.
+- [x] F2 live diagnostics plus F1 visibility toggle; non-pausing compact overlay,
+ measured frame timing and session-owned visibility across scene rebuilds.
## Immediate continuation
diff --git a/scripts/package.sh b/scripts/package.sh
index 47611b2..ba9727b 100755
--- a/scripts/package.sh
+++ b/scripts/package.sh
@@ -49,6 +49,8 @@ Shift, Insert, numpad 0 or right mouse jump. R resets to the original start area
F1 opens debug tools: arrows navigate/change, Enter applies, F1/Escape closes.
The menu pauses gameplay/audio and provides diagnostics, camera/cutscene controls,
energy/jetpack/task changes, level/start selection, reset and Force Control toggle.
+F2 toggles compact live diagnostics without pausing; --debug-overlay enables it
+at startup. F1's Live Overlay toggle controls the same session preference.
C pauses into inspection and resumes the chase camera. F11 fullscreen, Escape quit.
Inspection: arrows/WASD orbit, +/- zoom, 1 idle, 2 run, 3 jump, 4 scratch preview.
Append --inspect to start directly in the old scene inspector.
diff --git a/scripts/test.sh b/scripts/test.sh
index ad910a3..f131344 100755
--- a/scripts/test.sh
+++ b/scripts/test.sh
@@ -13,6 +13,7 @@ dotnet run --project tests/GamePort.InteractionTests -- ../Original
dotnet run --project tests/GamePort.CheckpointTests -- ../Original
dotnet run --project tests/GamePort.DebugMenuTests -- ../Original
dotnet run --project tests/GamePort.DebugOverlayTests
+dotnet run --project tests/GamePort.DebugDiagnosticsTests
SDL_AUDIODRIVER=dummy dotnet run --project tests/GamePort.AudioPauseTests
dotnet run --project tests/GamePort.LabRouteTests -- ../Original
dotnet run --project tests/GamePort.UndergroundRouteTests -- ../Original
@@ -33,6 +34,7 @@ dotnet run --no-build -- --headless --story --smoke-practice-prompt --screenshot
dotnet run --no-build -- --headless --story --smoke-practice-transition
dotnet run --no-build -- --headless --smoke-practice-return --screenshot artifacts/test-practice-return.ppm
dotnet run --no-build -- --headless --debug-menu --screenshot artifacts/test-debug-menu.ppm
+dotnet run --no-build -- --headless --debug-overlay --frames 2 --screenshot artifacts/test-debug-overlay.ppm
dotnet run --no-build -- --headless --story --smoke-lab-route
dotnet run --no-build -- --headless --smoke-carl-cutscene --frames 60 --screenshot artifacts/test-carl-cutscene.ppm
dotnet run --no-build -- --headless --smoke-objective-panel --story-time 1 --screenshot artifacts/test-objective-visible.ppm
@@ -54,6 +56,7 @@ SDL_AUDIODRIVER=dummy dotnet run --no-build -- --scene-audio-smoke artifacts/ext
SDL_AUDIODRIVER=dummy dotnet run --no-build -- --cutscene-audio-smoke artifacts/extracted/level1b/entities/entities.json
python3 tools/recon/inventory.py ../Original --verify docs/original-manifest.json
if [[ "${NEUTRON_WINDOW_TEST:-0}" == 1 ]]; then
+ dotnet run --no-build -- --smoke-debug-overlay --screenshot artifacts/test-live-debug-window.ppm
dotnet run --no-build -- --smoke-debug-menu --screenshot artifacts/test-debug-window.ppm
dotnet run --no-build -- --smoke-objective-window --screenshot artifacts/test-objective-window.ppm
dotnet run --no-build -- --scene artifacts/extracted/VR04/scene.json --level gam/VR04.gam --smoke-jetpack --screenshot artifacts/test-jetpack-window.ppm
diff --git a/src/GamePort/Application/DebugDiagnostics.cs b/src/GamePort/Application/DebugDiagnostics.cs
new file mode 100644
index 0000000..2b8b9cf
--- /dev/null
+++ b/src/GamePort/Application/DebugDiagnostics.cs
@@ -0,0 +1,82 @@
+using System.Globalization;
+using System.Numerics;
+
+namespace GamePort.Application;
+
+public readonly record struct DebugMotion(Vector3 Velocity, float TurnRate, string Pose,
+ int Steps, int Jumps, int WallHits, int JetpackState, float JetpackRemaining,
+ int Shot, bool Blocked, int VulkanErrors, bool Paused);
+
+/// Modern read-only gameplay diagnostics and measured wall-frame timing.
+public sealed class DebugDiagnostics
+{
+ public const uint ToggleKey = 59; // SDL scancode F2.
+ public const int MaxLines = 12, MaxColumns = 58;
+ private const double SampleSeconds = .5;
+ private double windowSeconds;
+ private long windowFrames;
+ private bool publishedWindow;
+ public bool Enabled { get; set; }
+ public double FramesPerSecond { get; private set; }
+ public double FrameMilliseconds { get; private set; }
+ public long Frames { get; private set; }
+
+ ///
+ /// Count all rendered frames; timing uses only positive elapsed samples.
+ /// Show the running mean initially, then publish each half-second window.
+ /// Caller supplies wall time, independently of paused simulation time.
+ ///
+ public void ObserveFrame(double seconds)
+ {
+ if (!double.IsFinite(seconds) || seconds < 0) throw new ArgumentOutOfRangeException(nameof(seconds));
+ Frames++;
+ if (seconds == 0) return;
+ windowSeconds = Finite(windowSeconds + seconds);
+ windowFrames++;
+ if (!publishedWindow || windowSeconds >= SampleSeconds)
+ {
+ var mean = windowSeconds / windowFrames;
+ FramesPerSecond = Finite(1 / mean);
+ FrameMilliseconds = Finite(mean * 1000);
+ }
+ if (windowSeconds >= SampleSeconds)
+ {
+ publishedWindow = true;
+ windowSeconds = 0;
+ windowFrames = 0;
+ }
+ }
+
+ public string[] Lines(DebugStatus status, DebugMotion motion)
+ {
+ if (!Enabled) return [];
+ ArgumentNullException.ThrowIfNull(status);
+ static string F(float value) => value.ToString("0.0", CultureInfo.InvariantCulture);
+ static string B(bool value) => value ? "T" : "F";
+ static string I(FormattableString text) => FormattableString.Invariant(text);
+ var camera = status.CameraMode ?? (status.Inspecting ? "ORBIT" :
+ string.Equals(status.Cutscene, "NONE", StringComparison.OrdinalIgnoreCase) ? "GAMEPLAY" : "CUTSCENE");
+ string[] lines = [
+ I($"DEBUG F2 | FPS {FramesPerSecond:0.0} | {FrameMilliseconds:0.00} MS"),
+ I($"LEVEL {status.Level} START {status.Start}"),
+ I($"ROOT X {F(status.Root.X)} Y {F(status.Root.Y)} Z {F(status.Root.Z)}"),
+ I($"VEL X {F(motion.Velocity.X)} Y {F(motion.Velocity.Y)} Z {F(motion.Velocity.Z)}"),
+ I($"YAW {F(status.Yaw)} SPEED {F(status.Speed)} TURN {F(motion.TurnRate)}"),
+ I($"GROUND {B(status.Grounded)} POSE {motion.Pose} ENERGY {F(status.Energy)}"),
+ I($"CTRL {B(status.Controlled)} FORCE {B(status.ForcedControl)} PAUSED {B(motion.Paused)}"),
+ I($"SCENE {status.SceneTask} SCORE {status.Score} JETPACK {motion.JetpackState} {F(motion.JetpackRemaining)}S"),
+ I($"CAM {camera} FAR {F(status.FarPlane)}"),
+ I($"CUT {status.Cutscene} SHOT {motion.Shot} BLOCK {B(motion.Blocked)}"),
+ I($"STEPS {motion.Steps} JUMPS {motion.Jumps} WALL {motion.WallHits}"),
+ I($"ISSUES {status.Issues} VK ERR {motion.VulkanErrors} FRAME {Frames}")
+ ];
+ for (var i = 0; i < lines.Length; i++)
+ {
+ var line = lines[i].Replace('\r', ' ').Replace('\n', ' ');
+ lines[i] = line.Length > MaxColumns ? line[..MaxColumns] : line;
+ }
+ return lines;
+ }
+
+ private static double Finite(double value) => double.IsFinite(value) ? value : double.MaxValue;
+}
diff --git a/src/GamePort/Application/DebugMenu.cs b/src/GamePort/Application/DebugMenu.cs
index d36dc40..5dfb61c 100644
--- a/src/GamePort/Application/DebugMenu.cs
+++ b/src/GamePort/Application/DebugMenu.cs
@@ -5,17 +5,17 @@ using GamePort.Assets;
namespace GamePort.Application;
public sealed record DebugScene(string LevelFile, string Code, string[] Starts);
-public enum DebugAction { None, Resume, Camera, SkipCutscene, RefillEnergy, GiveJetpack, ApplySceneTask, LoadScene, Reset, ForceControl }
+public enum DebugAction { None, Resume, Camera, SkipCutscene, RefillEnergy, GiveJetpack, ApplySceneTask, LoadScene, Reset, ForceControl, ToggleOverlay }
public sealed record DebugMenuView(string[] Lines, int SelectedLine);
public sealed record DebugStatus(string Level, string Start, Vector3 Root, float Yaw, float Speed,
bool Grounded, float Energy, int Score, int SceneTask, string Cutscene, bool Controlled,
- int Issues, float FarPlane, bool Inspecting, bool ForcedControl = false);
+ int Issues, float FarPlane, bool Inspecting, bool ForcedControl = false, bool DiagnosticsVisible = false, string? CameraMode = null);
/// Modern investigation tools, deliberately separate from recovered game UI.
public sealed class DebugMenu
{
public const uint ToggleKey = 58; // SDL scancode F1; F11 remains fullscreen.
- public const int ItemCount = 11;
+ public const int ItemCount = 12;
public bool Open { get; private set; }
public int Selected { get; private set; }
public int SceneTask { get; private set; }
@@ -66,6 +66,7 @@ public sealed class DebugMenu
3 => DebugAction.RefillEnergy, 4 => DebugAction.GiveJetpack, 5 => DebugAction.ApplySceneTask,
8 => Scene == null ? DebugAction.None : DebugAction.LoadScene, 9 => DebugAction.Reset,
10 => DebugAction.ForceControl,
+ 11 => DebugAction.ToggleOverlay,
_ => DebugAction.None
};
return DebugAction.None;
@@ -84,7 +85,7 @@ public sealed class DebugMenu
$"YAW {F(status.Yaw)} SPEED {F(status.Speed)} GROUNDED {status.Grounded}",
$"ENERGY {F(status.Energy)} SCORE {status.Score} SCENE {status.SceneTask}",
$"CONTROL {status.Controlled} CUTSCENE {status.Cutscene}",
- $"ISSUES {status.Issues} FAR {F(status.FarPlane)} CAMERA {(status.Inspecting ? "ORBIT" : "GAMEPLAY")}",
+ $"ISSUES {status.Issues} FAR {F(status.FarPlane)} CAMERA {status.CameraMode ?? (status.Inspecting ? "ORBIT" : "GAMEPLAY")}",
"",
"RESUME",
$"CAMERA: {(status.Inspecting ? "SWITCH TO GAMEPLAY" : "SWITCH TO ORBIT")}",
@@ -97,6 +98,7 @@ public sealed class DebugMenu
"LOAD SELECTED LEVEL / START",
"RESET CURRENT START",
$"FORCE CONTROL: {status.ForcedControl} (ENTER TOGGLE)",
+ $"LIVE OVERLAY: {status.DiagnosticsVisible} (F2 / ENTER TOGGLE)",
"",
"UP/DOWN SELECT LEFT/RIGHT CHANGE ENTER APPLY",
"SCENE TASK: PAGE UP/DOWN CHANGES BY 10",
diff --git a/src/GamePort/Application/DebugMenuOverlay.cs b/src/GamePort/Application/DebugMenuOverlay.cs
index c7970c2..432449c 100644
--- a/src/GamePort/Application/DebugMenuOverlay.cs
+++ b/src/GamePort/Application/DebugMenuOverlay.cs
@@ -63,8 +63,9 @@ public sealed class DebugMenuOverlay
/// lines clip at76 characters. selectedLine is -1 or an index into lines.
/// Lowercase renders as uppercase, unsupported characters as question marks.
/// Layout uses the same640x480 reference viewport as the original HUD.
+ /// Compact mode uses a corner panel with58 columns and smaller live text.
///
- public void Update(Mesh destination, IReadOnlyList lines, int selectedLine = -1)
+ public void Update(Mesh destination, IReadOnlyList lines, int selectedLine = -1, bool compact = false)
{
ArgumentNullException.ThrowIfNull(destination);
ArgumentNullException.ThrowIfNull(lines);
@@ -77,7 +78,14 @@ public sealed class DebugMenuOverlay
background.Visible = lines.Count > 0;
highlight.Visible = selectedLine >= 0;
var solid = new Vector2(127.5f / AtlasWidth, 63.5f / AtlasHeight);
- Quad(firstVertex, 18, 18, 604, Math.Clamp(lines.Count * LineHeight + 24, 80, 444), solid, solid, new(.025f, .04f, .07f));
+ var lineHeight = compact ? 10 : LineHeight;
+ var advance = compact ? 6 : CharacterAdvance;
+ var textX = compact ? 16 : 30;
+ var textY = compact ? 16 : 30;
+ var compactColumns = lines.Count == 0 ? 24 : Math.Clamp(lines.Max(line => line?.Length ?? 0), 24, 58);
+ Quad(firstVertex, compact ? 8 : 18, compact ? 8 : 18, compact ? compactColumns * advance + 16 : 604,
+ Math.Clamp(lines.Count * lineHeight + (compact ? 16 : 24), compact ? 30 : 80, 444),
+ solid, solid, new(.025f, .04f, .07f));
Quad(firstVertex + 4, 25, 27 + selectedLine * LineHeight, 590, LineHeight,
solid, solid, new(.07f, .24f, .33f));
for (var row = 0; row < MaxLines; row++)
@@ -89,13 +97,13 @@ public sealed class DebugMenuOverlay
var color = row == 0 ? new Vector3(1, .83f, .35f) : new(.85f, .93f, .98f);
for (var column = 0; column < MaxColumns; column++)
{
- var character = column < line.Length ? char.ToUpperInvariant(line[column]) : ' ';
+ var character = column < line.Length && (!compact || column < 58) ? char.ToUpperInvariant(line[column]) : ' ';
if (character is < ' ' or > '~') character = '?';
var cell = character - ' ';
var x = cell % 16 * 8 + 1;
var y = cell / 16 * 8;
Quad(firstVertex + 8 + (row * MaxColumns + column) * 4,
- 30 + column * CharacterAdvance, 30 + row * LineHeight, 7, 9.8f,
+ textX + column * advance, textY + row * lineHeight, compact ? 5.6f : 7, compact ? 7.84f : 9.8f,
new((float)x / AtlasWidth, (float)y / AtlasHeight),
new((x + 5f) / AtlasWidth, (y + 7f) / AtlasHeight), color);
}
diff --git a/src/GamePort/Program.cs b/src/GamePort/Program.cs
index f92db39..b1610b3 100644
--- a/src/GamePort/Program.cs
+++ b/src/GamePort/Program.cs
@@ -17,9 +17,10 @@ internal static class Program
{
OriginalSave? carriedSave = null;
var returning = false;
+ var diagnostics = new DebugDiagnostics { Enabled = args.Contains("--debug-overlay") };
while (true)
{
- var result = Run(args, carriedSave, returning, out var continuation);
+ var result = Run(args, carriedSave, returning, diagnostics, out var continuation);
if (result != 0 || continuation == null) return result;
args = continuation.Args; carriedSave = continuation.Save; returning = continuation.Returning;
}
@@ -38,7 +39,7 @@ internal static class Program
private sealed record SceneContinuation(string[] Args, OriginalSave Save, bool Returning);
- private static int Run(string[] args, OriginalSave? carriedSave, bool returning, out SceneContinuation? continuation)
+ private static int Run(string[] args, OriginalSave? carriedSave, bool returning, DebugDiagnostics diagnostics, out SceneContinuation? continuation)
{
continuation = null;
if (args.Contains("--help"))
@@ -84,12 +85,14 @@ internal static class Program
--smoke-objective-panel Show original lab objective; --story-time tests timeout
--smoke-objective-window SDL O-key reopen/close/timeout check
--debug-menu Start with the F1 debug menu open
+ --debug-overlay Start with live F2 diagnostics visible
--smoke-debug-menu SDL debug navigation/pause/actions/resize check
+ --smoke-debug-overlay SDL live diagnostics/input/menu/resize check
--verify-assets Decode all original PNG/ASE files
--smoke-window Test keyboard event/resize (requires --frames 6 or more)
--no-validation Disable development validation
Walk: arrows move/turn; Shift, Insert or right mouse jump; R reset.
- F1 debug menu. C pauses into inspection / resumes chase camera. F11 fullscreen, Escape quit.
+ F1 debug menu. F2 live diagnostics. C inspect / chase camera. F11 fullscreen, Escape quit.
Inspector: arrows/WASD orbit, +/- zoom,
F11 fullscreen, Escape quit. Animation preview: 1 idle, 2 run, 3 jump, 4 scratch.
Collision/pivot/cadence and animation timing are provisional. Full gameplay remains incomplete.
@@ -231,6 +234,7 @@ internal static class Program
var practiceWindowSmoke = args.Contains("--smoke-practice-window");
var practiceReturnSmoke = args.Contains("--smoke-practice-return");
var debugSmoke = args.Contains("--smoke-debug-menu");
+ var diagnosticsSmoke = args.Contains("--smoke-debug-overlay");
if (walkSmoke && jetpackSmoke) throw new ArgumentException("Select one movement smoke check");
var defaultStory = (defaultScene || args.Contains("--walk")) && !args.Contains("--inspect") && !walkSmoke && !args.Contains("--smoke-window")
&& animationPath == null && !args.Contains("--time");
@@ -365,9 +369,12 @@ internal static class Program
var storyTime = double.Parse(Option(args, "--story-time") ?? "0", System.Globalization.CultureInfo.InvariantCulture);
if (!double.IsFinite(storyTime) || storyTime < 0 || storyTime > 3600 || storyTime > 0 && !headless)
throw new ArgumentException("Story time must be0..3600 seconds in headless mode.");
- var frames = int.Parse(Option(args, "--frames") ?? (walkSmoke ? "240" : jetpackSmoke ? "300" : objectiveWindowSmoke ? "180" : carlSmoke ? "60" : debugSmoke ? "16" : headless ? "1" : "0"));
+ var frames = int.Parse(Option(args, "--frames") ?? (walkSmoke ? "240" : jetpackSmoke ? "300" : objectiveWindowSmoke ? "180" : carlSmoke ? "60" : debugSmoke ? "16" : diagnosticsSmoke ? "24" : headless ? "1" : "0"));
if (debugSmoke && (headless || frames < 16 || director == null || level?.Code != "LV1B" || loadedSave != null || debugMenu.Open))
throw new ArgumentException("Debug SDL smoke requires fresh windowed LV1B, closed debug menu and at least16 frames");
+ if (diagnosticsSmoke && (headless || frames < 24 || director == null || level?.Code != "LV1B" || loadedSave != null
+ || debugMenu.Open || diagnostics.Enabled || debugSmoke))
+ throw new ArgumentException("Live debug SDL smoke requires fresh windowed LV1B, hidden diagnostics and at least24 frames");
if (objectiveWindowSmoke && (headless || frames < 180)) throw new ArgumentException("Objective window smoke needs180 window frames");
if ((carlSmoke || objectiveSmoke) && (level?.Code != "LV1B" || loadedSave != null || objectiveSmoke && !headless && !objectiveWindowSmoke))
throw new ArgumentException("Lab conversation/objective smoke requires fresh LV1B (objective check is headless)");
@@ -424,7 +431,7 @@ internal static class Program
Console.WriteLine($"Practice RETURN: exact saved root={restored}, root={simulation.ActorRoot}, STRT yaw={simulation.Yaw}, intro suppressed={!director.Playing}, companion restored={companionRestored}.");
if (!restored) throw new InvalidOperationException("RETURN did not restore the live departure root without replaying STRT actions");
}
- if (args.Contains("--skip-intro") || jetpackSmoke || debugSmoke) { sceneAudio?.StopSpeech(); director.Skip(); }
+ if (args.Contains("--skip-intro") || jetpackSmoke || debugSmoke || diagnosticsSmoke) { sceneAudio?.StopSpeech(); director.Skip(); }
if (practiceReturnSmoke && level.Code == "VR04")
{
director.Skip();
@@ -509,12 +516,21 @@ internal static class Program
double last = clock.Elapsed.TotalSeconds;
float angle = 0.6f, elevation = 0.32f;
var count = 0;
+ var lastPresentedAt = clock.Elapsed.TotalSeconds;
var debugPauseObserved = false;
var debugActionsObserved = false;
var debugEscapeObserved = false;
var debugResumeObserved = false;
var debugForceObserved = false;
float debugForceTravel = 0;
+ var diagnosticsShown = false;
+ var diagnosticsHidden = false;
+ var diagnosticsMoves = false;
+ var diagnosticsMenuPriority = false;
+ var diagnosticsPreference = false;
+ var diagnosticsMenuToggle = false;
+ var diagnosticsPausedSteps = 0;
+ var diagnosticsInitialTravel = simulation?.Travel ?? 0;
var debugPausedRoot = simulation?.ActorRoot ?? Vector3.Zero;
var debugPausedSteps = simulation?.Steps ?? 0;
void ResetScene()
@@ -570,6 +586,9 @@ internal static class Program
case DebugAction.ForceControl when director != null:
director.DebugForceControl = !director.DebugForceControl;
debugMenu.Message = $"FORCE CONTROL {director.DebugForceControl}; CLOSE MENU TO RESUME"; break;
+ case DebugAction.ToggleOverlay:
+ diagnostics.Enabled = !diagnostics.Enabled;
+ debugMenu.Message = $"LIVE OVERLAY {diagnostics.Enabled}; F2 TOGGLE DURING PLAY"; break;
case DebugAction.None: break;
default: debugMenu.Message = "ACTION REQUIRES PLAY MODE"; break;
}
@@ -609,6 +628,12 @@ internal static class Program
{ active = true; stepClock.Reset(); last = clock.Elapsed.TotalSeconds; }
if (e.Type == Sdl.KeyUp && debugCapturedKeys.Remove(e.Scancode)) continue;
if (e.Type == Sdl.KeyDown && !debugMenu.Open && debugCapturedKeys.Contains(e.Scancode)) continue;
+ if (e.Type == Sdl.KeyDown && e.Scancode == DebugDiagnostics.ToggleKey)
+ {
+ debugCapturedKeys.Add(e.Scancode);
+ if (e.Repeat == 0) diagnostics.Enabled = !diagnostics.Enabled;
+ continue;
+ }
if (e.Type == Sdl.KeyDown && e.Scancode == DebugMenu.ToggleKey)
{
debugCapturedKeys.Add(e.Scancode);
@@ -675,9 +700,9 @@ internal static class Program
var dt = (float)Math.Min(elapsed, 0.1);
last = now;
if (debugMenu.Open) animationStarted += elapsed;
- if (simulation != null && !debugMenu.Open && !inspecting && !practice.Active && (active || headless || walkSmoke || jetpackSmoke || objectiveWindowSmoke || debugSmoke))
+ if (simulation != null && !debugMenu.Open && !inspecting && !practice.Active && (active || headless || walkSmoke || jetpackSmoke || objectiveWindowSmoke || debugSmoke || diagnosticsSmoke))
{
- var steps = headless || walkSmoke || jetpackSmoke || practiceWindowSmoke || carlSmoke || objectiveWindowSmoke || debugSmoke ? 1 : stepClock.Advance(elapsed);
+ var steps = headless || walkSmoke || jetpackSmoke || practiceWindowSmoke || carlSmoke || objectiveWindowSmoke || debugSmoke || diagnosticsSmoke ? 1 : stepClock.Advance(elapsed);
for (var step = 0; step < steps; step++)
{
var input = carlSmoke ? new PlayerInput(true, false, true, false, true)
@@ -752,13 +777,26 @@ internal static class Program
objectivePanel?.Step(0, director?.ControlledTag != null, practice.Active);
hud?.Update(mesh, interactions!.CurrentObjective, level!.Code == "LV1B" && objectivePanel!.PadVisible,
practice.Active, objectivePanel!.YOffset, objectivePanel.ContentVisible);
- var debugView = debugMenu.View(new(level?.Code ?? "PREVIEW", originalStart?.Tag ?? "NONE",
+ var gameplayProjection = originalCamera || simulation != null && !inspecting;
+ var cameraMode = !inspecting && director?.CameraEye != null ? "CUTSCENE"
+ : simulation != null && !inspecting ? "GAMEPLAY" : originalCamera ? "STRT" : "ORBIT";
+ var debugStatus = new DebugStatus(level?.Code ?? "PREVIEW", originalStart?.Tag ?? "NONE",
simulation?.ActorRoot ?? Vector3.Zero, simulation?.Yaw ?? 0, simulation?.Speed ?? 0,
simulation?.Grounded ?? false, simulation?.Energy ?? 0, interactions?.Score ?? 0,
storyTasks?.Get("SCENE") ?? 0, director?.CurrentTag ?? "NONE", director?.Controlled ?? false,
- director?.Issues.Count ?? 0, SceneProjection.FarPlane(level?.Code), inspecting, director?.DebugForceControl ?? false));
- debugOverlay.Update(mesh, debugView.Lines, debugView.SelectedLine);
- var projection = originalCamera || simulation != null && !inspecting
+ (director?.Issues.Count ?? 0) + (interactions?.Unsupported.Count ?? 0) + (mechanisms?.Unsupported.Count ?? 0),
+ gameplayProjection ? SceneProjection.FarPlane(level?.Code) : radius * 20,
+ inspecting, director?.DebugForceControl ?? false, diagnostics.Enabled, cameraMode);
+ var debugView = debugMenu.View(debugStatus);
+ var liveDebugLines = diagnostics.Lines(debugStatus, new(simulation?.Velocity ?? Vector3.Zero,
+ simulation?.TurnRate ?? 0, simulation?.Pose.ToString() ?? "NONE", simulation?.Steps ?? 0,
+ simulation?.Jumps ?? 0, simulation?.WallHits ?? 0, interactions?.Inventory.State(0, 3) ?? 0,
+ simulation?.JetpackRemaining ?? 0, director?.CurrentShot ?? -1, director?.Blocked ?? false,
+ renderer.ValidationErrors, debugMenu.Open || practice.Active || inspecting || !active));
+ var liveDebugVisible = !debugMenu.Open && liveDebugLines.Length > 0;
+ debugOverlay.Update(mesh, debugMenu.Open ? debugView.Lines : liveDebugLines,
+ debugMenu.Open ? debugView.SelectedLine : -1, compact: !debugMenu.Open);
+ var projection = gameplayProjection
? SceneProjection.CreateGameplay(level?.Code, (float)renderer.Width / renderer.Height)
: Matrix4x4.CreatePerspectiveFieldOfView(MathF.PI / 3, (float)renderer.Width / renderer.Height, Math.Max(radius / 10000, 0.01f), radius * 20);
projection.M22 *= -1;
@@ -770,9 +808,62 @@ internal static class Program
}
renderer.UpdateVertices(mesh.Vertices);
renderer.Render(view * projection);
+ var presentedAt = clock.Elapsed.TotalSeconds;
+ diagnostics.ObserveFrame(presentedAt - lastPresentedAt);
+ lastPresentedAt = presentedAt;
count++;
audio?.Pump();
sceneAudio?.Pump();
+ if (diagnosticsSmoke)
+ {
+ void Push(uint key, bool down = true, bool repeat = false)
+ {
+ var e = new Sdl.Event { Type = down ? Sdl.KeyDown : Sdl.KeyUp, Scancode = key,
+ Down = down ? (byte)1 : (byte)0, Repeat = repeat ? (byte)1 : (byte)0 };
+ if (!Sdl.SDL_PushEvent(ref e)) throw new InvalidOperationException(Sdl.Error);
+ }
+ void Tap(uint key) { Push(key); Push(key, false); }
+ if (count == 1)
+ {
+ Push(82); Push(DebugDiagnostics.ToggleKey); Push(DebugDiagnostics.ToggleKey, repeat: true);
+ Push(DebugDiagnostics.ToggleKey, false);
+ if (!Sdl.SDL_SetWindowSize(window, 800, 600)) throw new InvalidOperationException(Sdl.Error);
+ }
+ if (count == 3)
+ diagnosticsShown = liveDebugVisible && !debugMenu.Open && sceneAudio?.Paused != true && liveDebugLines.Length == 12;
+ if (count == 4) Tap(DebugDiagnostics.ToggleKey);
+ if (count == 5) diagnosticsHidden = !liveDebugVisible && !diagnostics.Enabled && simulation!.Steps >= 5;
+ if (count == 6) Tap(DebugDiagnostics.ToggleKey);
+ if (count == 8)
+ {
+ diagnosticsMoves = liveDebugVisible && simulation!.Travel > diagnosticsInitialTravel + 5;
+ diagnosticsPausedSteps = simulation!.Steps;
+ Tap(DebugMenu.ToggleKey);
+ }
+ if (count == 9)
+ {
+ diagnosticsMenuPriority = debugMenu.Open && diagnostics.Enabled && !liveDebugVisible
+ && simulation!.Steps == diagnosticsPausedSteps && sceneAudio?.Paused != false;
+ Tap(DebugDiagnostics.ToggleKey);
+ }
+ if (count == 10)
+ {
+ diagnosticsPreference = !diagnostics.Enabled && debugMenu.Open && sceneAudio?.Paused != false;
+ Tap(DebugDiagnostics.ToggleKey); Tap(DebugMenu.ToggleKey);
+ }
+ if (count == 11)
+ {
+ diagnosticsPreference &= diagnostics.Enabled && liveDebugVisible && !debugMenu.Open && sceneAudio?.Paused != true;
+ Push(82, false); Push(82);
+ }
+ if (count == 16) Tap(DebugDiagnostics.ToggleKey);
+ if (count == 18)
+ {
+ Tap(DebugMenu.ToggleKey); Tap(82); Tap(40); Tap(41); // Last menu row toggles the live panel.
+ }
+ if (count == 19) diagnosticsMenuToggle = diagnostics.Enabled && liveDebugVisible && !debugMenu.Open;
+ if (count == 20) Push(82, false);
+ }
if (debugSmoke)
{
void Push(uint key, bool down = true, bool repeat = false)
@@ -862,7 +953,7 @@ internal static class Program
if (!Sdl.SDL_PushEvent(ref cycle)) throw new InvalidOperationException(Sdl.Error);
}
}
- if ((smoke || walkSmoke || jetpackSmoke || practiceWindowSmoke || objectiveWindowSmoke || debugSmoke) && renderer.Width == 800 && renderer.Height == 600) didResize = true;
+ if ((smoke || walkSmoke || jetpackSmoke || practiceWindowSmoke || objectiveWindowSmoke || debugSmoke || diagnosticsSmoke) && renderer.Width == 800 && renderer.Height == 600) didResize = true;
if (frames > 0 && count >= frames) break;
if (transitionRequest != null) break;
}
@@ -877,6 +968,13 @@ internal static class Program
if (Math.Abs(pixels[i] - 31) + Math.Abs(pixels[i + 1] - 51) + Math.Abs(pixels[i + 2] - 76) > 6) changed++;
Console.WriteLine($"Rendered {count} frame(s), {changed} non-background pixels, {renderer.ValidationErrors} Vulkan validation error(s).");
if (simulation != null) Console.WriteLine(simulation.Report);
+ if (diagnostics.Enabled) Console.WriteLine($"Live debug overlay: enabled=True, frame samples={diagnostics.Frames}.");
+ if (diagnosticsSmoke)
+ {
+ Console.WriteLine($"Live debug SDL check: shown={diagnosticsShown}, hidden={diagnosticsHidden}, movement={diagnosticsMoves}, menu priority={diagnosticsMenuPriority}, preference={diagnosticsPreference}, menu toggle={diagnosticsMenuToggle}, resize800x600={didResize}.");
+ if (!diagnosticsShown || !diagnosticsHidden || !diagnosticsMoves || !diagnosticsMenuPriority
+ || !diagnosticsPreference || !diagnosticsMenuToggle || !didResize) return 2;
+ }
if (debugSmoke)
{
Console.WriteLine($"Debug SDL check: paused={debugPauseObserved}, actions={debugActionsObserved}, Escape/input capture={debugEscapeObserved}, resumed={debugResumeObserved}, forced movement during MCA={debugForceObserved}, resize800x600={didResize}.");
@@ -934,7 +1032,7 @@ internal static class Program
for (var i = 0; i < args.Length; i++)
{
if (args[i] is "--smoke-transition" or "--smoke-lab-route" or "--smoke-practice-prompt" or "--smoke-practice-transition"
- or "--debug-menu" or "--smoke-debug-menu") continue;
+ or "--debug-menu" or "--smoke-debug-menu" or "--smoke-debug-overlay") continue;
if (args[i] is "--scene" or "--level" or "--start" or "--load-save" or "--story-time") { i++; continue; }
nextArgs.Add(args[i]);
}
@@ -974,7 +1072,7 @@ internal static class Program
}
}
- private const string WalkTitle = "Jimmy Neutron — lab checkpoint | Arrows move | Shift / Insert / right mouse jump | F1 debug | R reset | C inspect";
+ private const string WalkTitle = "Jimmy Neutron — lab checkpoint | Arrows move | Shift / Insert / right mouse jump | F1 menu | F2 overlay | R reset | C inspect";
private static int VerifyAssets(string root)
{
diff --git a/tests/GamePort.DebugDiagnosticsTests/GamePort.DebugDiagnosticsTests.csproj b/tests/GamePort.DebugDiagnosticsTests/GamePort.DebugDiagnosticsTests.csproj
new file mode 100644
index 0000000..f1bc92c
--- /dev/null
+++ b/tests/GamePort.DebugDiagnosticsTests/GamePort.DebugDiagnosticsTests.csproj
@@ -0,0 +1,9 @@
+
+ Exenet10.0enableenablefalse
+
+
+
+
+
+
+
diff --git a/tests/GamePort.DebugDiagnosticsTests/Program.cs b/tests/GamePort.DebugDiagnosticsTests/Program.cs
new file mode 100644
index 0000000..55d639e
--- /dev/null
+++ b/tests/GamePort.DebugDiagnosticsTests/Program.cs
@@ -0,0 +1,80 @@
+using System.Globalization;
+using System.Numerics;
+using GamePort.Application;
+
+var diagnostics = new DebugDiagnostics();
+var status = new DebugStatus("LV1B", "STARTEXP", new(1.25f, 76.5f, -3.5f), 155, 600,
+ true, 20, 150, 60, "NONE", true, 2, 10000, false);
+var motion = new DebugMotion(new(100, -20, 30), -12.5f, "RUN", 120, 1, 2, 1, 7.5f, -1, false, 0, false);
+Require(!diagnostics.Enabled && diagnostics.Lines(status, motion).Length == 0, "Live overlay starts hidden");
+diagnostics.ObserveFrame(0);
+Require(diagnostics.Frames == 1 && diagnostics.FramesPerSecond == 0 && diagnostics.FrameMilliseconds == 0,
+ "A zero-duration headless frame counts without inventing timing");
+diagnostics.ObserveFrame(.125);
+Near(diagnostics.FramesPerSecond, 8, "Initial timing is immediately usable");
+Near(diagnostics.FrameMilliseconds, 125, "Frame time uses elapsed wall time");
+diagnostics.ObserveFrame(.25);
+Near(diagnostics.FramesPerSecond, 2 / .375, "Initial window updates its running mean");
+diagnostics.ObserveFrame(.125);
+Near(diagnostics.FramesPerSecond, 6, "Half-second equality publishes a complete window");
+diagnostics.ObserveFrame(.25);
+Near(diagnostics.FramesPerSecond, 6, "Published timing stays stable until the next window completes");
+diagnostics.ObserveFrame(0);
+diagnostics.ObserveFrame(.25);
+Near(diagnostics.FramesPerSecond, 4, "Zero samples do not inflate the next window's FPS");
+Near(diagnostics.FrameMilliseconds, 250, "Next window measures only its own positive elapsed samples");
+Require(diagnostics.Frames == 7, "Frame count includes zero-duration frames across windows");
+Console.WriteLine("PASS live frame timing, initial mean, half-second boundaries and zero samples");
+
+foreach (var invalid in new[] { -1, double.NaN, double.PositiveInfinity, double.NegativeInfinity })
+{
+ var frames = diagnostics.Frames;
+ Reject(() => diagnostics.ObserveFrame(invalid));
+ Require(diagnostics.Frames == frames, "Rejected input cannot mutate timing counters");
+}
+var extreme = new DebugDiagnostics();
+extreme.ObserveFrame(double.Epsilon);
+Require(double.IsFinite(extreme.FramesPerSecond) && double.IsFinite(extreme.FrameMilliseconds), "Tiny finite elapsed cannot produce infinite FPS");
+extreme.ObserveFrame(double.MaxValue);
+Require(double.IsFinite(extreme.FramesPerSecond) && double.IsFinite(extreme.FrameMilliseconds), "Large finite elapsed cannot produce infinite frame milliseconds");
+Console.WriteLine("PASS invalid elapsed rejection and finite timing arithmetic");
+
+diagnostics.Enabled = true;
+var originalCulture = CultureInfo.CurrentCulture;
+var unusual = (CultureInfo)CultureInfo.InvariantCulture.Clone();
+unusual.NumberFormat.NumberDecimalSeparator = ",";
+unusual.NumberFormat.NegativeSign = "NEG";
+CultureInfo.CurrentCulture = unusual;
+string[] lines;
+try { lines = diagnostics.Lines(status, motion); }
+finally { CultureInfo.CurrentCulture = originalCulture; }
+Require(lines.Length == 12 && lines.All(l => l.Length <= 58), "Live diagnostics fit the compact overlay bounds");
+Require(lines[2].Contains("76.5") && lines[2].Contains("-3.5") && !lines.Any(l => l.Contains("NEG")), "Numeric output is invariant under user culture");
+Require(lines[6] == "CTRL T FORCE F PAUSED F", "Control and pause diagnostics use live state");
+Require(lines[7].Contains("SCENE 60 SCORE 150 JETPACK 1 7.5S"), "Task, score, ownership and burst countdown are visible together");
+var changedStatus = status with { Root = new(40, 50, 60), ForcedControl = true, Inspecting = true, Cutscene = "neutron1a" };
+var changedMotion = motion with { Velocity = new(0, 500, 0), Pose = "FLY", Shot = 2, Blocked = true, Paused = true, VulkanErrors = 3 };
+var changed = diagnostics.Lines(changedStatus, changedMotion);
+Require(changed[2] != lines[2] && changed[3] != lines[3] && changed[5].Contains("FLY"), "Motion and position text changes with every live snapshot");
+Require(changed[6] == "CTRL T FORCE T PAUSED T" && changed[8].Contains("ORBIT") && changed[9].Contains("neutron1a SHOT 2 BLOCK T")
+ && changed[11].Contains("VK ERR 3"), "Force/camera/cutscene/block/Vulkan diagnostics stay independent");
+var authoredView = diagnostics.Lines(changedStatus with { CameraMode = "STRT", FarPlane = 5000 }, changedMotion);
+Require(authoredView[8] == "CAM STRT FAR 5000.0", "Actual rendered camera/projection can override inferred mode");
+var bounded = diagnostics.Lines(changedStatus with { Start = new string('X', 200), Cutscene = "line\nbreak" }, changedMotion);
+Require(bounded.All(l => l.Length <= 58 && !l.Contains('\n') && !l.Contains('\r')), "Long or multiline source tags cannot escape the compact panel");
+diagnostics.Enabled = false;
+Require(diagnostics.Lines(changedStatus, changedMotion).Length == 0 && status.Root == new Vector3(1.25f, 76.5f, -3.5f),
+ "Hiding diagnostics does not mutate gameplay snapshots");
+Console.WriteLine("PASS compact live snapshots, invariant formatting, visibility and label bounds");
+
+static void Require(bool condition, string message)
+{
+ if (!condition) throw new InvalidOperationException(message);
+}
+static void Near(double actual, double expected, string message) => Require(Math.Abs(actual - expected) < .000001, message);
+static void Reject(Action action)
+{
+ try { action(); }
+ catch (ArgumentOutOfRangeException) { return; }
+ throw new InvalidOperationException("Expected invalid elapsed rejection");
+}
diff --git a/tests/GamePort.DebugMenuTests/Program.cs b/tests/GamePort.DebugMenuTests/Program.cs
index de782d8..72bbf4b 100644
--- a/tests/GamePort.DebugMenuTests/Program.cs
+++ b/tests/GamePort.DebugMenuTests/Program.cs
@@ -7,11 +7,14 @@ Require(!menu.Open && menu.Key(40) == DebugAction.None, "Closed menu cannot issu
menu.Toggle(30);
Require(menu.Open && menu.SceneTask == 30 && menu.Start == "STARTEXP", "F1 opens current context");
menu.Key(82);
+Require(menu.Selected == 11 && menu.Key(40) == DebugAction.ToggleOverlay,
+ "Live overlay has an independent menu toggle");
+menu.Key(82);
Require(menu.Selected == 10 && menu.Key(40) == DebugAction.ForceControl && menu.Key(40, true) == DebugAction.None,
"Force-control row emits one command per Enter press");
menu.Key(82);
Require(menu.Selected == 9 && menu.Key(40) == DebugAction.Reset, "Navigation wraps to reset");
-menu.Key(81); menu.Key(81);
+menu.Key(81); menu.Key(81); menu.Key(81);
Require(menu.Selected == 0 && menu.Key(40, true) == DebugAction.None && menu.Key(40) == DebugAction.Resume,
"Enter repeats cannot repeat commands");
for (var i = 0; i < 5; i++) menu.Key(81);
diff --git a/tests/GamePort.DebugOverlayTests/Program.cs b/tests/GamePort.DebugOverlayTests/Program.cs
index d3ff180..c60a64c 100644
--- a/tests/GamePort.DebugOverlayTests/Program.cs
+++ b/tests/GamePort.DebugOverlayTests/Program.cs
@@ -17,6 +17,15 @@ Check(final.Draws.Skip(1).Count(d => d.Visible) == 5, "Background, selected row
Check(final.Vertices[1].Position != Vector3.Zero && overlay.Mesh.Vertices[1].Position == Vector3.Zero,
"Update targets final copied buffer");
Check(final.Vertices.All(v => float.IsFinite(v.Position.X + v.Position.Y + v.Uv.X + v.Uv.Y)), "All overlay coordinates finite");
+var menuRight = final.Vertices[2].Position.X;
+var menuBottom = final.Vertices[3].Position.Y;
+overlay.Update(final, ["F2 LIVE DEBUG", "POSITION X 1.0 Y 2.0 Z 3.0"], compact: true);
+Check(final.Vertices[2].Position.X < menuRight && final.Vertices[3].Position.Y < menuBottom,
+ "Live panel occupies a smaller corner while preserving world geometry");
+Check(final.Draws.Skip(1).Count(d => d.Visible) == 3, "Live panel has no selected menu row");
+overlay.Update(final, ["Menu", "Resume", "Camera"], 1);
+Check(final.Vertices[2].Position.X == menuRight && final.Vertices[3].Position.Y == menuBottom,
+ "Returning to menu restores its full layout using the same buffers");
overlay.Update(final, [new string('X', 100)], -1);
Check(final.Draws.Skip(1).Count(d => d.Visible) == 2, "Long labels clip to bounded text range");
overlay.Update(final, []);