Experimental game engine.
Note: The commands that follow assume you are working in Cygwin.
Visual Studio solution:
cmake -S. -B./build -G"Visual Studio 16 2019"
The solution is present in the build
folder.
To make a compilation database (compile_commands.json
) for external tools:
cmake -S. -B./build -G"NMake Makefiles" -DCMAKE_EXPORT_COMPILE_COMMANDS=ON
Only the configure step is required to make the compilation database. For ease of integration, make a symlink to it in the root of the project:
ln -s ./build/compile_commands.json compile_commands.json
Note: Dependency installation is not necessary. However, it will result in dependencies being downloaded each time the build directory is blown away.
Warning: Changes to dependency configurations will require a deletion of the installed dependency and a rebuild.
To avoid having dependencies re-downloaded when the build
directory is deleted, dependencies can be installed through cmake.
# Configure cmake with generator of choice, for example:
cmake -S. -B./build -G"Visual Studio 16 2019"
# Build
cmake --build build
# Install dependencies
cmake --install build
By default this installs them to a _deps
in the root of the repository.
Next time cmake configuration is done, the packages will be picked up from the _deps
location. Very helpful if you need to blow away build
or when a file is added/removed from the project.
These are done through preprocessor defines and/or cmake options.
See CMakeLists.txt
options for the available feature toggles.
General:
RK_ASSERTIONS_ENABLED
: If present, enable assertions. Otherwise they are compiled out. Note, critical assertions are always enabled.
Logging:
RK_LOG_LEVEL
: Log level compiled into the application. One ofRK_LOG_LEVEL_{OFF, TRACE, DEBUG, INFO, WARN, ERROR, CRITICAL}
. Levels listed in order of least to most precendence. Levels of equals or less precedence are removed.RK_LOGGING_OFF
: Remove all logging. Takes precedence overRK_LOG_LEVEL
.RK_LOGGING_PERF
: Compile in minimal logging (for performance). Takes precedence overRK_LOG_LEVEL
.
Graphics:
RK_OGL_DEBUG
: Display debug messages from OpenGL, including errors.RK_SHADER_BASE_DIR
: Directory containing all the shaders. Prepended to the path of the shader being opened.RK_REQUEST_HIGH_PERF_RENDERER
: Ask for a high performance renderer. For systems with an iGPU and dGPU, this typically means the dGPU.
Engine macros are prefixed with RK_
. Engine internal macros that should not be used are prefixed with RK_I_
.
All internal representation of strings and text output are UTF-8. The engine is unicode only and does not support ANSI strings. It follows the principles of UTF-8 everywhere.
NOTE: UTF-8 is backwards compatible with ASCII1. Therefore searching for ASCII characters/strings in UTF-8 strings is a valid.
Programming guidelines:
std::string
andchar*
variables are considered UTF-8, anywhere in the program.- Use what's available in
platform/stdlib/*
over those in the standard library. These functions take UTF-8 strings.2 - Do not use
wchar_t
orstd::wstring
in any place other than adjacent point to APIs accepting UTF-16. - Do not use
L""
literals in any place other than parameters to APIs accepting UTF-16. - Windows:
- Do not use types, functions, or their derivatives that are sensitive to the
UNICODE
constant, such asLPTSTR
,CreateWindow()
or the_T()
macro. Instead, useLPWSTR
,CreateWindowW()
, and explicitL""
literals. UNICODE
and_UNICODE
are always defined to avoid passing narrow UTF-8 strings to ANSI WinAPI getting silently compiled.- Only use Win32 functions that accept widechars (
LPWSTR
), never those which acceptLPTSTR
orLPSTR
. Pass parameters this way:std::array<wchar_t, MAX_PATH> wpath; if (!unicode::widen(wpath.data(), wpath.size(), some_string)) { return Status::unicode_error; } SetWindowTestW(wpath.data());
- Output from windows API functions require
unicode::narrow
to re-encode to UTF-8 for use internally.
- Output from windows API functions require
- Do not use types, functions, or their derivatives that are sensitive to the
Working with files, filenames, and fstreams:
- Always produce text output files in UTF-8.
- Use what's available in
platform/stdlib/*
over those in the standard library. These functions take UTF-8 strings.2