Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Some fixes and improvements #22

Merged
merged 3 commits into from
Feb 18, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added .255.cache.bin
Binary file not shown.
3 changes: 0 additions & 3 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
[submodule "modules/thirdparty-yaml-cpp/yaml-cppmodules/thirdparty-yaml-cpp/yaml-cpp"]
path = modules/thirdparty-yaml-cpp/yaml-cppmodules/thirdparty-yaml-cpp/yaml-cpp
url = https://github.com/EldarMuradov/yaml-cpp.git
[submodule "modules/thirdparty-yaml-cpp/yaml-cpp"]
path = modules/thirdparty-yaml-cpp/yaml-cpp
url = https://github.com/EldarMuradov/yaml-cpp.git
Expand Down
5 changes: 5 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ cmake_minimum_required(VERSION 3.12)
set(ERA_ENGINE_PATH ${CMAKE_SOURCE_DIR})

include(cmake/common.cmake)
include(cmake/deploy.cmake)

project(EraEngine VERSION 1.0)

Expand All @@ -17,5 +18,9 @@ add_subdirectory(modules/physics)

add_subdirectory(apps/editor)
add_subdirectory(apps/example_game)
add_subdirectory(apps/assets_compiler)

era_add_deploy_target(editor)
era_add_deploy_target(example_game)

set_property(GLOBAL PROPERTY USE_FOLDERS ON)
152 changes: 151 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1,151 @@
# Engine

![EraEngine Logo](https://github.com/EldarMuradov/EldarMuradov/blob/a4d76f9ec241f35d76237f3e637cbf1921de5d2d/Editor.png)

![EraEngine Logo](https://github.com/EldarMuradov/EldarMuradov/blob/99a6272b7b5f123c8f20b7c39f773714f79810cd/MESH_EDITOR.png)

![EraEngine Logo](https://github.com/EldarMuradov/EldarMuradov/blob/56c453501a5edb8bdbd7747548e99b94ff188e14/AKT2.png)


# Era Game Engine

[![C++](https://img.shields.io/badge/language-C%2B%2B-%23f34b7d.svg?style=plastic)](https://en.wikipedia.org/wiki/C%2B%2B)
[![x64](https://img.shields.io/badge/arch-x64-red.svg?style=plastic)](https://en.wikipedia.org/wiki/X64)

<a href="https://github.com/EldarMuradov/EraEngine"><img alt="platforms" src="https://img.shields.io/badge/platforms-Windows-blue?style=flat-square"/></a>

![Build workflow](https://github.com/EldarMuradov/EraEngine/actions/workflows/cmake-windows-platform.yml/badge.svg)

# About

Era Engine is a modern ECS-based game engine that provides developers with powerful tools for creating 2D/3D games. It includes the following features and functionality:

### Entity Component System:
Era Engine uses ECS to manage game objects and their behavior. This allows developers to easily create and modify complex systems in the game.

### Rendering:
The engine uses DirectX 12 to provide high-quality and efficient rendering, allowing you to create visually appealing games with advanced graphical effects. DLSS 3.5 and FSR 2.0 supported.

### Physics:
Integration with PhysX 5.3.1 and CUDA provides realistic simulation of game physics, including collisions, GJK (overlapping, raycasting etc), gravity, aggregates, articulations, soft bodies, GPU particles, GPU clothes, joints, Blast Physics Destructions, Mesh destructions, ragdolls, vehicles, CPU-based tasks, physics event system etc.

### User Interface:
ImGui is integrated into the engine to create intuitive and customizable user interfaces in games.

## Audio:
Engine provides API and tools to work with 3D Audio. You can customize all audio settings and preferences to create realistic high quality sounds.

### Scripting:
Era Engine uses .NET 8.0 Native AOT and Runtime. This allows developers to write scripts in C# with all the benefits of .NET, including high performance and a rich class library.

# Dependencies

-PhysX 5.3.1

-DirectX 12

-EnTT

-ImGUI

-CUDA

-Blast

-.NET 8.0 (Native AOT and Runtime)

# Features

-Real-time raytracing (DXR)

-DLSS 3.5

-FSR 2.0

-Rigidbodies and colliders

-Fluid Physics

-Blast Physics Destructions

-PBR Rendering

-GPU PBD Particle Systems

-GPU PBD Clothing Systems

-Physics Joints

-Physics Aggregates

-CPU Tasks

-GPU Physics

-Forward rendering

-Decals

-Material editing

-ECS

-Horizon-based ambient occlusion

-Screen space shadows

-CCD

-Skeletal animation

-Editor

-MSAA

-Building

-Spot lights

-Resource system

-Temporal anti-aliasing

-Mesh shaders

-Mesh and Audio Editors

-Scene management

-Saving system

-Undoable components

-Custom physics engine

-.NET 8 scripting

-Job system

-Screen space reflections

-Path tracing

-Cascaded shadow maps

-GI

-Point lights

-Audio system

-Child-parent system

-Post processing

# TODO:

-Console support

-Networking components


Some other researches and repositories were used while developing game engine. Thanks P. Kurth, O. Ocornut, M. Caini, NVIDIA, Ubisoft and Microsoft.
12 changes: 12 additions & 0 deletions apps/assets_compiler/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
include(${CMAKE_SOURCE_DIR}/cmake/common.cmake)

era_begin(assets_compiler "APP")
require_thirdparty_module(assets_compiler EnTT)
require_thirdparty_module(assets_compiler yaml-cpp)
require_thirdparty_module(assets_compiler rttr_core)
require_thirdparty_module(assets_compiler DirectXTex)
require_module(assets_compiler base)
require_module(assets_compiler core)

target_include_directories(assets_compiler PUBLIC modules/thirdparty-imgui/imgui)
era_end(assets_compiler)
90 changes: 90 additions & 0 deletions apps/assets_compiler/src/compiler/main.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
// Copyright (c) 2023-present Eldar Muradov. All rights reserved.
#include <fstream>
#include <iostream>

#include <clara/clapa.hpp>

#include <asset/bin.h>
#include <asset/model_asset.h>

#include <core/log.h>
#include <core/string.h>

int main(int argc, char** argv)
{
using namespace era_engine;
using namespace clara;

try
{
fs::path path;
bool verbose = false;

Parser cli;
cli += Opt(verbose, "verbose")["-v"]["--verbose"]("Enable verbose logging");
cli += Opt(path, "path")["-p"]["--path"]("Path to asset");

auto result = cli.parse(Args(argc, argv));
if (!result)
{
std::cerr << "Error in command line: " << result.errorMessage() << std::endl;
}

path = get_full_path(path);

if (!fs::exists(path))
{
std::cerr << "Could not find file '" << path << "'.\n";
return EXIT_FAILURE;
}

std::string extension = path.extension().string();

fs::path cached_filename = path;
cached_filename.replace_extension("." + std::to_string(mesh_flag_default) + ".cache.bin");
fs::path cache_filepath = L"asset_cache" / cached_filename;

if (fs::exists(cache_filepath))
{
auto last_cache_write_time = fs::last_write_time(cache_filepath);
auto last_original_write_time = fs::last_write_time(path);

if (last_cache_write_time > last_original_write_time)
{
std::cout << "Asset is already compiled! \n";
return EXIT_SUCCESS;
}
}

std::cout << "Preprocessing asset '" << path << "' for faster loading next time.\n";

ModelAsset result_mesh;

std::transform(extension.begin(), extension.end(), extension.begin(),
[](char c) { return std::tolower(c); });
if (extension == ".fbx")
{
result_mesh = loadFBX(path, mesh_flag_default);
}
else if (extension == ".obj")
{
result_mesh = loadOBJ(path, mesh_flag_default);
}

fs::create_directories(cache_filepath.parent_path());
writeBIN(result_mesh, cache_filepath);
}
catch (const std::exception& ex)
{
std::cerr << ex.what() << "\n";

std::ofstream output("logs/compiler_error_log.txt");
output << "Runtime Error>" << ex.what() << std::endl;
output.close();

std::this_thread::sleep_for(std::chrono::duration<float>(5000.0f));
return EXIT_FAILURE;
}

return EXIT_SUCCESS;
}
4 changes: 4 additions & 0 deletions apps/editor/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
include(${CMAKE_SOURCE_DIR}/cmake/common.cmake)

era_begin(editor "APP")
require_thirdparty_module(editor EnTT)
require_thirdparty_module(editor yaml-cpp)
require_thirdparty_module(editor rttr_core)
require_thirdparty_module(editor DirectXTex)
require_module(editor base)
require_module(editor core)
require_module(editor physics)
Expand Down
77 changes: 77 additions & 0 deletions apps/editor/src/editor/drag_n_drop_system.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
#include "editor/drag_n_drop_system.h"
#include "editor/file_utils.h"

#include <engine/engine.h>

#include <core/editor_icons.h>
#include <core/imgui.h>

#include <rendering/ecs/renderer_holder_root_component.h>

#include <ecs/update_groups.h>

#include <rttr/policy.h>
#include <rttr/registration>

#define IMGUI_DEFINE_MATH_OPERATORS
#include <imgui/imgui_draw.cpp>
#include <imgui/imgui.cpp>
#include <imgui/imgui_widgets.cpp>
#include <imgui/imgui_demo.cpp>
#include <imgui/imgui_tables.cpp>
#include <imgui/imgui_internal.h>

namespace era_engine
{

RTTR_REGISTRATION
{
using namespace rttr;

registration::class_<DragNDropSystem>("DragNDropSystem")
.constructor<World*>()(policy::ctor::as_raw_ptr)
.method("update", &DragNDropSystem::update)(metadata("update_group", update_types::INPUT), metadata("After", std::vector<std::string>{"InputSystem::update"}));
}

DragNDropSystem::DragNDropSystem(World* _world)
: System(_world)
{

}

DragNDropSystem::~DragNDropSystem()
{
}

void DragNDropSystem::init()
{
renderer_holder_rc = world->add_root_component<RendererHolderRootComponent>();
ASSERT(renderer_holder_rc != nullptr);
}

void DragNDropSystem::update(float dt)
{
//float render_width = static_cast<float>(renderer_holder_rc->width);
//float render_height = static_cast<float>(renderer_holder_rc->height);

//// The drag&drop outline is rendered around the drop target. Since the image fills the frame, the outline is outside the window
//// and thus invisible. So instead this (slightly smaller) Dummy acts as the drop target.
//// Important: This is below the input processing, so that we don't override the current element id.
//ImGui::SetCursorPos(ImVec2(4.5f, 4.5f));
//ImGui::Dummy(ImVec2(render_width - 9.0f, render_height - 9.0f));
//
//if (ImGui::BeginDragDropTarget())
//{
// if (const ImGuiPayload* payload = ImGui::AcceptDragDropPayload(EDITOR_ICON_MESH))
// {
// EditorFileUtils::handle_file_drop((const char*)payload->Data, world);
// }
// if (const ImGuiPayload* payload = ImGui::AcceptDragDropPayload(EDITOR_ICON_IMAGE_HDR))
// {
// EditorFileUtils::handle_file_drop((const char*)payload->Data, world);
// }
// ImGui::EndDragDropTarget();
//}
}

}
Loading