Skip to content

High-performance 2d and 3d game engine with Vulkan and OpenGL backends [WIP]

License

Notifications You must be signed in to change notification settings

EgorOrachyov/wmoge

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

logo

Wmoge Engine

build clang format docs c/c++ language license

"Write my own game engine (wmoge)" is a modern high-performance 3d graphics game engine with Vulkan and OpenGL backends. The idea of the project is to implement a self-sufficient, small, but featured engine and a number of 2d and 3d games using it. Primary focus is the core architecture of the engine, reliability, clean and performant code. Currently, the work is focused on a minor refactoring, new runtime scene representation, building a high-level rendering system, refactoring audio, scripting systems, and bringing physics support. The engine is a personal learning/hobby project for educational purposes only.

About the engine

Features

  • πŸ–₯️ Platform-agnostic, with support for common operating systems such as Windows, Linux and macOS.
  • πŸ”¨ Moder C++17 based engine with clear architecture.
  • πŸ”¨ Full runtime reflection system (RTTI) with class, method and property information.
  • 🏎️ Task manager and task graph support for concurrent execution.
  • 🏎️ Custom async (future & promise) implementation with join, notify and continuation.
  • 🏎️ Extendet set of containers, with buffered vector, flat maps, sets, etc.
  • βš™ Command line and hook system to build custom tools.
  • βš™ Simple stack-based config system.
  • βš™ Dependency injection and IoC container system for global managers.
  • πŸŽ₯ Higl-level render dendency graph (RDG) for scheduling GPU rendering and compute work.
  • πŸŽ₯ Modern graphics (gfx) device interface for GPU driver communication.
  • πŸŽ₯ Explicit command list and resource bariers management in gfx api.
  • πŸŽ₯ Vulkan-based gfx device backend.
  • πŸŽ₯ (future) OpenGL-based gfx device backend.
  • πŸŽ₯ (future) DX12-based gfx device backend.
  • 🎨 Custom shader files syntax support to write any shaders with rich features.
  • 🎨 Automated fast runtime shaders reflection generatiom.
  • 🎨 Automated shaders layout creation, compilation and reloading.
  • 🎨 Built-in GLSL shader compiler for online compilation.
  • 🎨 Hot-reloading of shaders at runtime.
  • 🎨 Compiled shaders runtime and offline cahce to speed-up loading.
  • 🎨 Gpu pipelines runtime and offline cache to speed-up rendering.
  • πŸ“¦ Async resource-loading system with runtime cache.
  • πŸ“¦ Unified resources handling, meta-information, support for external formats through custom loaders.
  • πŸ“¦ Yaml and binary serialization support.
  • πŸ“¦ LZ4 compression and decompression for fast assets loading.
  • πŸ“¦ Gpu texture compression into BCn (1-7) format for faster loading, rendering and lower memory usage.
  • πŸ…°οΈ Custom math library with 2d and 3d-space primitives.
  • πŸ…°οΈ (future) SIMD utilities for fast vectorized math.
  • 🧱 Ecs-based scene model with fast, parallel and memory-friendly update.
  • 🎧 (in progress) OpenAL audio renderer for playing game sounds.
  • πŸ“œ (in progress) Modern Lua scripting backend for game logic programming.
  • 🐞 Built-in CPU performance and tasking profiling with support for custom labels and metadata.
  • 🐞 Built-in GPU performance profiler for separate GPU queues / command lists.
  • 🐞 CPU & GPU trace collection with support to google trace exporting.
  • 🐞 Debug GPU labels objects and events for RenderDoc captures.
  • 🐞 In-game dev console with support for console commands and console variables.

Platforms

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

Dependencies

  • assimp for geometry, material and scene assets importing into engine.
  • audio file for simple audio loading from wav files.
  • base64 for base64 encoding/decoding in text serialization.
  • compressonator texture compression library.
  • cxxopts for command-line options processing.
  • dynalo for cross platform dynamic loading of shared libraries.
  • filewatch for OS file system events tracking.
  • freetype for true-type fonts loading and rendering.
  • glfw for cross-platform window and input management.
  • glslang for runtime glsl to spir-v shaders compilation.
  • lua project C source with cmake script for scripting.
  • lua bridge to simplify lua and C++ bindings.
  • lz4 for fast compression and decompression at runtime.
  • magic enum for static enum reflection.
  • openal soft as a software audio renderer.
  • rapidyaml for fast yaml files parsing and serialization.
  • robin hood hashing for fast & memory efficient hashtable.
  • sha256 for sha256 hashes computation.
  • stbimage image utilities for images loading, writing and resizing.
  • svector compact SVO optimized vector for C++17 or higher.
  • tinyxml2 for utf-8 xml files processing.
  • vma vulkan library for memory allocation.
  • volk meta loader for vulkan API.
  • whereami for executable location extracting.
  • yamc for faster mutual-exclusion and MT synchronization.
  • zlib for files compression (required for assimp and freetype).

References

Building from sources

Prerequisites

  • 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++ 17 support
    • x64 Native Tools Command Prompt for VS
  • Ubuntu 20.04:
    • GNU C++ Compiler with C++ 17 support
  • MaсOS Catalina 10.15:
    • Clang Compiler with C++ 17 support

Get source code

The following code snippet downloads project source code repository, and enters project root folder. Must be executed from the folder where you want to locate project.

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

Configure and run build

Attention! On Windows platform building commands must be executed in x64 Native Tools Command Prompt for VS.

The following code snippet runs build.py script, which allows configuring cmake and running of actual build with selected options. You can specify build directory, build type, number of system threads for build. Must be executed from project root folder.

$ python ./build.py --build-dir=build --build-type=Release --nt=4

On macOS, you can optionally specify target binaries architecture to build. Pass option --arch 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. Must be executed from project root folder.

$ python ./build.py --build-dir=build --build-type=Release --nt=4 --arch=<arch>

In order to run a template project demo, execute following command to start demo game executable. The optional root_remap argument tells engine where its root directory with all config files and resources is located. In our case the template directory will be used as a root.

$ build/template/template.exe --root_remap="template/"

Contributing

If you want to fix code or tutorial text issue, add new functionality, or even new tutorial step, feel free to contribute to the project following contributing guide and code of conduct.

Disclaimer

This is a personal learning project. It does not claim to be the ultimate guide to building real AAA game engines. However, it can be useful for those who, like me at the time, want to learn something more than the basics and do something on their own. This project accumulates ideas and knowledge from several books and can be a good starting point for learning!

Also

If you have any questions, feel free to contact me at egororachyov@gmail.com. If you have any ideas, questions, how to make or improve something, please, do not hesitate to open new issue or pull-request inside this project. I will try to respond as soon as possible to them.

Contributors

Citation

@online{wmoge,
  author = {Orachyov, Egor},
  title = {Wmoge: High-performance 2d and 3d game engine with Vulkan and OpenGL backends},
  year = 2023,
  url = {https://github.com/EgorOrachyov/wmoge},
  note = {Version 1.0.0}
}

Project structure

Entry Description
πŸ“ .github CI/CD scripts and GitHub related files
πŸ“ docs Additional project documents and resources
πŸ“ deps Third-party project dependencies, stored as is
πŸ“ engine Engine sources code, shaders, config, plugins sources
πŸ“ template Template project which can be used as a base for a game
πŸ“ games Example games created with engine
πŸ“„ CMakeLists.txt CMake configuration, add as sub directory to your project
πŸ“„ build.py Script to build project sources and examples

License

MIT License

Copyright (c) 2023 Egor Orachyov

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.