Repository navigation
Contributing
SparkEngine welcomes contributions of all kinds. This guide covers code style, architecture conventions, and the contribution workflow.
SparkEngine is licensed under the Spark Open License 1.0. All contributions are subject to the same license.
- Fork the repository on GitHub
- Clone your fork with submodules:
git clone --recurse-submodules https://github.com/YOUR_USERNAME/SparkEngine.git
- Create a feature branch:
git checkout -b feature/my-feature
- Make your changes
- Build and test:
cmake -B build -DBUILD_TESTS=ON cmake --build build ctest --test-dir build --output-on-failure --no-tests=error
- Push and open a Pull Request
Before opening a PR, run these checks locally. CI enforces all of them automatically.
The repo ships a .clang-format (Microsoft-based, Allman braces, 4-space indent, 120-col limit). CI rejects PRs with formatting violations.
# Check formatting (dry run — reports violations without changing files)
find SparkEngine/Source SparkEditor/Source -name '*.h' -o -name '*.cpp' \
| xargs clang-format --dry-run --Werror
# Auto-fix formatting
find SparkEngine/Source SparkEditor/Source -name '*.h' -o -name '*.cpp' \
| xargs clang-format -i# Generate compile_commands.json, then run clang-tidy
cmake -B build -DCMAKE_EXPORT_COMPILE_COMMANDS=ON
clang-tidy -p build SparkEngine/Source/**/*.cppcmake --preset linux-gcc-release # or windows-release
cmake --build build --config Release
cd build && ctest --output-on-failure --no-tests=errorAll checks must pass before submitting a PR.
- C++23 — All code must compile with C++23 enabled
- No compiler-specific extensions (
CMAKE_CXX_EXTENSIONS OFF)
| Element | Convention | Example |
|---|---|---|
| Classes / Structs | PascalCase |
PhysicsSystem, SceneNode
|
| Functions / Methods | PascalCase |
CreateEntity(), GetTransform()
|
| Variables | camelCase |
deltaTime, maxHealth
|
| Member variables | m_ prefix |
m_registry, m_position
|
| Constants | UPPER_SNAKE | SPARK_SDK_VERSION |
| Enums | PascalCase | RenderPath::Forward |
| Namespaces | PascalCase |
Spark::AI, Spark::Graphics
|
| Files | PascalCase |
PhysicsSystem.h, GraphicsEngine.cpp
|
- Headers (.h) — Declarations, inline implementations for templates
- Source (.cpp) — Implementations
- One class per file (with exceptions for small related types)
- Include guards:
#pragma once
Components must be pure POD structs (state only, no behavior):
// Good: POD component
struct HealthComponent {
float health = 100.0f;
float maxHealth = 100.0f;
bool isDead = false;
};
// Bad: behavior in component
struct HealthComponent {
float health = 100.0f;
void TakeDamage(float amount) { health -= amount; } // NO
};- Create a directory under
SparkEngine/Source/Engine/YourSystem/ - Add a CMake toggle:
option(ENABLE_YOUR_SYSTEM "..." ON) - Guard code with
#ifdef SPARK_ENABLE_YOUR_SYSTEM - Register console commands if applicable
- Add unit tests in
Tests/ - Document in the wiki
Adding a New Component (see Entity Component System)
- Define the POD struct in
Components.h - Add a system function in
ECSystems.hif needed - Register serialization in the save system
- Add editor UI in SparkEditor if applicable
If exposing functionality through the SDK:
- Add interface header to
SparkSDK/Include/Spark/ - Use forward declarations to minimize includes
- Maintain backward compatibility
This project makes extensive use of AI-assisted development. All AI-generated code is reviewed, tested, and validated. Contributions may also use AI tools, but all code must be reviewed and tested before submission.
- Keep PRs focused on a single feature or fix
- Include tests for new functionality
- Update wiki documentation if adding user-facing features
- Ensure CI passes (GitHub Actions builds on Windows and Linux)
- Reference related issues in the PR description
Use a clear, imperative title that describes the change:
| Type | Example |
|---|---|
| Feature | Add cloth simulation system |
| Bug fix | Fix crash when loading empty scene |
| Refactor | Refactor physics collision callbacks |
| Docs | Update ECS wiki with component examples |
| Test | Add unit tests for NavMesh pathfinding |
## Summary
Brief description of what this PR does and why.
## Changes
- List of specific changes made
## Testing
- How this was tested (unit tests, manual testing, etc.)
## Related Issues
Closes #123- Automated checks — CI runs clang-format, builds (Windows + Linux), tests, and sanitizers
- Manual review — A maintainer reviews the code for correctness, style, and architecture fit
- Feedback — Address review comments by pushing additional commits (do not force-push during review)
- Merge — Once approved and CI passes, a maintainer merges the PR
Report bugs and request features at GitHub Issues.
Include:
- Platform and compiler version (e.g., Windows 11, MSVC v143)
- Steps to reproduce — Minimal, numbered steps to trigger the bug
- Expected behavior — What you expected to happen
- Actual behavior — What actually happened (include error messages, stack traces)
-
Build configuration — CMake flags used (
ENABLE_EDITOR,ENABLE_GRAPHICS, etc.) - Screenshots/logs — If applicable, include console output or screenshots
Include:
- Use case — Why the feature is needed
- Proposed solution — How you envision it working
- Alternatives considered — Other approaches you've thought of
- Scope — Is this a small addition or a major subsystem?
| Branch Type | Pattern | Example |
|---|---|---|
| Feature | feature/description |
feature/cloth-simulation |
| Bug fix | fix/description |
fix/physics-crash |
| Refactor | refactor/description |
refactor/ecs-views |
| Docs | docs/description |
docs/update-wiki |
Before submitting a PR, verify your changes thoroughly:
# 1. Run the full test suite
cmake -B build -DBUILD_TESTS=ON
cmake --build build
cd build && ctest --output-on-failure --no-tests=error && cd ..
# 2. Run with AddressSanitizer (catches memory bugs)
cmake -B build-asan \
-DCMAKE_BUILD_TYPE=Debug \
-DBUILD_TESTS=ON \
-DCMAKE_CXX_FLAGS="-fsanitize=address,undefined -fno-omit-frame-pointer"
cmake --build build-asan
cd build-asan && ctest --output-on-failure --no-tests=error && cd ..
# 3. Verify formatting
find SparkEngine/Source GameModules SparkEditor/Source SparkConsole/src SparkShaderCompiler/src \
SparkBuild/src SparkInstaller/src SparkDaemon/src SparkServer/src SparkGateway/src \
SparkCooker/src SparkWorker/src SparkAutomation/src SparkLauncher/src Tests \
-not -path '*/Metal/*' \( -name '*.h' -o -name '*.hpp' -o -name '*.cpp' \) \
| xargs clang-format --dry-run --Werror
# 4. Run clang-tidy (optional but recommended)
cmake -B build -DCMAKE_EXPORT_COMPILE_COMMANDS=ON
clang-tidy -p build SparkEngine/Source/**/*.cppAny code change that affects user-facing features must include documentation updates:
-
Wiki pages — Update the relevant wiki page in
wiki/. Create a new page if adding a new subsystem -
API docs — Add Doxygen-style comments (
@brief,@param,@return) to public headers - Code comments — Add inline comments for non-obvious logic
- CLAUDE.md — Update if the change affects architecture, build flags, or execution order
Use wiki/_Template.md when adding new wiki pages. New subsystem or workflow pages should include these sections:
## Overview## When to Use## Threading Model## Platform and Backend Support## Key APIs and Types## Performance Notes## Troubleshooting## Related Pages
The quality checker (tools/check-wiki-quality.sh) validates template presence, stale metric guardrails, and this standards section.
When contributing a new engine subsystem:
- Create directory under
SparkEngine/Source/Engine/YourSystem/ - Add CMake toggle:
option(ENABLE_YOUR_SYSTEM "..." ON) - Guard code with
#ifdef SPARK_ENABLE_YOUR_SYSTEM - Implement singleton pattern with
GetInstance()if appropriate - Register console commands if the system has debug controls
- Add unit tests in Tests/TestYourSystem.cpp (e.g.,
Tests/TestPhysicsSystem.cpp) - Create wiki page in
wiki/Your-System.md - Add to
wiki/_Sidebar.mdnavigation - Ensure
wiki/Home.mdstill points to_Sidebar.mdas canonical navigation - Run
docs/generate-api-docs.sh checkanddocs/sync-wiki.sh sync
- Architecture Overview — Engine design and subsystem patterns
- Build System and CMake Modules — Build configuration, CI/CD, and CMake flags
- Testing — Adding and running tests, test framework macros
- Getting Started — Building and running the project
- Entity Component System — Component architecture and ECS patterns
- Profiler and Debugging — Performance profiling and debug tools
- Troubleshooting — Common build and runtime issues
Published from 2b03dc797148. Edit the canonical source in wiki/.
- Documentation
- Docs route
- Wiki index
- Guides
- Tutorials
- Samples
- Examples
- API Reference
- API route
- Reference
- Build Guide
- Dependencies
- FAQ
- Changelog
- Roadmap
- Contributing
- Code of Conduct
- Home
- FAQ
- Getting Started
- Quick-Start Tutorial
- Making Your First Game
- Making Your First Multiplayer Game
- Artist Workflow Guide
- Editor Walkthrough
- Migration Guide
- How SparkEngine Works
- Architecture Overview
- Engine Architecture Flowchart
- Creating a Game Module
- Game Modules (catalog)
- Entity Component System
- Rendering and Graphics
- Physics
- Cloth Simulation
- Audio
- Input System
- Camera System
- Scripting with AngelScript
- Visual Scripting
- AI and Navigation
- Animation
- 2D Systems
- Networking
- Dedicated Server
- Multiplayer Quick Start
- Area Server Architecture
- Scene Management
- Large World Support
- Collaborative Editing
- Coroutine System
- Event System
- Event Response System
- Job System
- UI System
- UI Layout Extensions
- Localization
- Dialogue System
- Destruction System
- Replay System
- Achievement System
- Loading System
- Mod System
- Content Delivery
- Tween System
- Memory Integrity
- Gameplay Systems
- Terrain and Procedural Generation
- Save System
- Persistence System
- Day Night Cycle and Weather
- Cinematic Sequencer
- Runtime Prefabs
- SparkEditor
- Editor Tutorials
- SparkConsole
- SparkDaemon
- Shader Pipeline
- Asset Pipeline
- Asset Validation
- Asset Migration
- Game Packaging
- Online Services
- DataTable System
- Loot and Crafting System
- CSG System
- Font System
- Timer Manager
- Movie Render Pipeline
- HLOD and World Partition
- Remote Debug System
- Selection Manager
- Asset Dependency Graph
- Editor Automation
- File Watcher
- Project Templates
- System Requirements
- VR Support
- Mobile Platform
- Accessibility
- Platform Input
- Platform Certification
- Cross-Compilation: Wine Testing
- RHI Abstraction Layer
- D3D11 Backend
- D3D12 Backend
- Vulkan Backend
- OpenGL Backend
- Metal Backend
- DXR Raytracing
- Hybrid Ray Tracing
- Upscaling (DLSS/FSR)
- Render Graph
- Shader Graph
- GPU Particles
- GPU-Driven Rendering
- Volumetric Fog
- Volumetric Clouds
- Global Illumination
- Virtual Texturing
- Water Rendering
- Clustered Lighting
- Material System
- Post-Processing
- Shadow System
- Particle System
- Decal System
- Sky and Atmosphere
- Foliage System
- Mesh Shaders
- Neural Rendering
- Configuration Reference
- Performance Tips
- Benchmark Framework
- Threading Model
- Fuzz Policy and Parser Security
- Memory Safety
- Memory Management Patterns
- Build System and CMake Modules
- Profiler and Debugging
- Performance Profiling Guide
- Telemetry System
- Crash Reporting
- Golden Image Testing
- Utilities
- Testing
- Fuzz Policy and Parser Security
- Codebase Statistics
- Codebase Health
- Error Handling Patterns
- Hot Reload Overview
- Troubleshooting
- Contributing
- Workflow Patterns
- Build Optimizations
- CI Reproducible Builds
- GitHub API and PR Checks
- Git Rebase Conflicts
- Clang-Format
- Code Quality Violations
- AI Bloat Pattern
- MinGW + Wine Cross-Compilation
- Live Editor Testing
- Engine & Renderer Landscape
- DuetOS Portability Catalog
- Five-Engine Analysis
- Eleven-Engine Analysis
- ThorVG / Unity Graphics Analysis
- Advanced Techniques Catalog
- Third-Party Library Evaluation
- Engine Viability Evaluation
- Engine Feature Recommendations
- Project Recommendations
- Mac Compatibility Analysis
- Codebase Observations
- Codebase Bloat Audit
- Test Suite Audit
- Documentation Coverage Audit
- ThirdParty Dependencies Audit
- Load Test Baseline
- Gameplay Systems Status
- SparkGame Module Status
- Stub and Abandoned Features
- Memory Integrity System
- Memory Safety Evaluation
- Hardware Acceleration Systems
- Jolt Physics Integration
- GPU/CPU Separation Plan
- Daemon Services Architecture
- Reflection & Polymorphism Refactoring Plan
- SparkBuild In-Tree
- Wine No-JobSystem Breakthrough
- Wine Role and Fallback Tiers