This directory contains project templates for building game modules that run on SparkEngine. Each template is a standalone CMake project that compiles into a shared library loaded by the engine at runtime.
| Name | Description |
|---|---|
| EmptyProject | Minimal scaffolding — a blank IModule implementation ready for your game logic |
| FPSStarter | First-person shooter starter — weapon definitions, player state, HUD hook-up |
| MultiplayerArena | Networked arena deathmatch — team assignment, round logic, respawn flow |
| PlatformerKit | 2D/2.5D platformer foundation — checkpoints, collectibles, player controller |
| RPGStarter | Single-player RPG — quest system, inventory, character progression |
For additional templates (physics, AI, networking, procedural generation, and more), see the SparkTemplates repository.
These templates require a built and installed copy of SparkEngine on your system. "Installed" means you have run CMake's install step — pointing at the raw build tree will not work because the exported CMake config files (SparkEngineConfig.cmake, SparkGameModule.cmake, etc.) are only generated during installation.
# 1. Clone and build SparkEngine (if you haven't already)
git clone --recurse-submodules https://github.com/Krilliac/SparkEngine.git
cd SparkEngine
cmake -B build
cmake --build build --config Release
# 2. Install to a local prefix (e.g. ~/SparkEngine-install)
cmake --install build --prefix ~/SparkEngine-installAfter this, ~/SparkEngine-install will contain the engine executable, headers, libraries, and — critically — the CMake package config files that find_package(SparkEngine) needs.
Common mistake: Passing the build directory or the
bin/subdirectory asCMAKE_PREFIX_PATH. This will fail because the build tree does not contain the installed config files. Always point at the install prefix (the path you passed to--prefix).
Each template is a standalone CMake project:
cd Templates/EmptyProject
cmake -B build -DCMAKE_PREFIX_PATH=<path-to-SparkEngine-install-prefix>
cmake --build build --config ReleaseReplace <path-to-SparkEngine-install-prefix> with the actual install prefix you used (e.g. ~/SparkEngine-install).
Warning: Do not pass the SparkEngine build directory or its
bin/subdirectory as the prefix path. Only the install prefix contains the required CMake config files.
Each template compiles into a game module — a shared library (.dll on Windows, .so on Linux) — not a standalone executable. The SparkEngine executable loads the game module at startup:
# Windows
SparkEngine.exe -game MyGame.dll
# Linux
./SparkEngine -game libMyGame.soBecause templates are separate shared libraries, they are built independently from the engine. You do not need the engine source tree at build time — only the installed SDK (headers + CMake config). However, a game module cannot be hot-swapped while the engine is running; you must restart the engine to pick up a rebuilt module. (AngelScript scripts can be hot-reloaded at runtime, but compiled C++ modules cannot.)
Each template follows this layout:
TemplateName/
├── CMakeLists.txt # Standalone CMake project using find_package(SparkEngine)
├── Source/
│ ├── GameModule.h # IModule implementation (your game logic entry point)
│ └── GameModule.cpp # DLL exports via SPARK_IMPLEMENT_MODULE()
├── spark.project.json # Project metadata (name, version, default scene)
└── spark.modules.json # Module loading configuration (DLL path, load order)
CMakeLists.txt— Callsfind_package(SparkEngine REQUIRED)and uses thespark_add_game_module()helper to create the shared library with correct definitions and linkage.GameModule.h— Your module class inheriting fromSpark::IModule. Implement the lifecycle methods:OnLoad(),OnUnload(),OnUpdate(),OnRender().GameModule.cpp— UsesSPARK_IMPLEMENT_MODULE(YourModuleClass)to generate theCreateModule()/DestroyModule()DLL exports the engine requires.
-
Copy the template directory of your choice and rename it:
cp -r Templates/EmptyProject MyGame # or FPSStarter, RPGStarter, etc. cd MyGame
-
Rename every occurrence of the template's name (
EmptyProject,FPSStarter,MultiplayerArena,PlatformerKit, orRPGStarter) to your project name. A one-liner from inside the copied directory:grep -rl 'EmptyProject' . | xargs sed -i 's/EmptyProject/MyGame/g'
The editor's File → New Project From Template flow does this rename automatically via
ProjectManager::CreateProjectFromTemplate— no manual substitution needed if you use the editor UI. -
Build and run:
cmake -B build -DCMAKE_PREFIX_PATH=<path-to-SparkEngine-install-prefix> cmake --build build --config Release # Windows SparkEngine.exe -game MyGame.dll # Linux ./SparkEngine -game libMyGame.so
MIT License. See LICENSE for details.