Crusader_Decomp/docs/scummvm/smooth-camera-analysis.md
Marco 3b2561b053 Add build scripts, documentation, and smooth camera analysis for ScummVM's Ultima VIII engine
- Introduced `build-scummvm.ps1` and `run-scummvm.ps1` scripts for building and running the ScummVM project with MSVC.
- Created `phase-0-evidence-compatibility-gate.md` to outline the evidence and compatibility gate for the Crusader project.
- Added `smooth-camera-analysis.md` detailing the proposed smooth camera behavior and regression checks.
- Documented the Visual Studio build process in `visual-studio-build.md`, including prerequisites and steps for generating the Ultima solution.
- Updated `startup-map-patch-file.md` to clarify the behavior of the fixed-map and glob archives in the GOG installation.
2026-10-09 16:59:29 +02:00

39 lines
4.1 KiB
Markdown

# Crusader Smooth Camera Analysis
**Status:** Implementation applied; build and regression checks pending
**Scope:** ScummVM's Ultima VIII engine camera behavior for No Remorse and No Regret
## Existing Behavior
- The existing `Camera moves with Silencer` option is `camera_on_player`. It is listed for Remorse, Regret, and the Regret demo, and defaults to enabled. Its purpose is to choose player tracking instead of map-defined camera snap positions.
- In `SnapProcess::run()`, the option bypasses snap-egg selection and uses the controlled actor's center. If the active camera process is not already tracking the actor by object ID, the code replaces it with a point camera at that center.
- The Z action is separately bound as `Center screen on Silencer`. Its handler creates a point camera at the actor's center; it does not change the camera's persistent target to the actor.
- Therefore, the follow option is not simply a continuously repeated Z key. On initial game/map setup, the camera can track the actor as an item. If Z or another operation changes it to a point camera, the enabled follow option re-centers it from `SnapProcess` on subsequent ticks. The visible effect can resemble repeated recentering in that fallback path, but the camera process and update paths differ.
- `CameraProcess::GetLerped()` interpolates between the previous and next camera endpoints using the renderer's frame interpolation factor. With no timed scroll active, those endpoints are refreshed on process ticks. Timed camera scrolling uses a linear, frame-count-based interpolation. Neither path currently provides a distinct multi-frame easing option.
## Recommended Option
Add an independent smooth-camera game option, defaulting off so existing behavior remains unchanged. Keep `camera_on_player` as the target-policy choice: follow the player, or use the map's snap eggs. The new option should control how the camera moves toward whichever target that policy selects.
When smoothing is enabled, retain a stable camera process and ease its position toward the current target over multiple updates. In player-follow mode, the target moves with the actor; in snap mode, the target changes when a new snap egg is selected. Avoid replacing the camera process every tick, since that restarts the transition and can prevent convergence.
Keep cutscene/stasis camera control and explicit scripted camera commands authoritative. Preserve current behavior for map changes, teleports, and save/load unless their transition policy is deliberately specified. Camera easing must continue updating the map fast area along the actual camera path; it must not change actor coordinates or collision behavior.
## Regression Checks
- With smoothing off, both Remorse and Regret retain the current camera behavior.
- With smoothing on and player-follow off, entering a different snap-egg region moves the camera monotonically to the new anchor, then settles exactly on it.
- With smoothing on and player-follow on, actor movement produces continuous camera motion without restarting the camera process each tick.
- Compare the same movement at different frame rates and verify similar elapsed-time motion and exact convergence.
- Verify Z still performs its documented recenter action, and that the option's fallback from a point camera does not cause jitter or a never-ending transition.
- Check cutscenes/stasis, scripted `moveTo` and `scrollTo`, map changes, teleports, and save/load so smoothing does not override intentional camera control.
- Confirm fast-area updates remain valid during a multi-frame transition and do not introduce missed or prematurely activated world objects.
## Source References
- [`SnapProcess`](../../../scummvm/engines/ultima/ultima8/world/snap_process.cpp)
- [`CameraProcess`](../../../scummvm/engines/ultima/ultima8/world/camera_process.cpp)
- [`GameMapGump`](../../../scummvm/engines/ultima/ultima8/gumps/game_map_gump.cpp)
- [Ultima game options](../../../scummvm/engines/ultima/metaengine.cpp)
- [Crusader key binding](../../../scummvm/engines/ultima/ultima8/metaengine.cpp)
- [Crusader option registration](../../../scummvm/engines/ultima/detection_tables.h)