RepoPilot

diasurgical / devilutionx

Search diasurgical/devilutionx

GitHub

Code

Understand diasurgical/devilutionx's source layout and find a starting point for your task using the saved repository evidence.

C
Architecture grade
score 50/100
0
Import cycles
lower is better
0
Modules parsed
0 edges
0%
Layeredness
clean-layer ratio

Measured from the parsed import graph, retained from the earlier analysis. Coupling, not a reading order.

How the code fits together

AI
  • Game CoreMain game loop, state management, and game logic
  • User InterfaceMenu system, dialogs, and UI rendering
  • In-Game HUD & ControlsPlayer control input and on-screen display elements
  • Input & Platform AbstractionCross-platform input handling for keyboard, gamepad, and touch
  • Data & Asset ManagementFile I/O, data parsing, and asset loading

Files at b0a3b7babbdd · descriptions are AI-written.

The descriptions and the file list come from different revisions. Check responsibilities against source.

Where to start reading

  1. Repository root
  2. Runtime candidatename match
  3. Suggested starting pointAI
  4. Suggested starting pointAI

Find files for a task

AI

Add a New Game Settings Option

Suggested by the saved analysis. Verify the proposed change against these source files.

  • Define the setting key and default value in core configuration
  • Add UI control (checkbox, slider, text field) to settings menu
  • Handle setting persistence and load/save in file I/O layer
  • Apply the setting to relevant game systems or display elements

Add a New Control Input (Keyboard/Gamepad)

Suggested by the saved analysis. Verify the proposed change against these source files.

  • Define new action constant in input definitions
  • Map physical key/button to action in key/pad mapper
  • Handle the mapped action in game control logic
  • Bind action to game effect in main loop or specific subsystem

Add a New UI Dialog or Menu Screen

Suggested by the saved analysis. Some step paths were not captured or refer to generated or vendor files; only observed source files are linked.

  • Implement dialog rendering and event handling in .cpp file
  • Register dialog with UI framework in main UI dispatch
  • Connect navigation flow from existing menu to new dialog

Trace runtime behavior

Start with possible startup or request handlers, then follow the calls for your scenario. These suggestions use file names, not verified execution paths.

  • File-name match for this task.

Add or update tests

Use a nearby test as a pattern. Read the root manifest or contribution guide for the correct test command. These suggestions use file names, not verified execution paths.

  • File-name match for this task.
  • File-name match for this task.
  • File-name match for this task.

Change build or automation

Inspect the relevant configuration and the commands it runs before changing the workflow. These suggestions use file names, not verified execution paths.

  • File-name match for this task.
  • File-name match for this task.
  • File-name match for this task.

File paths come from a snapshot of up to 500 captured paths; an omitted file may still exist.

  • Public and runtime candidates are based on file names; their exports and execution paths still need checking in source.
  • The file list was refreshed after the written analysis. Subsystem descriptions and suggested changes may describe an older revision.

Import graph details

Architecture and request flow

Start here — files every contributor must understand

AI · unverified
1
Source/diablo.cpp

Main entry point and game loop orchestration; every contributor must understand the primary game state machine

2
Source/CMakeLists.txt

Build system configuration; required to set up compilation for multiple OS targets

3
Source/DiabloUI/diabloui.cpp

UI framework backbone; handles menu rendering and navigation flow for all interface components

4
Source/controls/game_controls.cpp

Input mapping layer; centralizes keyboard, controller, and touch input handling across platforms

5
Source/control/control_panel.cpp

Game HUD and in-game UI management; coordinates spell, inventory, and player status display

6
Source/data/file.cpp

File I/O abstraction; handles loading game assets and cross-platform file access

Request flow

Technology choices

CMake

Enables portable cross-platform builds targeting Windows, macOS, Linux, Switch, PS4, Xbox, and web platforms from single configuration

SDL2

Abstracts platform-specific video, audio, and input APIs behind unified interface for deployment to multiple operating systems

C++

Provides performance-critical implementation while maintaining compatibility with original Diablo binary assets and reverse-engineered game logic

Modular Input Layer (Controller/Keyboard/Touch)

Allows independent handling of diverse input devices and platform-specific constraints without coupling game logic to hardware

Build time and runtime

Build-time

  • ▸
    CMake Configuration — Detects platform, compiler, and target architecture; generates platform-specific build rules
  • ▸
    C++ Compilation — Compiles source code with optimization flags and platform-specific features enabled
  • ▸
    Asset Processing — Codecs may pre-process game assets during build for faster runtime loading

Runtime

  • ▸
    Asset Loading — Loads original Diablo data files and decompresses using codec layer on first run or level transitions
  • ▸
    Input Polling & Dispatch — Continuously samples keyboard, gamepad, and touch devices; routes events to active UI or game context
  • ▸
    Game Loop & Rendering — Updates entity state, renders frame to display, and manages HUD elements each tick
  • ▸
    Platform Abstraction (SDL2) — Translates game render calls to OS-native graphics APIs and manages window events

Design trade-offs

Separate UI framework layer rather than inline UI code

Enables consistent menu experience across all platforms and simplifies porting to new OSes with different windowing systems

Additional abstraction layer adds code complexity but provides platform independence

Modular control system with multiple device layers (gamepad, keyboard, touch)

Supports diverse input methods on mobile and console ports without redesigning core game input handling

Input dispatch overhead and maintenance burden across multiple device abstractions

Asset loading through cross-platform file abstraction rather than direct OS calls

Enables consistent behavior across console SDKs, web environments, and desktop platforms with different file system APIs

Custom file I/O layer must be maintained rather than relying on standard library

Non-goals

  • ✗Does not create new gameplay content; port goal is fidelity to original Diablo behavior
  • ✗Does not implement online multiplayer; multiplayer scope is limited to local co-op via connection selection
  • ✗Does not support 3D graphics or modernized rendering; maintains original isometric 2D aesthetic
  • ✗Does not remove dependency on original Diablo game assets; users must provide their own data files

Code quality and hotspots

Quality Score: 80/100

Low Risk

This repo is in good health with CI, tests, and active maintenance.

High complexity -10Multiple anti-patterns -10

Maintainability grade

Static analysis

How maintainable the code looks — from complexity, code issues, test presence, file size, and hotspot load. It grades the shape of the code, not defect risk, and doesn't replace review.

F
21/100
A ≥ 85, B ≥ 70, C ≥ 55, D ≥ 40, F < 40
Cyclomatic complexityavg 697
0/35
Code issues0 errors, 258 warnings
0/20
Testspresent · ~28% of files
17/20
Largest file5,069 lines
0/15
Hotspot load3 high-risk files
4/10

Configuration status

CI/CD Pipeline — configured

Provider: GitHub Actions

32 GitHub Actions workflows

Test Suite — detected

186 test files detected

Where: test · test/fixtures/diablo

Test Coverage — ~28%heuristic

186 test files / 655 source files. This is a file-count ratio, not real line coverage — set up Codecov for authoritative numbers.

Dependency Scanning — no config detected

No Dependabot / Renovate / Snyk / Trivy / CodeQL config found. Enable Dependabot or Renovate.

Live Signals

Real-time data from Codecov, GitHub Actions, GitHub Issues, deps.dev — not estimates.

CI pass rate100%

last 50 runs · median 6m

Stale-issue ratio29%

of 7 recent open issues are 30d+ old with no replies

Maintainer response3h

median first-reply across 13 recent issues · fast

Activity trajectory↑ Rising

last 6mo: 97 commits · prior 6mo: 3

Top hotspots

Files edited often AND hard to reason about. Churn = recent commit frequency, Complexity = branches and nesting, Risk = both combined. These are the highest-leverage targets for refactoring or testing.

Source/diablo.cpp
Churn: 40 (10 commits/180d)Complexity: 100Risk: 40
Source/stores.cpp
Churn: 36 (9 commits/180d)Complexity: 100Risk: 36

All hotspots

Files that change often and are complex tend to accumulate more bugs

AI-suggested anti-patterns

AI · unverified

Pattern-matches from the file structure and dependencies — useful as hypotheses, but not grounded in actual source. For real findings see Code Scanning above.

Platform-Specific Code Scattered Across Codebase

Medium

SDL2 calls and platform checks intermixed with game logic; suggests incomplete abstraction between platform layer and core systems

Multiple files in Source/controls/devices and Source/DiabloUI

Input Event Dispatch Via Global or Static State

Medium

Input handling may rely on mutable static state or global references, making concurrent input handling brittle and testing difficult

Source/controls/game_controls.cpp, Source/controls/controller.cpp

UI State Management Without Explicit State Machine

Low

Menu transitions and dialog state changes appear to use implicit state through function calls rather than explicit state objects, risking navigation bugs

Source/DiabloUI/diabloui.cpp, Source/DiabloUI/mainmenu.cpp

AI-suggested bottlenecks

AI · unverified

Speculation from file structure, not profiling data. Validate against real metrics before acting on these.

I/O & CPU-bound Bottleneck

Asset loading and codec decompression likely blocks game loop during level transitions; no evident streaming or async loading

Source/data/file.cpp

Synchronous dispatch Bottleneck

Centralized input dispatch for all input types (keyboard, gamepad, touch) may serialize event handling and limit responsiveness on high-frequency input

Source/controls/game_controls.cpp

Single-threaded rendering Bottleneck

UI rendering and event handling in single pass may cause frame rate drops if menu rendering is complex

Source/DiabloUI/diabloui.cpp

Code metrics

Static analysis on sampled source files (up to 15 files).

Avg Cyclomatic Complexity697

Counts if/for/while/switch/catch/ternary branches

Errors / Warnings0 / 258

Secrets, empty catches, console.log, var usage, long lines

Largest File Analyzed5069 lines
Source/items.cpp