ledcube3d/AGENTS.md

6.6 KiB

LED Cube 3D Project Context

This file is the handoff note for AI coding agents working on this Unreal project. Read it before making changes, and update it whenever you make a meaningful project, architecture, workflow, or debugging decision.

User Language And Workflow

  • The user speaks Russian and prefers direct, practical progress.
  • Keep answers in Russian unless the user asks otherwise.
  • The user wants implementation on this machine, then verification in Unreal Editor/PIE.
  • Ask questions only at important decision points. Prefer inspecting the project and making reasonable engineering choices.
  • Do not revert unrelated dirty Unreal-generated files in Saved, Intermediate, DerivedDataCache, or tmp.

Project Goal

Build an Unreal Engine 5.8 visualizer for a physical volumetric LED display:

  • Target physical layout: 120 x 120 x 120 LEDs.
  • Physical interpretation: a 10m-scale hanging LED matrix/curtain made of vertical strings and cabinet lines.
  • Cabinet layout currently modeled as 20 x 20 cabinets, 6 x 6 dots per cabinet, 120 LEDs per string.
  • LEDs should look like real suspended beads/lenses, not a perfectly clean abstract cube.
  • Wires between LEDs should be white/matte, visible, and physical-looking.
  • LEDs should have slight random imperfection/jitter, not perfect alignment.
  • User wants control through Unreal Remote Control Web API and a custom dashboard.

Current Architecture

Main C++ files:

  • Source/ledcube3d/LedVolumeDisplayActor.*

    • Main display actor.
    • Owns instanced/GPU-style LED rendering and physical matrix support.
    • Supports voxel shapes, test patterns, physical wires/fixers/cabinets, and sublevel/source modes.
  • Source/ledcube3d/LedVolumeRemoteControlActor.*

    • Remote-control-facing actor.
    • Mirrors editable properties to ALedVolumeDisplayActor.
    • Exposed in Remote Control preset as LED_Remote_Control.
    • Calls ApplyToTarget, RebuildTarget, SyncFromTarget.
  • Source/ledcube3d/ledcube3d.cpp

    • Game module plus editor helpers.
    • Opens demo map if the editor starts empty.
    • Builds/updates /Game/LedVolume/RemoteControl/RCP_LedVolumeLive.
    • Disables editor/background throttling needed for remote control while the editor is minimized.

Web dashboard:

  • Source: Web/RemoteControlDashboard/index.html
  • Runtime copy used by UE Remote Control Web Interface: C:/Program Files/Epic Games/UE_5.8/Engine/Plugins/VirtualProduction/RemoteControlWebInterface/WebApp/Server/public/index.html
  • Dashboard uses /api/proxy so LAN clients can use http://192.168.170.218:30000/ even though UE HTTP API listens on 127.0.0.1:30010.
  • After property writes, dashboard calls ApplyToTarget immediately so changes do not wait for viewport/game ticks.

Important maps/assets:

  • Demo map: /Game/LedVolume/Maps/L_LedVolume_Demo_Single
  • Rotating cube sublevel exists for earlier voxelization tests: /Game/LedVolume/Maps/L_RotatingCube_Sublevel
  • Remote Control preset: /Game/LedVolume/RemoteControl/RCP_LedVolumeLive

Remote Control / Minimized Editor Notes

The user reported that Remote Control worked only while Unreal was active; when Editor/PIE was minimized, updates stopped.

Current fix:

  • Config/DefaultGame.ini sets:
    • t.IdleWhenNotForeground=0
    • Slate.bAllowThrottling=0
    • Slate.AllowSlateToSleep=0
    • Slate.ThrottleWhenMouseIsMoving=0
  • Config/DefaultEditorSettings.ini sets:
    • bThrottleCPUWhenNotForeground=False
    • bAllowSlateThrottling=False
  • FLedcube3dModule::ConfigureUnattendedRemoteControl() enforces these settings at startup and periodically.
  • ALedVolumeRemoteControlActor and ALedVolumeDisplayActor have PrimaryActorTick.bTickEvenWhenPaused = true.
  • PostEditChangeProperty on the remote control actor applies immediately.

Verification already performed:

  • Built with: C:/Program Files/Epic Games/UE_5.8/Engine/Build/BatchFiles/Build.bat ledcube3dEditor Win64 Development -Project="C:/Users/post/Documents/Unreal Projects/ledcube3d/ledcube3d.uproject" -WaitMutex -FromMsBuild
  • Launched editor with: UnrealEditor.exe "C:/Users/post/Documents/Unreal Projects/ledcube3d/ledcube3d.uproject" -EnablePython -RCWebInterfaceEnable -ModelContextProtocolStartServer -ModelContextProtocolPort=8000
  • Confirmed:
    • http://127.0.0.1:30000/ serves the custom page.
    • PUT http://127.0.0.1:30000/api/proxy can call /remote/presets.
    • ApplyToTarget returns 200.
  • With the Unreal window minimized, a property write plus ApplyToTarget still succeeds through the proxy.

Remote Control parameter persistence:

  • ALedVolumeRemoteControlActor saves live Remote Control settings to local config under [LedVolume.RemoteControl].
  • In editor this lands in Saved/Config/WindowsEditor/GameUserSettings.ini, which is intentionally ignored.
  • Settings are loaded in PostLoad, BeginPlay, and first tick, then applied to the display actor.
  • ApplyToTarget and SyncFromTarget save the current settings immediately.
  • Verified by setting ApplyDebounceSeconds=0.11, restarting Unreal Editor, and reading the same value back through the Remote Control API.

Git History Milestones

Recent commits:

  • f9d3787 - Model physical LED curtain display
  • 72b9174 - Add LED remote control dashboard
  • 148ffec - Proxy dashboard API through web server
  • ae97ea7 - Keep remote control responsive in background
  • ae011fe - Add AI agent project context

Public Repository

Primary public Forgejo repository:

  • Web: http://192.168.170.41:3000/post/ledcube3d
  • Git remote: http://192.168.170.41:3000/post/ledcube3d.git
  • Primary local remote name: origin
  • Previous GitHub remote, if present: github

Local credentials are stored on this machine in .env.local, which must remain ignored and uncommitted. Use Scripts/PushForgejo.ps1 to push with the local token without putting the token into .git/config.

Important Working Tree Rules

  • Unreal generates a lot of local noise in:
    • Intermediate/
    • Saved/
    • DerivedDataCache/
    • tmp/
  • These generated folders are intentionally ignored and should not be tracked in git.
  • Do not clean, delete, reset, or revert those unless the user explicitly asks.
  • When committing, stage only intentional source/config/content/web changes.
  • Binaries/Win64/UnrealEditor-ledcube3d.dll and .pdb are currently tracked and may change after C++ builds.

What To Update Here

Append or edit this file when:

  • The physical LED model changes.
  • Remote Control API/preset/dashboard behavior changes.
  • Map/asset names or startup flow changes.
  • Build/run commands change.
  • A major bug is diagnosed and fixed.
  • A user preference or important design decision becomes clear.