Skip to content

Repository files navigation

Dagon Engine 2

Feature-rich, performant, easy to use, extensible desktop game development framework for D language, an SDL3 port of Dagon Engine 1.x. Works on Windows and Linux.

Note: this project is not connected to Dagon engine by Senscape.

DUB Package DUB Downloads License

Screenshots

Screenshot 1 Screenshot 2 Screenshot 3 Screenshot 4

Features

Note: Dagon 2 is still in active development. Not all features and extensions of Dagon 1.0 are ported yet.

New features and major changes from Dagon 0.x/1.x:

  • Core
    • Dagon now uses SDL3
    • Window minimize/restore events
    • Nanosecond-precision timer
    • CPU-friendly frame scheduler
    • Mailbox Vsync support, significantly reducing input lag
    • HiDPI logic is now handled partly by the engine itself due to API changes in SDL3
    • Referencing support in *.conf files syntax. Any property can be reused like a variable
    • Many classes across the engine now use a flat hash map (with xxHash64 hash function) instead of Dict, achieving 36x better performance on insertion and 15x on searching compared to Dagon 1.x
  • Assets
    • Asset loading is simplified, there are no separate loadThreadSafePart and loadThreadUnsafePart methods, just one load
    • Own 3D model format - DAF (Dagon Asset Format), optimized for very fast loading
    • Assimp integration is now a core feature
    • glTF and other model formats support now rely on Assimp
    • Texture loader is fully based on SDL3_Image and doesn't use dlib.image.io
    • KTX support is now a core feature
    • Improved DDS loader. Many new DXGI formats support
    • BC5 texture compressor
    • Built-in texture caching
    • Abstract resource cache (dagon.resource.cache) that can be used for any file types
  • Render
    • Reimplemented dagon.render. Deferred renderer, post-processing renderer and presentation renderer are now combined into one
    • Renderer now leverages SDL GPU, targeting Vulkan
    • Improvements and optimizations in almost every stage of the renderer. Many new features such as irradiance mapping, multiple scattering, specular occlusion, and adjustable IOR. Normals are now stored in world space to achieve frame coherence and mitigate R10G10B10A2 rounding errors. All stochastic techniques now use permuted congruential generator as a hash function
    • Renderer quality profiles support: LowQuality, HighQuality, UltraQuality
    • Stochastic screen-space reflections (SSSR) support
    • HDR (scRGB) output support
    • The renderer now uses separate irradiance cubemap
    • BRDF LUT is now generated at runtime instead of loading from data/__internal
    • Temporal SSAO support
    • Fog effect is now applied in a separate pass. Ground fog support
    • Shadeless materials in deferred pipeline
  • Graphics components
    • Shader workflow is now based on GLSL 4.60 and includes built-in GLSL to SPIR-V compiler. SPIR-V modules are cached to disk for reuse
    • Semantic of Scene and World classes is changed. Scene is now just a container for Entities and other graphical data; for user input and game logics World should be used
    • Environment class is gone, all environment properties are now part of the Scene class
    • Better handling of transparent objects. Transparent and opaque meshes are now differentiated per-material, not per-entity. This simplifies asset import and allows mixing transparent and opaque face groups in the same mesh
    • All Entities are static by default, and their model matrices are not recalculated each frame to reduce CPU overhead. For dynamic updates enable Entity.dynamic or use custom EntityController
    • New camera animation system: CameraController that interpolates a camera transformation between two independent states defined by CameraDriver objects. This allows to implement complex in-game transitions and cutscene animations
    • Inertial rotation support in FirstPersonViewController
    • GPU texture resampling now supports separable Lanczos filter and uses it by default
  • Post-processing
    • Tonemapping is entirely based on AgX. Legacy tonemappers were removed
    • Subpixel Morphological Anti-Aliasing (SMAA) support
    • Radial optical distortion support
    • Direct GPUImage LUT support was removed, it now requires conversion to 3D LUT
  • Physics
    • Jolt Physics is now built-in as dagon.jolt package
  • Scripting
    • Built-in GScript3 virtual machine and scripting API.
  • Extensions
    • dagon2:imgui - now provides a built-in UI boilerplate class
    • dagon2:audio - underlying sound engine (SoLoud) is updated with SDL3 and DirectSound backends
    • dagon:openvr is not available anymore because interop between SDL GPU and OpenVR is not possible; SDL deliberately abstracts and hides the underlying native graphics API handles. OpenXR support is planned for the long term, but will not happen until SDL 3.6.0.

System Requirements

Realistic minimum system requirements (for Full HD rendering at 60 fps):

  • CPU: Intel Core i3-10100 / AMD Ryzen 3 3100
  • RAM: application-dependent, usually 8 Gb minimum
  • GPU: Vulkan-capable, tested on GeForce RTX 3050
  • VRAM: application-dependent, 6 Gb minimum
  • OS: 64-bit Windows 10 or higher / Linux.

Usage

TODO

Runtime Dependencies

Dependencies are automatically deployed on 64-bit Windows and Linux. Under Linux, if you want to use local libraries in Windows way (from application's working directory rather than from the system), add the following to your dub.json:

"lflags-linux": ["-rpath=$$ORIGIN"]

On Windows, some dependencies require Visual C++ v14 Redistributable. You can download an official installer here. It is recommended to bundle vc_redist.x64.exe with your application's installer for end users.

Known Limitations

  • The engine doesn't support macOS yet.
  • Although SDL GPU is a multi-backend API, Dagon 2 currently targets only Vulkan backend.
  • dagon:openvr extension from Dagon 1.x won't be ported because interop between SDL GPU and OpenVR is not possible; SDL deliberately abstracts and hides the underlying native graphics API handles. OpenXR support is planned for the long term, but will not happen until SDL 3.6.0.

Documentation

API reference in HTML format can be generated from source code using ddox (dub build -b ddox). Be aware that documentation is currently incomplete.

License

Distributed under the Boost Software License, Version 1.0 (see accompanying file COPYING or at http://www.boost.org/LICENSE_1_0.txt). Third-party dependencies are distributed under their own licenses.

About

SDL GPU port of Dagon engine

Resources

Stars

19 stars

Watchers

2 watching

Forks

Releases

Packages

Contributors

Languages