A game engine built with the Odin programming language and SDL.
This project uses SDL3. The build script (build.odin) automatically locates and copies the necessary SDL3 runtime library (e.g., SDL3.dll on Windows) from your Odin installation's vendor:sdl3 collection into the build output directory.
Ensure that you have the SDL3 library available within your Odin installation (this is often included by default or can be added via odin install or managing collections manually).
This project uses Dear ImGui for the user interface, specifically an Odin binding for ImGui with SDL3 and GPU renderer support. The build script expects to find the ImGui binding in your Odin shared directory at:
C:/Users/antwah/odin/shared/imgui
If the ImGui dependency is not found, the build script will show an error message with installation instructions.
To install the required version of ImGui for this project:
# Navigate to your Odin shared directory
cd C:/Users/antwah/odin/shared
# Clone the repository with the specific branch for SDL3 + GPU support
git clone https://gitlab.com/nadako/odin-imgui.git -b sdlgpu3 imguiThis will clone the specific branch (sdlgpu3) of the Odin-ImGui bindings that works with SDL3 and GPU rendering. The repository is maintained by Dan Korostelev and provides Odin bindings for the C++ Dear ImGui library.
This project requires the sdlgpu3 branch because:
- It supports SDL3 (the latest version of SDL)
- It uses GPU-accelerated rendering
- It has been updated to work with recent Odin language changes
The official repository URL is: https://gitlab.com/nadako/odin-imgui/-/tree/sdlgpu3?ref_type=heads
This project uses SDL_shadercross for cross-compiling shaders to various formats. It's a fork of ShaderCross maintained by the SDL team. The build script expects to find SDL_shadercross installed externally to the project at:
C:/Users/antwah/shadercross
With the ShaderCross executable located in the bin subdirectory:
C:/Users/antwah/shadercross/bin/ShaderCross.exe
Instead of building from source, you can download pre-built binaries directly from GitHub Actions:
- Visit the SDL_shadercross Actions page
- Click on a successful workflow run (look for green checkmarks)
- Scroll down to the "Artifacts" section
- Download the appropriate artifact for your platform:
SDL3_shadercross-VC-x64- Windows (Visual C++)SDL3_shadercross-mingw64- Windows (MinGW64)SDL3_shadercross-linux-x64- LinuxSDL3_shadercross-macos-arm64- macOS (Apple Silicon)SDL3_shadercross-slrsniper- Steam Linux Runtime
- Extract the downloaded zip to
C:/Users/antwah/shadercross - Ensure that the ShaderCross executable is present in the
binsubdirectory (e.g.,C:/Users/antwah/shadercross/bin/ShaderCross.exe)
You can override these hardcoded paths at compile time:
odin run build.odin -file -define:SHADERCROSS_PATH="C:/your/custom/path/to/shadercross"
The build system automatically compiles shaders from HLSL to multiple target formats during both debug and release builds.
Shaders should be organized as follows:
- Source Shaders: Place your HLSL shaders in
assets/shaders/src/ - Compiled Shaders: Compiled shaders are output to
assets/shaders/bin/
Shader files should follow this naming convention:
<name>.hlsl.<type>
Where:
<name>is the base name of your shader (e.g., "opaque", "skybox")<type>is the shader type: "vert" for vertex shaders, "frag" for fragment shaders
Examples:
opaque.hlsl.vert - Vertex shader
opaque.hlsl.frag - Fragment shader
skybox.hlsl.vert - Vertex shader
skybox.hlsl.frag - Fragment shader
The build system will:
- Scan the
assets/shaders/src/directory for HLSL shaders - For each shader, compile to three target formats:
- SPIRV (Vulkan) -
.spvextension - Metal (Apple) -
.metalextension - DXIL (DirectX) -
.dxilextension
- SPIRV (Vulkan) -
Compiled shaders follow this naming convention:
<name>.<type>.<format>
For example, opaque.hlsl.vert will be compiled to:
opaque.vert.spv - SPIRV version
opaque.vert.metal - Metal version
opaque.vert.dxil - DXIL version
The build system is configured in build.odin with the following constants that can be overridden at compile time:
// Project configuration
PROJECT_ROOT :: #config(PROJECT_ROOT, ".") // Current directory by default
// Odin configuration
ODIN_VENDOR_PATH :: #config(ODIN_VENDOR_PATH, "C:/Users/antwah/odin/vendor")
ODIN_SHARED_PATH :: #config(ODIN_SHARED_PATH, "C:/Users/antwah/odin/shared")
// Tool paths
SHADERCROSS_PATH :: #config(SHADERCROSS_PATH, "C:/Users/antwah/shadercross")
// Build settings
DEBUG_EXE_NAME :: "fenrir_debug.exe" // Debug executable name
RELEASE_EXE_NAME :: "Fenrir.exe" // Release executable nameIf you need to use different paths, you can:
-
Edit the paths in build.odin directly to match your environment
-
Override at compile time:
odin run build.odin -file -define:ODIN_VENDOR_PATH="C:/your/odin/vendor" -define:SHADERCROSS_PATH="C:/your/shadercross"
The debug build (odin run build.odin -file) does the following:
- Compiles the project with debug symbols and optimization disabled
- Creates the executable in the project root directory
- Copies SDL3.dll to the project root directory
- Maintains the source directory structure for easy debugging
The release build (odin run build.odin -file -- release) does the following:
- Compiles the project with speed optimizations enabled
- Creates a distributable
bin/releasedirectory containing:- The optimized executable (
Fenrir.exe) - All necessary dependencies (SDL3.dll)
- Complete assets directory structure
- A README.txt file with basic information for end-users
- The optimized executable (
- The release package can be copied to any location and will run standalone
Clone the repository and run the build script:
# Build for debug (Default)
odin run build.odin -file
# Build for release
odin run build.odin -file -- releaseThis project includes VS Code tasks for building and running:
- Build (Debug): Compile in debug mode
- Build (Release): Compile in release mode
- Build & Run (Debug): Compile and run the debug version
- Build & Run (Release): Compile and run the release version
- Clean Project: Remove all build outputs
(Instructions on how to use the engine will go here)
fenrir-sdl/
├── assets/ # Game assets
│ ├── meshes/ # 3D models
│ ├── scenes/ # Scene definitions
│ ├── shaders/ # Shader files
│ │ ├── bin/ # Compiled shaders
│ │ └── src/ # Shader source code
│ └── textures/ # Image files
├── bin/
│ └── release/ # Release build output
├── src/ # Source code
├── build.odin # Build system
└── README.md # This file
(Information about how others can contribute to the project)
(Specify the license for your project here, e.g., MIT)