Skip to content
This repository has been archived by the owner on Mar 10, 2023. It is now read-only.

EgorOrachyov/Berserk

Repository files navigation

Project logo

BERSERK

build clang format pages codacy badge license

Berserk engine is designed as a powerful and compact tool for creating high-performance applications. It will be written in C++11 with support for Vulkan and OpenGL graphics, OpenAL audio, Bullet Physics, Assimp importer for models, STB texture loader and FreeType font loader.

The engine will provide functionality in memory management, math, SIMD instructions set utilisation, working with strings, multi-threading, exporting/importing various kinds of resources (such as textures, geometry, audio files etc.), displaying fonts, text and 3d graphics.

The idea behind this hobby project is to implement a simple, compact, friendly, and at the same time powerful enough engine in order to create a 3d third-person platformer game, which is fully featured with modern graphics, visual effects, audio, physics, and scripting features. Since I am a big fan of 3d-graphics, games, and programming, this project will allow me to practice my skills as well as have a lot of fun with fancy programming tasks and design decisions.

At this moment the primary goal is to create core structure with an usable stuff, which will be expanded later by the engine modules/components. Project under heavy development.

Platforms

  • Windows 10 (tested on Windows 10)
  • macOS (tested on 10.14 Mojave)
  • Linux-based OS (tested on Ubuntu 20.04)

Third-party projects

  • glew for OpenGL functions and extensions loading
  • glfw for cross-platform window and input management
  • glslang for runtime glsl to spir-v shaders compilation
  • googletest for Unit-testing of the engine source code modules
  • pfd portable file dialogs for native OS dialogs access
  • stbimage image utilities for images loading, writing and resizing
  • tinyobj for wavefront obj models importing
  • tinyxml2 for utf-8 xml files processing
  • vma vulkan library for memory allocation
  • whereami for executable location extracting
  • yamc for C++ locks implementation

Getting started

Dependencies

Glfw library dependencies setup for Linux-based OS. Glfw uses native windowing APIs and built-in OS window frameworks, however it may require additional setup step for linux users. Follow the official glfw guide to setup this dependencies by apt-get tool.

To build library OpenGL-based low-level renderer on Linux-based OS sometimes you need make sure, that glew dependencies are installed. So follow glew installation dependencies requirements.

To build library Vulkan-based low-level renderer you need to download and install official Vulkan SDK from LunarG website. Follow instructions in order to install this SDK. Note, that this project uses CMake to locate SDK location, so remember to expose environment variable VULKAN_SDK if it is required.

Requirements

  • Common:
    • Git (to get source code)
    • CMake (the latest version)
    • Ninja (as build files generator)
    • Python 3.7+
  • Windows 10:
    • Microsoft Visual C++ Compiler (MSVC) with C++11 support
    • x64 Native Tools Command Prompt for VS
  • Ubuntu 20.04:
    • GNU C++ Compiler with C++11 support
  • MaсOS Mojave 10.14:
    • Clang Compiler with C++11 support

Get source code

The following code snippet downloads project source code repository, enters project root folder and runs submodules init in order to get dependencies source code initialized. Must be executed from the folder where you want to locate project.

$ git clone https://github.com/EgorOrachyov/Berserk.git
$ cd Berserk

Configure and run build

The following code snippet runs cmake build configuration process with output into build directory, in Release mode with tests BERSERK_BUILD_TESTS=ON enabled. Then runs build process for build directory in verbose mode with -j 4 four system threads. Must be executed from project root folder.

$ cmake . -B build -G Ninja -DCMAKE_BUILD_TYPE=Release -DBERSERK_BUILD_TESTS=ON
$ cmake --build build --target all --verbose -j 4

On macOS, you can optionally specify target binaries architecture to build. Pass option -DCMAKE_OSX_ARCHITECTURES with x86_64 or arm64 respectively. By default, build falls back to CMAKE_SYSTEM_PROCESSOR specified architecture. See example bellow, replace <arch> with desired architecture for your build.

$ cmake . -B build -G Ninja -DCMAKE_BUILD_TYPE=Release -DBERSERK_BUILD_TESTS=ON -DCMAKE_OSX_ARCHITECTURES=<arch>
$ cmake --build build --target all --verbose -j 4

Run

The following code snippet executed python script, which allows to run all native C++ library unit-tests, located in build directory, specified in --build-dir=build. Must be executed from project root folder.

python ./scripts/run_tests.py --build-dir=build

Directory structure

Berserk
├── code - Engine source code and dependencies
│   └── runtime - runtime engine infrastructure
│       ├── core - primary core module
│       ├── platform - platform specific code
│       ├── rhi - rendering hardware interface
│       │   ├── vulkan - rhi implementation backend for Vulkan rendering 
│       │   └── opengl - rhi implementation backend for OpenGL rendering
│       ├── render - high-level rendering system
│       ├── physics - physics system
│       ├── audio - audio system
│       ├── scene - game scene, objects and components management
│       ├── resource - eninge resources and resource management
│       └── scripts - scripting system
├── engine - engine config, textures, shaders, resources and etc.
├── example - example cpp test project
├── tests - tests for engine modules
├── templates - game project templates for engine
├── scripts - script utilities for development
├── docs - documents, text files and various helpful stuff
├── deps - project dependencies
│   ├── glew - for OpenGL functions and extensions loading
│   ├── glfw - for cross-platform window and input management
│   ├── glslang - for runtime glsl to spir-v shaders compilation
│   ├── googletest - for unit-testing of the engine source code modules
│   ├── pfd - portable file dialogs for native OS dialogs access
│   ├── stbimage - image utilities for images loading, writing and resizing
│   ├── tinyobj - for tiny wavefront obj models loading
│   ├── tinyxml2 - for utf-8 xml files processing
│   ├── vma - vulkan memory allocation library
│   ├── whereami - for executable location extraction
│   └── yamc - for C++ locks implementation
└── CMakeLists.txt - project cmake config

License

This project licensed under MIT license. License text can be found in license file.

Also

If you have any questions, ideas, how to improve/implement something, or you want to contribute to the project, please, feel free to contact me at egororachyov@gmail.com. Also, you can create an issue or pull request in the repository.