Skip to content

Rythe-Interactive/Legion-Engine.rythe-legacy

Repository files navigation

legion logo banner build analyze docs License-MIT Discord

Legion-Engine

Legion-Engine is a data oriented C++17 OpenGL game engine built to make optimal use of modern hardware.

The Legion-Core is built on an async compute minded design to take care of the logic and an ECS to take care of the data. This allows the engine and editor to utilize all the power they can find and to be extremely modular.

Features

Rendering

  • Post-processing stack
  • Particle system
  • PBR
  • Imgui
  • Automatic exposure
  • Modular rendering pipeline
  • Custom shader support & shader standard library
  • shader precompiler lgnspre
  • GLTF & OBJ support

Physics

  • Convex quick hull generation
  • Diviner physics engine

Preview Feature

  • Dynamic Destruction Demo

ECS

  • Data oriented
  • Thread-safe
  • "Archetype" support

Eventsystem

  • Thread-safe eventbus
  • Unique & Persistent events
  • easy extensebility

Audio

  • Spatial audio
  • Non-spatial audio
  • Dopplereffect
  • MP3 & WAV support
  • Stereo->Mono conversion

Compute

  • OpenCL frontend with support for buffers & textures
  • High level abstractions

Misc

  • Virtual filesystem
  • Serialization & Scenes(Alpha)
  • Job scheduling
  • Pipeline scheduling for multiple main threads
  • Modular Processchains
  • Custom logging support
  • Custom input system
  • Extended standard library
  • Modular Architecture
  • Math extensions to GLM

Getting Started

Prerequisites

The engine is by default build using Visual Studio 19 using the Clang++ compiler and C++17. For linux we don't provide any default IDE support. However, you can still compile the engine using Clang++.

Install

You can either build the engine yourself using Premake5 or the already provided Visual Studio 19 solution. As of now Legion does not support compilation to DLL. Copy the include folder to your project and link the libraries you compiled.

Setup

Legion already defines the C++ entry point in it's own source code. So in order to start making a program define LEGION_ENTRY and include any of modules main include files. eg:

#define LEGION_ENTRY
#include <core/core.hpp>

Since the entry point is already defined you need to define a different function to start working with Legion. Legion will already start itself, but it won't have any modules attached. In order to attach modules you need to define the reportModules function like so:

#include "mymodule.hpp"
using namespace legion;

void LEGION_CCONV reportModules(Engine* engine)
{
    engine->reportModule<MyModule>();
    engine->reportModule<app::ApplicationModule>();
}

Of course in order to link your own modules you need to make one:

#include <core/core.hpp>
#include "mysystem.hpp"

class TestModule : public legion::Module
{
public:
    virtual void setup() override
    {
        reportComponentType<my_component>(); // Report a component type
        reportSystem<MySystem>(); // Report a system
    }
};

Legion engine uses an ECS for all of it's core functionality. So for your own project you need to define your own systems and components:

#include <core/core.hpp>

struct my_component { int myVal; };

class MySystem final : public legion::System<MySystem>
{
    virtual void setup()
    {
        createProcess<&MySystem::update>("Update");
    }
    
    void update(legion::time::span deltaTime)
    {
        // Do stuff every frame on the update thread
        static auto myQuery = createQuery<my_component, position>();
        mQuery.queryEntities();
        for(auto entity : myQuery)
        {
            // Runs for every entity that has both my_component and a position component.
        }
    }
};

For more information about the engine usage see the docs.

Dependencies

(All libraries can already be found in the deps folder)

Contributing

Please read CONTRIBUTING.md for details on our code of conduct, and the process for submitting pull requests to us.

Authors

See also the list of contributors who participated in this project.

License

This project is licensed under the MIT License - see the LICENSE file for details