# Tutorial: Getting Started
# Introduction
This tutorial covers the installation and initiation of the Antara Gaming Software Development Kit (SDK).
# Prerequisites
- CMake (opens new window)
- Requires at least version 3.14 or greater
- clang-8 or higher (opens new window)
- Windows Antara Gaming SDK supports both clang and clang-cl
- (optional) Emscripten (opens new window)
- (Install the latest web version)
- (optional) Visual Studio 2019 (opens new window)
- (optional) Clang VS Toolset (opens new window)
- (installable through Visual Studio installer)
# Getting Started
The following instructions create an installation of the Antara Gaming SDK that is useful for development and testing purposes.
# Build
Execute the following commands in the terminal to build the project.
mkdir build ## bash or powershell
cd build ## bash or powershell
## Release or Debug are available
cmake -DCMAKE_BUILD_TYPE=Debug -DCMAKE_CXX_COMPILER=your_path_to_your_clang++ ../ #Linux / Osx
cmake -DCMAKE_BUILD_TYPE=Debug -G "Visual Studio 16 2019" -A x64 -T "ClangCl" -DCMAKE_CXX_COMPILER="C:/Program Files/LLVM/bin/clang-cl.exe" ../ #Windows
## We can even use Ninja for Windows / Linux / OSX
## On Windows you may want to open x64 Visual Studio Terminal Prompt for using Ninja
cmake -G Ninja -DCMAKE_BUILD_TYPE=Debug -DCMAKE_CXX_COMPILER=path_to_clang++ -DCMAKE_C_COMPILER=path_to_clang ../
## Build (Debug / Release available)
cmake --build . --config Debug
There are also additional options with the CMake that allows to activate certain features of the SDK:
# CMake Options
(Please use the scroll bar at the bottom of the table to view all table cells.)
Name | Description | How to enable it | Notes |
---|---|---|---|
USE_SFML_ANTARA_WRAPPER | Enable the SFML module of the SDK | -DUSE_SFML_ANTARA_WRAPPER=ON | Requires SFML dependencies on Linux |
USE_IMGUI_ANTARA_WRAPPER | Enable the IMGUI Support for the SDK | -DUSE_IMGUI_ANTARA_WRAPPER=ON | |
ENABLE_BLOCKCHAIN_MODULES | Enable the Blockchain modules for the SDK (need additional dependencies) | -DENABLE_BLOCKCHAIN_MODULES=ON | |
ANTARA_BUILD_DOCS | Enable the build of the documentation for the SDK | -DANTARA_BUILD_DOCS=ON | Require Sphinx And Doxygen |
USE_LUA_ANTARA_WRAPPER | Enable the lua module for the SDK | -DUSE_LUA_ANTARA_WRAPPER=ON | |
USE_ASAN | Enable the Address Sanitizer for the Unit tests of the SDK | -DUSE_ASAN=ON | Cannot be mixed with USE_TSAN and USE_UBSAN |
USE_UBSAN | Enable the Undefined Behavior Sanitizer for the Unit tests of the SDK | -DUSE_UBSAN=ON | Cannot be mixed with USE_TSAN and USE_ASAN |
USE_TSAN | Enable the Undefined Behavior Sanitizer for the Unit tests of the SDK | -DUSE_TSAN=ON | Cannot be mixed with USE_UBSAN and USE_ASAN |
BUILD_WITH_APPIMAGE | Enable the AppImage auto-generation on Linux for bundle an executable builded with the SDK | -DBUILD_WITH_APPIMAGE=ON | Work’s only on Linux. |
ENABLE_HTML_COMPILATION | Enable the HTML Compilation on Emscripten for an executable builded with the SDK | -DENABLE_HTML_COMPILATION=ON | Work’s only on Emscripten |
COVERAGE_CLION_TOOLS | Enable the Coverage inside CLion IDE | -DCOVERAGE_CLION_TOOLS=ON | Work’s only with CLion IDE and Require ENABLE_COVERAGE |
ANTARA_BUILD_EXAMPLES | Enable the example of the SDK. | -DANTARA_BUILD_EXAMPLES=ON | Some examples need mix of options such as USE_SFML_ANTARA_WRAPPER + ANTARA_BUILD_EXAMPLES |
ANTARA_BUILD_UNIT_TESTS | Enable the unit tests of the SDK. | -DANTARA_BUILD_UNIT_TESTS=ON | Some examples need mix of options such as USE_LUA_ANTARA_WRAPPER + ANTARA_BUILD_UNIT_TESTS |
USE_BOX2D_ANTARA_WRAPPER | Enable the Box2D modules of the SDK. | -DUSE_BOX2D_ANTARA_WRAPPER=ON | |
ENABLE_COVERAGE | Enable the coverage macros for the SDK. | -DENABLE_COVERAGE=ON |
# Initiating the Project
Installation is not necessary.
Simply use the CMake fetch_content
command to use the project.
# Running Tests
(This section assumes that the reader has compiled the Antara Gaming SDK with the option to perform unit tests enabled.)
Unit tests are located in the following folders.
- Linux/OSX:
bin/unit_tests
- Windows:
bin/unit_tests/%CMAKE_BUILD_TYPE%
# Deployment
(This section is still in development.)
# Quick Example
# CMakeLists.txt
Create a basic CMakeLists.txt
. This allows the SDK to compile source code.
##! Uncomment those lines if you use the gaming sdk as an external project
#if (${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
# set(LINUX TRUE)
#endif ()
#include(FetchContent)
#FetchContent_Declare(
# antara-gaming-sdk
# URL https://github.com/KomodoPlatform/antara-gaming-sdk/archive/master.zip
#)
#FetchContent_MakeAvailable(antara-gaming-sdk)
#init_apple_env()
add_executable(quick_and_dirty quick_and_dirty.cpp)
target_link_libraries(quick_and_dirty PUBLIC antara::world)
# A Cpp File with Necessary Primitives
Create a cpp file with the primitives necessary to launch the intended game.
#include <iostream>
#include <antara/gaming/core/safe.refl.hpp>
#include <antara/gaming/world/world.app.hpp>
class example_system final : public antara::gaming::ecs::post_update_system<example_system>
{
public:
example_system(entt::registry& entity_registry) noexcept : system(entity_registry)
{
//! Here you can initialize your system, adding entities etc
}
void update() noexcept final
{
//! Your game logic here
nb_iteration += 1;
std::cout << "nb_iteration: " << nb_iteration << "\n";
if (nb_iteration == 10ull) {
std::cout << "Maximum iteration reached, leaving game now\n";
this->dispatcher_.trigger<antara::gaming::event::quit_game>(0);
}
}
private:
std::size_t nb_iteration{0ull};
};
REFL_AUTO(type(example_system));
class my_world_example : public antara::gaming::world::app
{
public:
my_world_example() noexcept
{
this->system_manager_.create_system<example_system>(); //! Here we load our system to use it.
}
};
int main()
{
my_world_example world;
return world.run();
}
# SDK Components
- doctest (opens new window)
- The fastest feature-rich C++11/14/17/20 single-header testing framework for unit tests and TDD http://bit.ly/doctest-docs (opens new window) (MIT)
- doom-st (opens new window)
- C++ implementation of strong types (MIT)
- doom-meta (opens new window)
- Several metaprogramming utilities in C++ (MIT)
- loguru (opens new window)
- A lightweight C++ logging library (Public Domain)
- fmt (opens new window)
- A modern formatting library https://fmt.dev (opens new window) (MIT)
- nlohmann-json (opens new window)
- JSON for Modern C++ https://nlohmann.github.io/json/ (opens new window) (MIT)
- EnTT (opens new window)
- Gaming meets modern C++
- A fast and reliable entity-component system (ECS) (MIT)
- refl-cpp (opens new window)
- A compile-time reflection library for modern C++ (MIT)
- range-v3 (opens new window)
- Range library for C++14/17/20
- Basis for C++20’s
std::ranges
(Boost Software License)
- expected (opens new window)
- C++11/14/17
std::expected
with functional-style extensions - https://tl.tartanllama.xyz (opens new window) (CC0 1.0 Universal)
- C++11/14/17
- ImGui (opens new window) (optional)
- Dear ImGui: Bloat-free Immediate Mode Graphical User interface for C++ with minimal dependencies (MIT)
- ImGui-SFML (opens new window) (optional)
- ImGui binding for use with SFML (MIT)
- SFML (opens new window) (optional)
- Simple and Fast Multimedia Library
- http://www.sfml-dev.org/ (opens new window)
- reproc (opens new window) (optional)
- Cross-platform (C99/C++11) process library (MIT)
- lua (opens new window) (optional)
- The Lua repo, as seen by the Lua team. (MIT)
- sol2 (opens new window) (optional)
- Sol3 (sol2 v3.0)
- a C++ <-> Lua API wrapper with advanced features and top notch performance
- http://sol2.rtfd.io/ (opens new window) (MIT)
- restclient-cpp (opens new window) (optional)
- C++ client for making HTTP/REST requests
- http://code.mrtazz.com/restclient-cpp/ (opens new window) (MIT)
- box2D (opens new window) (optional)
- Box2D is a 2D physics engine for games
- http://box2d.org (opens new window) (ZLib)