Repository navigation
Third Party Library Evaluation
Audience: Programmers | Mixed
Thread Context: N/A (research/reference)
Platform/Backend Scope: All platforms (cross-platform dependency strategy)
Comprehensive evaluation of third-party libraries for SparkEngine, addressing cross-platform gaps (texture loading, model formats, audio) and deciding where to replace hand-rolled implementations with battle-tested alternatives. Five libraries were introduced as integration-ready dependencies, four more were rejected after evaluation, and a short-list of future candidates was identified.
The guiding principle: introduce a library only when it closes a real cross-platform gap or removes meaningful maintenance burden. Permissive licenses only — no GPL contamination risk.
| Library | Location | Purpose | License | CMake Define |
|---|---|---|---|---|
| stb_image (+write) | ThirdParty/Utils/stb/ |
Cross-platform texture loading (PNG/JPG/BMP/TGA/HDR) | Public Domain | SPARK_HAS_STB_IMAGE |
| cgltf | ThirdParty/Utils/cgltf/ |
glTF 2.0 model parsing | MIT | SPARK_HAS_CGLTF |
| miniaudio | ThirdParty/Audio/miniaudio/ |
Cross-platform audio (WASAPI/PulseAudio/CoreAudio/ALSA) | Public Domain | SPARK_HAS_MINIAUDIO |
| nlohmann/json | ThirdParty/Utils/json/ |
JSON parsing (header-only) | MIT | SPARK_HAS_NLOHMANN_JSON |
| tinyexr | ThirdParty/Utils/tinyexr/ |
OpenEXR/HDR image loading | BSD 3-Clause | SPARK_HAS_TINYEXR |
Status note (verified 2026-06-08): These remain stub headers that provide the correct API surface and compile/link cleanly, but full functionality requires dropping in the real single-header libraries from their upstream repos. The header banners explicitly say "This is a STUB header". Each now has a companion
*_impl.cpptranslation unit (stb_impl.cpp,cgltf_impl.cpp,miniaudio_impl.cpp,tinyexr_impl.cpp) so the implementation is compiled in one place once the real header is dropped in.
# stb_image (replaces BMP/TGA-only stub with full PNG/JPG/HDR support)
curl -L https://raw.githubusercontent.com/nothings/stb/master/stb_image.h -o ThirdParty/Utils/stb/stb_image.h
curl -L https://raw.githubusercontent.com/nothings/stb/master/stb_image_write.h -o ThirdParty/Utils/stb/stb_image_write.h
# cgltf (replaces format-detection stub with full glTF parser)
curl -L https://raw.githubusercontent.com/jkuhlmann/cgltf/master/cgltf.h -o ThirdParty/Utils/cgltf/cgltf.h
# miniaudio (replaces no-op stub with real audio backend)
curl -L https://raw.githubusercontent.com/mackron/miniaudio/master/miniaudio.h -o ThirdParty/Audio/miniaudio/miniaudio.h
# nlohmann/json (replaces minimal parser with full-featured JSON)
curl -L https://github.com/nlohmann/json/releases/download/v3.11.3/json.hpp -o ThirdParty/Utils/json/nlohmann_json.h
# tinyexr (replaces stub with real EXR loader)
curl -L https://raw.githubusercontent.com/syoyo/tinyexr/master/tinyexr.h -o ThirdParty/Utils/tinyexr/tinyexr.h| Gap | Before | After |
|---|---|---|
| Texture loading on Linux | No-op (WIC is Windows-only) | stb_image loads PNG/JPG/BMP/TGA/HDR |
| glTF model loading |
E_NOTIMPL stub |
cgltf parses glTF 2.0 with PBR materials |
| Audio on Linux/macOS | Complete silence (XAudio2 stubs) | miniaudio backend (WASAPI/PulseAudio/CoreAudio) |
| JSON parsing | Hand-rolled 600-line parser | nlohmann/json (industry standard) |
| HDR/EXR image loading | Not supported | tinyexr loads OpenEXR for lightmaps/IBL |
-
TextureSystem (Linux path,
TextureSystemLinux.cpp):CreateFromFileusesstbi_load()on non-Windows whenSPARK_HAS_STB_IMAGEis defined. Also wired into the LinuxTextureAsset::Loadpath (AssetTypesLinux.cpp) which decodes image bytes via stb_image and uploads through the RHI bridge. -
ModelLoading (
ModelLoadingLinux.cpp):LoadGLTF()uses cgltf whenSPARK_HAS_CGLTFis defined. -
AudioEngine.h:
IsAudioBackendAvailable()returns true on non-Windows whenSPARK_HAS_MINIAUDIOis defined. -
JsonUtils.h now provides the project JSON façade (
Spark::Json::Parse). It is currently a self-contained minimal parser and switches to nlohmann/json whenSPARK_HAS_NLOHMANN_JSONis available. - tinyexr is available for use; EXR-specific wiring is opportunistic.
| Library | Reason |
|---|---|
| assimp | Too heavy (~5 MB). cgltf/tinygltf is sufficient for glTF. Only if 40+ format support is ever needed. |
| spdlog | Custom Logger is adequate (async, category-filtered). Migration cost exceeds benefit. |
| Google Test / Catch2 | Custom TestFramework handles the full suite (~6,000 tests). Migration not justified. |
| GLM | Thousands of DirectXMath references across the codebase. Massive migration; DirectXMath stubs suffice on Linux. |
| TBB / Enki | JobSystem works. Replace only if work-stealing becomes a measured bottleneck. |
| protobuf | Save system works. Adds build complexity for marginal gain. |
| FreeType + HarfBuzz | MSDF text rendering already works. Runtime rasterization not needed. |
| Library | Purpose | Priority | Status (2026-06-08) |
|---|---|---|---|
| Basis Universal (transcoder) | GPU texture compression (4-8x VRAM savings) | High |
Partial — Graphics/BasisTranscoder.h now exists, transcoding .basis/.ktx2 to BC/ASTC/ETC per backend. Real Basis transcoder library still needs dropping in. |
| Tracy Profiler | Production profiling with remote debugging | Medium |
Open — wrap existing PROFILE_SCOPE macros. |
| meshoptimizer | The real upstream library | Low |
Open — custom Graphics/MeshOptimizer.h already covers core cases. |
| FastNoiseLite | The real upstream library | Low |
Open — custom Graphics/FastNoiseLite.h already integrated. |
- All new libraries follow the existing pattern:
if(TARGET lib)in CMake,#if SPARK_HAS_*in source. - Stub headers provide a correct API surface so the engine compiles/links without the
real libraries; a single
*_impl.cppper library centralizes the implementation. - stb and miniaudio are single-file C libraries compiled as static libs.
- nlohmann/json is header-only (INTERFACE target).
- All licenses are permissive — no GPL contamination risk.
-
Original entry date: 2026-03-31 (
.claude/knowledge/third-party-library-evaluation.md) - Verified against codebase 2026-06-08.
Updates / status changes since the original:
- All five introduced libraries are still stub headers (header banners confirm "STUB"); not yet swapped for real upstream single-header libraries.
- Each library now has a companion
*_impl.cpptranslation unit centralizing the single-header implementation point — new since the original write-up. - JSON usage now flows through
SparkEngine/Source/Utils/JsonUtils.h(Spark::Json), a self-contained parser that upgrades to nlohmann/json underSPARK_HAS_NLOHMANN_JSON. The original noted nlohmann was "available but not yet wired" — there is now a project-wide JSON façade. - stb_image is wired into the Linux
TextureAsset::Loadpath (AssetTypesLinux.cpp), not justTextureSystem— newer integration. -
Basis Universal moved from "future / High priority" to Partial:
Graphics/BasisTranscoder.hnow exists (transcodes to BC1/BC3/BC7, ASTC, ETC1/ETC2 per RHI backend). Real transcoder library still pending. - Tracy, meshoptimizer, FastNoiseLite remain Open; the latter two are covered by custom in-tree headers.
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