/ElvenEngine

2D/3D game engine from scratch

Primary LanguageC++MIT LicenseMIT

Elven Engine

Build CodeQL License Codacy Badge

Elven Engine is primarily a 2D/3D game engine that is being developed from scratch.

Features

  • Logging system
  • Event system (non-blocking event queue-based system, described architecture in the article)
  • Custom 3D math library (lia)
  • Renderer Core
    • RHI (Render Hardware Interface): Buffers, Shader, Texture, Render Target
    • Graphics API agnostic Renderer API
    • Modern OpenGL (with Direct State Access) specific Renderer API implementation
    • Shader loading
    • Async texture loading
    • Camera (orthographic, perspective)
    • Render Passes based on Render Targets
  • 2D Renderer
    • Quad rendering
    • Texture rendering
    • Batch rendering (quad and texture)
    • Text Rendering
    • Spritesheet animation
  • 3D Renderer (WIP)
    • Phong/Blinn-Phong Lighting
    • Multiple light casters: spotlight, directional, and point light
    • Mesh-Material system (Static mesh support with one material slot per mesh/submesh for now)
    • Primitives: cube, sphere, plane
    • Async 3D model loading and async material textures loading
    • Render Target
    • MSAA (Multisample anti-alising)
    • Post-processor: blur with custom mask texture building algorithms
    • Uniform buffer
    • Cubemap
    • Shadows
  • ECS (investigated different techniques and my particular architecture in the article)
    • Data-oriented cache-friendly components system architecture
    • In-Engine components: Transform, Sprite, Text, Quad, StaticMesh, Camera, UITransform, AABB, Tag, Sound, PointLight/DirectionalLight/SpotLight.
    • Components serialization
    • Behavior component as the entity brain
    • Optional Systems for usability
  • Scene
    • Interface to work with ECS
    • Scene Graph based on SceneNodeComponent
    • Scene serialization (not all of the components now)
  • Data-driven architecture
    • Load/Save engine settings from/to JSON files
  • Sound engine
    • Support formats: mp3, wav, ogg, flac etc.
    • Add/Play/Pause/Stop/Loop functionality
  • In-engine editor (WIP; based on ImGui)
    • Editor Camera (holding RMB): WASD movement, QE up/down, ZX rotation
    • Scene hierarchy panel
    • Context menu to add/delete entity
    • Properties panel:
      • Components: Transform, Static Mesh with material, Point/Directional/Spot light, UI transform, Text, Sprite
      • "Add component" button
      • Component settings context menu
    • Settings panel: fullscreen, VSync, MSAA
    • Telemetry: performance panel
    • Graphics stats
  • Just cool stuff
    • Fullscreen switch support
    • Orthographic camera controller (OrthographicCameraController), that can be used if needed
    • Fly(FPS-like) 3D camera support (CameraController)
  • Multithreading support
    • async resources loading: texture, mesh
    • Thread pool

Demo

3D rendering

Demo video on youtube (click on image):

2D Rendering

Space Invaders full demo

Invaders_demo.mp4
Space Invades TRON
Ping Pong Quad and texture batch rendering (20000 wizards)

Getting Started

Windows platform only support for now (Linux and MacOS platforms are for future support)

You can clone the repository using git (--recursive is required to fetch all of the submodules):

git clone --recursive https://github.com/kryvytskyidenys/ElvenEngine

Firstly you need to install cmake 3.10+ version (3.21+ for VS 2022 support).

Windows

  1. Configure and build third-party libraries: scripts/setup-vendor.bat
  2. Configure Visual Studio solution for the Engine and Game/Example projects: scripts/configure-vs2022.
  3. Build a solution using one of the following ways:
    • cmake-based script scripts/build.bat (pass Debug/Release as an argument)
    • Visual Studio (ElvenEngine.sln file is placed in the build directory).

CMake build options

You can modify configure file to enable/disable the following cmake options:

  • BUILD_SANDBOX (default ON): Enable Sandbox2D and Sandbox3D projects build
  • BUILD_GAMES (default ON): Enable Games build
  • PROFILE_MODE (default ON): Enable Profiling (PROFILE_MODE preprocessor definition will be added)
  • MODULE_EDITOR_ENABLED (default ON): Enable Editor (MODULE_EDITOR_ENABLED preprocessor definition will be defined)
  • MODULE_3D_ENABLED (default ON): Enable 3D module and Assimp library for 3D model loading (MODULE_3D_ENABLED preprocessor definition will be defined). IMPORTANT: ON - only Sandbox3D project will be configured, OFF - only Sandbox2D and Games projects will be configured.
  • MODULE_SOUND_ENABLED (default ON): Enable sound module (MODULE_SOUND_ENABLED preprocessor definition will be defined)

Third-party libraries

Lib
cmake build system
spdlog header-only logging library
GLFW windows, OpenGL contexts and handle input
glad 2 OpenGL loader
lia my custom math library
ImGui library using for GUI (visual-editor)
stb image image loader
json json lib for serialization and data-driven architecture
irrKlang sound library
fmt formatting library
freetype fonts rendering
assimp 3D model loading