PDJE For AI Agents

Scope

This page is a retrieval and change-safety guide for AI coding agents and contributors. Public Godot usage belongs in the module workflow pages; this page preserves architecture, source priority, invariants, and verification routes needed to change either Project-DJ-Engine or PDJE-Godot-Plugin safely.

Repository Roles

Project-DJ-Engine

The native C++ engine owns:

  • music/FX playback, search, and editor mutations

  • platform input and MIDI capture

  • timing-sensitive judgment

  • utility databases, fuzzy matching, MIR/STFT, image generation, and AI helpers

Browse the Project-DJ-Engine source repository for native implementation and tests.

PDJE-Godot-Plugin

The GDExtension wrapper maps selected native functionality into Godot Nodes, RefCounted values, enums, properties, arrays, dictionaries, and signals. Godot-facing truth comes from:

Do not infer a Godot method from a similarly named native method. Confirm that the wrapper binds it and preserve its exact casing.

The generated API reference on this site supports exact native symbol lookup; it does not replace the hand-written concepts, lifecycle, ordering, or GDScript workflows.

Retrieval Order

For a Godot usage question:

  1. Read the relevant public page: Core_Engine, Editor_Workflows, Input_Engine, Judge_Engine, Util_Engine, or Data_Lines.

  2. Verify every class/method/property/signal in Wrapper_Includes/ and binding source.

  3. Follow the wrapper call into native headers/source when behavior, ownership, units, or failure semantics matter.

  4. Use native tests as executable evidence.

For a native change:

  1. Locate the public interface in include/.

  2. Trace implementation and ownership under include/, then inspect CMakeLists.txt for target and backend selection.

  3. Read the nearest unit/integration tests.

  4. Check wrapper blast radius and public-doc claims.

  5. Run focused tests before broad builds.

System Map

Core

PDJE owns engine initialization, music and FX search, player creation, editor access, and core data-line extraction. Player coordinates render/playback; MusicPanel and FXPanel are the supported mutation/control boundaries.

Godot entry point: PDJE_Wrapper.

Important anchors:

Editor

The editor mutates persistent DB-backed music/FX event data. Godot callers use one-shot PDJE_EDITOR_ARG objects, explicit add/set/delete operations, history undo/redo, and render/push methods. Never reuse an argument object after the wrapper consumes it.

PDJE_EDITOR_ARG.isForce is the explicit duplicate/conflict override. Preserve stable identity, ordering, interpolation, and referential-integrity rules.

Important anchors:

Input

Input lifecycle is discovery → configuration → data-line injection → run → emission → kill. Standard input and MIDI use separate transports. Device selection is explicit and producer lifetimes dominate consumers.

Godot entry points: PDJE_Input_Module and InputLine.

Important anchors:

Judge

Judge consumes Core timing plus Input event data through borrowed data lines. Its observable results are emitted as queued Godot signals. Initialization order and rail index alignment are correctness requirements, not presentation preferences.

Godot entry point: PDJE_Judge_Module.

Important anchors:

Util

Utility families include key-value, relational, and nearest-neighbor storage; fuzzy search; scalar/text helpers; MIR/STFT; WebP/waveform helpers; and ONNX Runtime/Beat This integration.

The removed shared StatusCode, Status, Result<T>, and Result<void> model is not current. Native APIs now use family-specific direct returns and exceptions. Godot wrappers translate failures to false, null, or empty values and emit diagnostics according to each binding.

Important anchors:

Data-Line Invariants

PDJE_CORE_DATA_LINE and PDJE_INPUT_DATA_LINE are non-owning bridges to producer-owned live state.

  • Never transfer ownership of pointed storage.

  • Never retain a line after its producer resets or dies.

  • Copy data needed outside the immediate operation.

  • Assume audio, input, IPC, and judge threads can update state concurrently.

  • Reacquire lines after player/input reconstruction.

  • Do not bypass synchronization by mutating raw members.

The Godot CoreLine copies values on access. InputLine copies input into signals. PDJE_Judge_Module.AddDataLines() obtains native lines directly from the producer wrappers.

Units And Ordering

Before changing arithmetic or examples, identify units:

  • player cursors use PCM frames

  • decoded audio buffers are interleaved samples

  • channel_count controls frame alignment/downmix

  • judge event positions are timing values interpreted by current judge rules

  • Beat This outputs seconds

  • editor fields preserve their documented DB units and interpolation semantics

Do not silently convert between PCM frames, samples, seconds, milliseconds, microseconds, BPM-derived positions, or editor positions.

Ordering-sensitive flows include:

  • core Init() before search/player/editor operations

  • player creation before PullOutCoreLine()

  • input Init() before discovery/configuration and Config() before Run()

  • producer initialization before judge AddDataLines()

  • judge options/rails before Start()

  • consumer shutdown before producer reset

Response Safety Rules

  • Prefer GDScript when answering Godot integration questions.

  • Use exact Godot wrapper names and casing.

  • Keep examples short but complete enough to show success, failure, and cleanup.

  • Do not advertise an unbound native feature as a Godot feature.

  • Do not resurrect the removed shared Result/Status contract.

  • When recommending native or wrapper changes, link the relevant public source and recommend the owning repository’s focused tests and build commands.

Before returning an answer or patch, identify the target surface, state required lifecycle ordering, describe ownership/units/failure behavior, cite the wrapper or native source used as evidence, and provide rerunnable verification. If current source cannot prove a claim, label it unknown rather than extrapolating from a name or older documentation.