Skip to content

dat-alpaca/turnip-engine

Repository files navigation

Codacy Badge

Turnip Engine

Turnip is my favorite toy game engine. It features an unecessarily complicated RHI (a fancy way of saying it can run both Vulkan and Modern OpenGL), a suboptimal Lua engine, and several other cool things.

Getting Started

Turnip doesn't have prebuilt binaries yet, so if you want to use it, you'll need to build it yourself (sorry). Keep in mind that the latest version of this project has been only tested on Pop!_OS 22.04 LTS and Fedora Linux 43 (KDE Plasma Edition). Both X11 and Wayland display server protocols have been tested using a GeForce RTX™ 3050, and driver version 580.119.02. The latest version of the engine only supports Vulkan 1.3 and above, and OpenGL 4.6 and above. The OpenGL implementation is more likely than not, not fully implemented at any given moment, as I prioritize making sure the Vulkan RHI implementation is up to date first. Plans for supporting OpenGL 3.3 exist, but are not a guarantee.

You can check whether or not your graphics card supports the Vulkan features this engine uses here.

Mainly, you it requires:

  • VK_KHR_swapchain
  • VK_KHR_synchronization2
  • VK_KHR_dynamic_rendering

Prerequisites

Building this project requires the following:

If you are in a Linux desktop distribution, you must install the following dependencies to build the project, as stated in the GLFW documentation:

  • Debian-based:
sudo apt install libwayland-dev libxkbcommon-dev xorg-dev 
  • Fedora-based:
sudo dnf install wayland-devel libxkbcommon-devel libXcursor-devel libXi-devel libXinerama-devel libXrandr-devel

Additionally, you may need to install the Mesa drivers:

sudo dnf mesa-libGL mesa-libGL-devel

VulkanSDK environment variables:

In Windows, you may need to set the environment variable VULKAN_SDK to your Vulkan SDK installation (e.g., C:/Vulkan/<version>).

In Linux distributions, I suggest reading this. A similar guide is available for Windows, but major modifications are probably not needed.

Installation

  1. Clone the repository

    git clone --recurse-submodules https://github.com/dat-alpaca/turnip-engine

    In case you forget the --recurse-submodules option, just run git submodule update --init --recursive.

  2. Generate the project

    cmake -G Ninja -S . -B build/turnip -DCMAKE_POLICY_VERSION_MINIMUM=3.5

    Some other options can be set, such as:

    Option Name Information Default
    -DTUR_BUILD_SANDBOX Builds the turnip sandbox program ON
    -DTUR_BUILD_ENGINE Builds the turnip engine library ON
    -DTUR_USE_GLFW* Uses the GLFW windowing implementation ON
    -DTUR_USE_OPENGL Uses the OpenGL backend ON
    -DTUR_USE_VULKAN Uses the Vulkan backend OFF

    *This option is a lie. Turnip doesn't support other platforms yet.

  3. Compile the project Use the generated project files to build the project. You may use any combination of build arguments, but the only tested environment can be found under CMakePresets.json.

    If you intend to use it, first adjust the CMAKE_C_COMPILER and CMAKE_CXX_COMPILER according to your system filepaths. Then, run the cmake --build build/turnip --parallel 12 command.

    For Visual Studio (the purple one) users, use the Build All option after opening the Visual Studio solution project, or run msbuild directly if you have the appropriate environment variables for that.

    After that, you should have a working copy under build/turnip-sandbox/ and build/turnip-engine.

Configuration

The engine requires a location file specified as its main constructor argument. A default file can be located under res/engine_config.json.

Warning

Changing the graphics API string (windowingCapabilities/api) will not change the actual graphics API used. As the TurnipRHI system uses static polymorphism, the engine has to be recompiled with the correct arguments in order to change its underlying RHI. Check the options listed here for more information.

Using

Currently, there are no available examples nor documentation. The best you can do (which is highly discouraged) is to follow the turnip-sandbox project code source, and check the project folder.

The engine does not provide a single entry point to the user, so you must declare an instance of the engine, and a conscrete implementation of a tur::View.

However, the View is designed to be as bare-bones as possible. It does not provide a renderer system nor scenes, albeit those are readily available for use.

With all being said, I would highly advise against using the engine for the moment. I will provide code examples and (probably) a proper documentation in the future.

License

This project is licensed under the MPL-2.0 license - see the LICENSE file for details. It is important to note that until a certain commit, the project was licensed under the MIT License.

About

A game engine capable of being extraordinarily common.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published