Files
dusk/CLAUDE.md
T
2026-06-18 14:59:21 -05:00

3.3 KiB

CLAUDE.md

This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.

Project

Dusk is a C11 RPG game targeting resource-constrained hardware (PSP, GameCube, Wii, PS Vita, Knulli handhelds) and Linux/OpenGL. All game code lives in src/dusk/; platform-specific backends live in src/dusk{platform}/ (e.g. src/duskgl/, src/duskpsp/, src/duskdolphin/).

Assets are zipped into dusk.dsk at build time and loaded at runtime via the asset system.

Build

# Linux (host)
./scripts/build-linux.sh          # outputs build-linux/Dusk

# Other targets (require Docker)
./scripts/build-psp-docker.sh
./scripts/build-gamecube-docker.sh
./scripts/build-wii-docker.sh
./scripts/build-knulli-docker.sh

Each script is a thin wrapper around:

cmake -S . -B build-<target> -DDUSK_TARGET_SYSTEM=<target>
cmake --build build-<target> -- -j$(nproc)

Tests

./scripts/test-linux.sh           # builds and runs all tests

# Manually run a single test binary after building:
./build-tests/test/<module>/test_<name>

Tests use cmocka and are only compiled when DUSK_BUILD_TESTS=ON. Test sources live under test/.

Key conventions

  • Use stringCompare, stringCopy, stringEquals, etc. from util/string.h — never strcmp, strcpy, and friends directly.
  • All functions that can fail return errorret_t. Use errorThrow(...), errorChain(call()), and errorOk() macros — see error/error.h.
  • Positions and game-world values use fixed_t (Q24.8 fixed-point, int32_t) — not float. Use FIXED(x) for literals and the fixedFrom*/fixedTo* helpers in util/fixed.h.

Coding style

See .claude/style.md for the full style guide: indentation, line length, naming, typedefs, defines, include order, const usage, assertion placement, error handling, struct initialization, and platform conditionals.

Architecture & systems

Doc Covers
.claude/architecture.md Platform abstraction pattern, subsystem lifecycle, error handling, code-generation pipeline
.claude/display.md Rendering pipeline: display state, screen, framebuffer, mesh, shader, texture, spritebatch, text
.claude/input.md Input actions, buttons, bindings, axis helpers, events
.claude/asset.md Asset archive, entry lifecycle, loader types, async/sync split, low-level file I/O
.claude/ui.md UI element system, textbox, frames, loading overlay, fullbox transitions, FPS counter
.claude/animation.md Keyframe animation, easing functions
.claude/systems.md Time, threading, mutex, events, console, logging, system/platform, network
.claude/util.md String, memory, math, fixed-point, array, sort, ref counting, CRC32, endian
.claude/save.md Save slots, stream serialization with CRC, locale/i18n
.claude/rpg/index.md RPG layer overview → world, entities, cutscenes, story/items
.claude/display-refactor.md Planned render-queue refactor (Saturn port context)