This is the JamTemplate for kickstarting your gamejam entry. It will compile C++20 code for native (Win, Linux) and web (webassembly) games. Internally it uses SFML, SDL and OpenALpp.
Some games created with this JamTemplate are
and more at my game portfolio.
build
at root levelcmd
)cmake ../
I run it with WSL2, but every system capable of running webassembly / emscripten should work.
Preconditions:
Setup
emcmake cmake -DJT_ENABLE_WEB=ON ../
emmake make
(do not pass -j
, otherwise emscripten will get stuck with pulling libraries)emmake make -j
http-server .
to start a webserver locally. (needs to be installed separately)http://127.0.0.1:8080/
to test locallyFor mac os you have to install cmake and sfml via homebrew: brew install cmake sfml
If you use another package manager or want to install the dependencies yourself, you have to modify the paths
in CMakeLists.txt
.
Automatic creation of the files is automated via github actions. If a release is created with semantic versioning (
e.g. v1.2.3
), a deployment build is triggered, which builds the game executable for windows, linux, mac and web and
attaches the zipped files to the release once the build is finished. The archives can directly be uploaded
on itch, gamejolt or any other website.
Note: Only the game executable and the assets
folder is included in the archive. If more files are required, either
adjust the deployment script (.github/workflows/deploy.yml
) or place them in the assets
folder.
The options can be set to ON or OFF via the cmake commandline or cmake-gui:
JT_ENABLE_UNITTESTS
- Enables gtest and the unit testsJT_ENABLE_PERFORMANCETESTS
Enables the performance testsJT_ENABLE_DEMOS
- Enables the demos (small example programs which showcase a specific theme)JT_ENABLE_WEB
- WebbuildUSE_SFML
- If ON
, SFML will be used, if OFF
, SDL will be used (SDL works best on linux)JT_ENABLE_AUDIO_TESTS
- Some of the tests rely on a working audio setup, which seemingly cannot be faked easily.
This switch disables those specific tests, in case no audio is available on the respective machine.JT_ENABLE_CLANG_TIDY
- Enable clang tidy checkerJT_ENABLE_LTO_OPTIMIZATION
- Enable Link time optimization. This gives higher runtime performance for the cost of
increased build and link times.e.g. calling cmake ../ -DJT_ENABLE_UNITTESTS=ON -DENABLE_DEMOS=ON
Code Coverage is reported via CodeCov
A local run (without the artifacts) can be executed e.g. on Windows via OpenCppCoverage:
OpenCppCoverage.exe --sources C:\projects\JamTemplateCpp\* --excluded_sources C:\projects\JamTemplateCpp\test\* --excluded_sources C:\projects\JamTemplateCpp\ext\* --excluded_sources C:\projects\JamTemplateCpp\cmake-build-debug\* .\cmake-build-debug\test\unit\jt_test\jt_tests.exe
Please check the performance benchmark report.
test
assets/test
.github/workflows/
everything except deploy.yml
CMakeLists.txt
:
add_subdirectory(test)
index.html
OFF
in config/cmake/cache_variables.cmake
impl/gamelib/game_properties.cpp
, e.g.
from this website (
save as gpl and paste file content)impl/gamelib/game_properties.hpp
settings as needed (window size, jam, author and date)FMod cannot be linked statically in the indie tier. Thus you need to provide the so while loading. Linux does not look in the local path by default. To fix this, you can add the following variable when starting the exe
LD_LIBRARY_PATH=<path_to_build_dir>impl/game