Found: `CameraController::setMoveScale()` is a dead knob

Open
#30 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
65/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Quiet
Tech stack
cpp
Domain
game-dev

Research direction

Read gui_client/CameraController.h and .cpp, then inspect MainWindow.cpp:5826 and the three processMove* functions in gui_client/PlayerPhysics.cpp. Confirm whether move_speed_scale should affect movement or whether the setter and startup call should be removed. Done means the API is no longer misleading and the intended movement-speed behavior is covered by the relevant existing checks.

Written by the indexing model from the issue text.

Description

Found: CameraController::setMoveScale() is a dead knob

What we were doing

Adding a "Camera speed" multiplier slider to the Photo Mode UI, backed by
CameraController::setMoveScale(). Slider changes speed live while walking
around a splat scene, log-scale, 0.001× - 10×.

How we noticed

The slider was wired to setMoveScale(), but dragging it did nothing to the
camera's actual movement speed. Investigating why revealed the surprise below.

The finding

CameraController::move_speed_scale is written but never read.

  • Set once at app startup:
    MainWindow.cpp:5826 cam_controller.setMoveScale(0.3f);
  • Set by CameraController::setMoveScale() on demand.
  • Read: nowhere in substrata/gui_client or glare-core. PlayerPhysics.cpp
    (which is what actually turns key-presses into move_desired_vel) uses a
    local static const float move_speed = 3; and never consults the
    CameraController for a scale.

So the setMoveScale(0.3f) call at startup is a no-op — the effective
in-game speed for every user has always been the raw move_speed = 3 in
PlayerPhysics.cpp, unaffected by the 0.3. The setMoveScale() API looks
functional from the outside (has a setter, has a member, header comment
"Adjust camera movement speed based on world scale"), so an author landing
new UI on it — as we did — quite reasonably assumes it works.

Why it looks strange

Either:

  • The 0.3× was meant to apply and something later refactored it out
    accidentally, in which case the whole app has silently been walking at 3.3×
    the intended speed for however long.
  • Or the scale mechanism was intended but never finished, in which case the
    startup call and the setter should probably be removed to stop misleading
    future contributors.

Either way, current state is a "ghost knob": present, documented, and inert.

Relevant source files

All paths relative to the substrata repo root.

  • gui_client/CameraController.h — declares setMoveScale() (line ~41) and
    the private move_speed_scale field.
  • gui_client/CameraController.cpp — the setter body (writes the field), the
    constructor default (move_speed_scale = 1;). No reader.
  • gui_client/MainWindow.cpp:5826 — the only in-repo call site of
    setMoveScale() before this change (setMoveScale(0.3f) at app startup).
  • gui_client/PlayerPhysics.cpp — the read side that isn't there. The three
    processMove* functions (processMoveForwards, processStrafeRight,
    processMoveUp) compute move_desired_vel from a hardcoded
    static const float move_speed = 3; and never consult the
    CameraController for a scale. This is the file where a one-line
    * cam.getMoveScale() on each of the three additions would make the setter
    do what its name suggests.

What we did about it in our own build

To make the Photo Mode slider work at all, we:

  1. Multiplied move_desired_vel by cam.getMoveScale() in the three
    PlayerPhysics::processMove* functions (Forwards, StrafeRight, MoveUp).
  2. Added a CameraController::getMoveScale() const getter alongside the
    existing setter.
  3. Kept the startup setMoveScale(0.3f) untouched so default in-game speed
    does not change for existing users — the slider's "1×" label reflects
    that baseline (slider multiplier × 0.3 → the move_speed_scale field).
Dominant language
C
Stars
85
Forks
18
PR merge metrics
No merged PRs in 30d

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from glaretechnologies/substrata

All issues in glaretechnologies/substrata

Similar issues

More C issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.