diff --git a/.github/workflows/checks.yml b/.github/workflows/Linux.yml similarity index 60% rename from .github/workflows/checks.yml rename to .github/workflows/Linux.yml index 3b566100..39da3a4d 100644 --- a/.github/workflows/checks.yml +++ b/.github/workflows/Linux.yml @@ -1,13 +1,8 @@ -name: cmake +name: Linux on: [check_run, pull_request] jobs: - cmake-build: - runs-on: ${{ matrix.os }} - - strategy: - fail-fast: false - matrix: - os: [ubuntu-latest, windows-latest] + cmake-build-linux: + runs-on: ubuntu-latest steps: - name: Checkout project @@ -20,22 +15,10 @@ jobs: key: vcpkg-cache-${{ runner.os }} - name: Apt install for Ubuntu - if: matrix.os == 'ubuntu-latest' run: | sudo apt install libxinerama-dev libxcursor-dev xorg-dev libglu1-mesa-dev pkg-config - - name: Install dependencies on Windows (vcpkg) - if: matrix.os == 'windows-latest' - shell: pwsh - run: | - if (-Not (Test-Path "vcpkg")) { - git clone https://github.com/microsoft/vcpkg.git - .\vcpkg\bootstrap-vcpkg.bat - } - .\vcpkg\vcpkg install - - name: Install dependencies on Ubuntu (vcpkg) - if: matrix.os == 'ubuntu-latest' run: | if [ ! -d "vcpkg" ]; then git clone https://github.com/microsoft/vcpkg.git @@ -43,7 +26,7 @@ jobs: fi ./vcpkg/vcpkg install - - name: Build project (Windows or Ubuntu) + - name: Build project run: | cmake -B build -DCMAKE_TOOLCHAIN_FILE=${{ github.workspace }}/vcpkg/scripts/buildsystems/vcpkg.cmake cmake --build build/ --config Debug diff --git a/.github/workflows/Windows.yml b/.github/workflows/Windows.yml new file mode 100644 index 00000000..11ca51ed --- /dev/null +++ b/.github/workflows/Windows.yml @@ -0,0 +1,34 @@ +name: Windows +on: [check_run, pull_request] +jobs: + cmake-build-windows: + runs-on: windows-latest + + steps: + - name: Checkout project + uses: actions/checkout@v4 + + - name: Cache vcpkg + uses: actions/cache@v4 + with: + path: vcpkg + key: vcpkg-cache-${{ runner.os }} + + - name: Install dependencies on Windows (vcpkg) + shell: pwsh + run: | + if (-Not (Test-Path "vcpkg")) { + git clone https://github.com/microsoft/vcpkg.git + .\vcpkg\bootstrap-vcpkg.bat + } + .\vcpkg\vcpkg install + + - name: Build project + run: | + cmake -B build -DCMAKE_TOOLCHAIN_FILE=${{ github.workspace }}/vcpkg/scripts/buildsystems/vcpkg.cmake + cmake --build build/ --config Debug + + - name: Run tests + run: | + cd build/tests/ + ctest -C Debug diff --git a/Engine/Client/CMakeLists.txt b/Engine/Client/CMakeLists.txt index 2ac9274d..06e7dc46 100644 --- a/Engine/Client/CMakeLists.txt +++ b/Engine/Client/CMakeLists.txt @@ -6,7 +6,28 @@ set(EXECUTABLE_OUTPUT_PATH ${CMAKE_SOURCE_DIR}/Game) set(EXE_SRC_PATH "Src") set(EXE_INCLUDE_PATH "Include") -set(COMPONENT_SRC_FILE ./Src/Components/ShaderComponent/ShaderPathComponent.cpp) +set(COMPONENT_SRC_FILE + ./Src/Components/ShaderComponent/ShaderPathComponent.cpp + ../Shared/Component/FontPathComponent.cpp + ../Shared/Component/ObjPathComponent.cpp + ../Shared/Component/TexturePathComponent.cpp + ../Shared/Component/ScaleComponent.cpp + ../Shared/Component/ColourComponent.cpp + ../Shared/Component/Position3DComponent.cpp + ../Shared/Component/Position2DComponent.cpp + ../Shared/Component/Size1DComponent.cpp + ../Shared/Component/TextComponent.cpp + ../Shared/Component/MaterialMapComponent.cpp + ../Shared/Component/MusicPathComponent.cpp + ../Shared/Component/MusicPitchComponent.cpp + ../Shared/Component/MusicVolumeComponent.cpp + ../Shared/Component/SoundPathComponent.cpp + ../Shared/Component/SoundPitchComponent.cpp + ../Shared/Component/SoundVolumeComponent.cpp +) +set(SYSTEM_SRC_FILE + Src/Systems/DrawOBJ/DrawOBJSystem.cpp +) set(COMPONENT_INCLUDE_DIR ./Include/Components/ShaderComponent) @@ -17,24 +38,10 @@ set(SRC_EXE Src/Application/Application.cpp Src/ClientSceneManager/ClientSceneManager.cpp Src/GraphicalLibrary/GetGraphicalLibrary.cpp + ../Shared/SceneManager/ASceneManager.cpp - ../Shared/Component/FontPathComponent.cpp - ../Shared/Component/ObjPathComponent.cpp - ../Shared/Component/TexturePathComponent.cpp - ../Shared/Component/ScaleComponent.cpp - ../Shared/Component/ColourComponent.cpp - ../Shared/Component/Position3DComponent.cpp - ../Shared/Component/Position2DComponent.cpp - ../Shared/Component/Size1DComponent.cpp - ../Shared/Component/TextComponent.cpp - ../Shared/Component/MaterialMapComponent.cpp - ../Shared/Component/MusicPathComponent.cpp - ../Shared/Component/MusicPitchComponent.cpp - ../Shared/Component/MusicVolumeComponent.cpp - ../Shared/Component/SoundPathComponent.cpp - ../Shared/Component/SoundPitchComponent.cpp - ../Shared/Component/SoundVolumeComponent.cpp ${COMPONENT_SRC_FILE} + ${SYSTEM_SRC_FILE} ) include_directories( @@ -43,6 +50,7 @@ include_directories( Src/ClientSceneManager Src/GraphicalLibrary Src/Errors + Src/Systems ../Shared/GraphicalLoad ../Shared/Component ../Shared/Ecs/Src diff --git a/Engine/Client/Src/Application/Application.cpp b/Engine/Client/Src/Application/Application.cpp index 2a4d1295..df29eab0 100644 --- a/Engine/Client/Src/Application/Application.cpp +++ b/Engine/Client/Src/Application/Application.cpp @@ -21,12 +21,20 @@ Application::Application() _registries = std::make_shared>(); SceneManager::ClientSceneManager sceneManager(_registries); + _initDefaultGraphicSystems(); + _client = std::make_shared("127.0.0.1", 4444, 4445); _client->connect([this](Network::UDPPacket packet) { this->_packetHandler(std::move(packet)); }); } +void Application::_initDefaultGraphicSystems() +{ + DrawOBJSystem drawOBJSystem; + _defaultSystems.push_back(drawOBJSystem.getFunction()); +} + void Application::run() { std::shared_ptr libGraphic = getGraphicalLibrary(); @@ -35,7 +43,11 @@ void Application::run() libGraphic->init(WINDOW_TITLE); while (libGraphic->windowIsOpen()) { + libGraphic->startDraw(); libGraphic->clear(); _registries->at(SceneManager::RegisterIndex::CURRENT).run_systems(-1); + for (auto defaultSystem : _defaultSystems) + defaultSystem(_registries->at(SceneManager::RegisterIndex::CURRENT), -1); + libGraphic->endDraw(); } } diff --git a/Engine/Client/Src/Application/Application.hpp b/Engine/Client/Src/Application/Application.hpp index 614263df..7e67200d 100644 --- a/Engine/Client/Src/Application/Application.hpp +++ b/Engine/Client/Src/Application/Application.hpp @@ -11,6 +11,7 @@ #include "Registry.hpp" #include "NetworkClient.hpp" +#include "DrawOBJ/DrawOBJSystem.hpp" #define WINDOW_TITLE "From noware" @@ -49,6 +50,13 @@ class Application { */ void _packetHandler(Network::UDPPacket packet); + /** + * @brief Initialize default graphics systems. + * + */ + void _initDefaultGraphicSystems(); + std::shared_ptr> _registries; // Registries for each scene. std::shared_ptr _client; // Network class for client. + std::vector> _defaultSystems; }; diff --git a/Engine/Client/Src/ClientSceneManager/ClientSceneManager.cpp b/Engine/Client/Src/ClientSceneManager/ClientSceneManager.cpp index e9fa1226..cc31555c 100644 --- a/Engine/Client/Src/ClientSceneManager/ClientSceneManager.cpp +++ b/Engine/Client/Src/ClientSceneManager/ClientSceneManager.cpp @@ -12,14 +12,17 @@ SceneManager::ClientSceneManager::ClientSceneManager(std::shared_ptr + +DrawOBJSystem::DrawOBJSystem() : + ASystem("DrawOBJSystem") +{ +} + +void DrawOBJSystem::_drawOBJ(ECS::Registry& reg, int idxPacketEntities) +{ + std::shared_ptr libGraphic = getGraphicalLibrary(); + + ECS::SparseArray objPathComponents = reg.get_components("ObjPathComponent"); + ECS::SparseArray position3DComponents = reg.get_components("Position3DComponent"); + ECS::SparseArray scaleComponents = reg.get_components("ScaleComponent"); + + for (ECS::entity_t entity = 0; objPathComponents.size() >= entity + 1; entity++) { + std::shared_ptr obj = std::dynamic_pointer_cast(objPathComponents[entity]); + + std::shared_ptr pos = (position3DComponents.size() >= entity + 1) ? + std::dynamic_pointer_cast(position3DComponents[entity]) : nullptr; + + std::shared_ptr scale = (scaleComponents.size() >= entity + 1) ? + std::dynamic_pointer_cast(scaleComponents[entity]) : nullptr; + + float modelScale; + + if (!obj) + continue; + modelScale = (scale) ? scale->scale : 1.0; + if (pos) + libGraphic->drawOBJ(obj->path, pos->x, pos->y, pos->z, modelScale); + else + libGraphic->drawOBJ(obj->path, 0, 0, 0, modelScale); + } +} + +extern "C" ISystem* loadSystemInstance() +{ + return new DrawOBJSystem(); +} diff --git a/Engine/Client/Src/Systems/DrawOBJ/DrawOBJSystem.hpp b/Engine/Client/Src/Systems/DrawOBJ/DrawOBJSystem.hpp new file mode 100644 index 00000000..68d92b90 --- /dev/null +++ b/Engine/Client/Src/Systems/DrawOBJ/DrawOBJSystem.hpp @@ -0,0 +1,49 @@ +/* +** EPITECH PROJECT, 2024 +** DrawOBJSystem +** File description: +** DrawOBJSystem +*/ + +#pragma once + +#include + +#include "ISystem.hpp" + +/** + * @brief System to draw an OBJ Model. + * + */ +class DrawOBJSystem : public ASystem { + + public: + + /** + * @brief Construct a new Draw OBJ System object. + * + */ + DrawOBJSystem(); + + /** + * @brief Destroy the Draw OBJ System object. + * + */ + ~DrawOBJSystem() = default; + + /** + * @brief Get the Function object. + * + * @return std::function + */ + std::function getFunction() + { + return [this](ECS::Registry& reg, int idxPacketEntities) { + _drawOBJ(reg, idxPacketEntities); + }; + } + + private: + + void _drawOBJ(ECS::Registry& reg, int idxPacketEntities); //< Function to init the player. +}; diff --git a/Engine/Shared/Ecs/Src/Registry.cpp b/Engine/Shared/Ecs/Src/Registry.cpp index b991a878..609b08eb 100644 --- a/Engine/Shared/Ecs/Src/Registry.cpp +++ b/Engine/Shared/Ecs/Src/Registry.cpp @@ -20,6 +20,11 @@ entity_t Registry::spawn_entity() { return _next_entity++; } +std::vector Registry::getEntities() +{ + return _entities; +} + entity_t Registry::entity_from_index(std::size_t idx) { if (idx < _entities.size()) return _entities[idx]; @@ -41,4 +46,15 @@ void Registry::run_systems(int idxPacketEntities) { system(*this, idxPacketEntities); } +void Registry::cloneComponentsArray(ECS::Registry ®istry) +{ + setComponentsArrays(registry._components_arrays, registry._remove_functions); +} + +void Registry::setComponentsArrays(std::unordered_map componentsArrays, std::unordered_map removeFunctions) +{ + _components_arrays = componentsArrays; + _remove_functions = removeFunctions; +} + } // namespace ECS diff --git a/Engine/Shared/Ecs/Src/Registry.hpp b/Engine/Shared/Ecs/Src/Registry.hpp index c5ec405e..ad9c732f 100644 --- a/Engine/Shared/Ecs/Src/Registry.hpp +++ b/Engine/Shared/Ecs/Src/Registry.hpp @@ -97,6 +97,12 @@ class Registry { */ entity_t spawn_entity(); + /** + * @brief Get Entity vector + * + */ + std::vector getEntities(); + /** * @brief Get entity from index. * This function throw an error if Entity @@ -111,7 +117,7 @@ class Registry { * @brief Kill an entity of the register. * The index is placed in the dead entities list. * - * @param entity Enity to kill. + * @param entity Entity to kill. */ void kill_entity(entity_t const& entity); @@ -121,6 +127,7 @@ class Registry { * @tparam Component type to set. * @param entity Entity. * @param component Component to set. + * @param typeIdx Type index of the component. * @return SparseArray::reference_type Reference of the component. */ template @@ -166,6 +173,21 @@ class Registry { using remove_func_t = std::function; + /** + * @brief Clone the components array of a registry. + * + * @param registry Registry to clone. + */ + void cloneComponentsArray(Registry ®istry); + + /** + * @brief Set the components arrays. + * + * @param componentsArrays Components arrays to set. + * @param removeFunctions Remove functions to set. + */ + void setComponentsArrays(std::unordered_map componentsArrays, std::unordered_map removeFunctions); + private: //Arrays diff --git a/Engine/Shared/Interface/IGraphic.hpp b/Engine/Shared/Interface/IGraphic.hpp index 51ef8a3f..979cc13a 100644 --- a/Engine/Shared/Interface/IGraphic.hpp +++ b/Engine/Shared/Interface/IGraphic.hpp @@ -50,4 +50,35 @@ class IGraphic { * @return int The key pressed. */ virtual std::size_t getKeyInput() = 0; + + /** + * @brief Draw an OBJ model on the screen. + * + * @param objPath Path to the OBJ Model to draw. + */ + + /** + * @brief Draw an OBJ model on the screen. + * + * @param objPath Path to the OBJ Model to draw. + * @param posx Position x + * @param posy Position y + * @param posz Position z + * @param scale Scale. + */ + virtual void drawOBJ(std::string objPath, float posx, float posy, float posz, float scale) = 0; + + /** + * @brief Start to draw on the window. + * Must be call at the begin of the Game loop. + * + */ + virtual void startDraw() = 0; + + /** + * @brief End to draw on the window. + * Must be call at the end of the Game loop. + * + */ + virtual void endDraw() = 0; }; diff --git a/Engine/Shared/SceneManager/ASceneManager.cpp b/Engine/Shared/SceneManager/ASceneManager.cpp index 4bfbe97a..d6347e6a 100644 --- a/Engine/Shared/SceneManager/ASceneManager.cpp +++ b/Engine/Shared/SceneManager/ASceneManager.cpp @@ -16,8 +16,10 @@ SceneManager::ASceneManager::ASceneManager(std::shared_ptrpush_back(ECS::Registry()); + _registries->at(i).cloneComponentsArray(_defaultRegistry); _keysSystems.push_back(std::unordered_map>()); _keysScenes.push_back(std::unordered_map>()); } @@ -44,7 +46,6 @@ void SceneManager::ASceneManager::_loadScene(const std::string &path, std::size_ if (!reader.parse(file, root, false)) throw SceneManagerErrors("Error while parsing the scene file: " + path); - _loadGraphicComponentsInRegister(_registries->at(index)); _loadSceneEntities(root, index); _loadSceneSystems(root, index); _loadSceneKeys(root, index); @@ -109,6 +110,7 @@ void SceneManager::ASceneManager::_loadSceneKeys(Json::Value root, std::size_t i void SceneManager::ASceneManager::_loadSceneKeysJson(std::string key, std::string path, std::size_t index) { _registries->push_back(ECS::Registry()); + _registries->at(_nextIndex).cloneComponentsArray(_defaultRegistry); _keysSystems.push_back(std::unordered_map>()); _keysScenes.push_back(std::unordered_map>()); _keysScenes[index][stringKeyMap.at(key)] = std::make_pair(_nextIndex, path); @@ -148,8 +150,22 @@ void SceneManager::ASceneManager::_changeScene(std::pair(component.get().getType()); + _defaultRegistry.register_component(ColourComponent().getType()); + _defaultRegistry.register_component(FontPathComponent().getType()); + _defaultRegistry.register_component(MaterialMapComponent().getType()); + _defaultRegistry.register_component(MusicPathComponent().getType()); + _defaultRegistry.register_component(MusicPitchComponent().getType()); + _defaultRegistry.register_component(MusicVolumeComponent().getType()); + _defaultRegistry.register_component(ObjPathComponent().getType()); + _defaultRegistry.register_component(Position2DComponent().getType()); + _defaultRegistry.register_component(Position3DComponent().getType()); + _defaultRegistry.register_component(ScaleComponent().getType()); + _defaultRegistry.register_component(Size1DComponent().getType()); + _defaultRegistry.register_component(SoundPathComponent().getType()); + _defaultRegistry.register_component(SoundPitchComponent().getType()); + _defaultRegistry.register_component(SoundVolumeComponent().getType()); + _defaultRegistry.register_component(TextComponent().getType()); + _defaultRegistry.register_component(TexturePathComponent().getType()); } diff --git a/Engine/Shared/SceneManager/ASceneManager.hpp b/Engine/Shared/SceneManager/ASceneManager.hpp index 173d3ebb..95cfea3b 100644 --- a/Engine/Shared/SceneManager/ASceneManager.hpp +++ b/Engine/Shared/SceneManager/ASceneManager.hpp @@ -70,47 +70,12 @@ namespace SceneManager { protected: - std::shared_ptr> _registries; // Registries for each scene. - std::vector>> _keysSystems; // Keys to load a system for each scene. - std::vector>> _keysScenes; // Keys to load a scene for each scene. - - std::size_t _nextIndex; // Index of the next empty registry. - - std::vector> _components { - _colourComponent, - _fontPathComponent, - _materialMapComponent, - _musicPathComponent, - _musicPitchComponent, - _musicVolumeComponent, - _objPathComponent, - _position2DComponent, - _position3DComponent, - _scaleComponent, - _size1DComponent, - _soundPathComponent, - _soundPitchComponent, - _soundVolumeComponent, - _textComponent, - _texturePathComponent - }; //< List of graphical components. - - ColourComponent _colourComponent; //< Colour component. - FontPathComponent _fontPathComponent; //< Font path component. - MaterialMapComponent _materialMapComponent; //< Material map component. - MusicPathComponent _musicPathComponent; //< Music path component. - MusicPitchComponent _musicPitchComponent; //< Music pitch component. - MusicVolumeComponent _musicVolumeComponent; //< Music volume component. - ObjPathComponent _objPathComponent; //< OBJ path component. - Position2DComponent _position2DComponent; //< Position 2D component. - Position3DComponent _position3DComponent; //< Position 3D component. - ScaleComponent _scaleComponent; //< Scale component. - Size1DComponent _size1DComponent; //< Size 1D component. - SoundPathComponent _soundPathComponent; //< Sound path component. - SoundPitchComponent _soundPitchComponent; //< Sound pitch component. - SoundVolumeComponent _soundVolumeComponent; //< Sound volume component. - TextComponent _textComponent; //< Text component. - TexturePathComponent _texturePathComponent; //< Texture path component. + std::shared_ptr> _registries; // Registries for each scene. + ECS::Registry _defaultRegistry; // Default registry for the scene manager. + std::vector>> _keysSystems; // Keys to load a system for each scene. + std::vector>> _keysScenes; // Keys to load a scene for each scene. + + std::size_t _nextIndex; // Index of the next empty registry. /** * @brief Get the component lib path. @@ -188,9 +153,8 @@ namespace SceneManager { void _changeScene(std::pair scene); /** - * @brief Load the graphical components in a register. - * @param registry Register to fill with components. + * @brief Initialise the default components of the scene manager. */ - void _loadGraphicComponentsInRegister(ECS::Registry registry); + void _initialiseDefaultComponents(); }; } diff --git a/GraphicLibrary/Src/GraphicLib.cpp b/GraphicLibrary/Src/GraphicLib.cpp index 4b4c161f..e85a0259 100644 --- a/GraphicLibrary/Src/GraphicLib.cpp +++ b/GraphicLibrary/Src/GraphicLib.cpp @@ -21,6 +21,16 @@ void GraphicLib::init(const std::string &windowName) { InitWindow(1920, 1080, windowName.c_str()); SetTargetFPS(140); + + Vector3 position = {0.0f, 0.0f, -10.0f}; + Vector3 target = {0.0f, 0.0f, 0.0f}; + Vector3 up = {0.0f, 1.0f, 0.0f}; + + _camera.position = position; // Camera position + _camera.target = target; // Camera looking at point + _camera.up = up; // Camera up vector (rotation towards target) + _camera.fovy = 45.0f; // Camera field-of-view Y + _camera.projection = CAMERA_PERSPECTIVE; // Camera projection type } bool GraphicLib::windowIsOpen() @@ -30,9 +40,7 @@ bool GraphicLib::windowIsOpen() void GraphicLib::clear() { - BeginDrawing(); ClearBackground(BLACK); - EndDrawing(); } std::size_t GraphicLib::getKeyInput() { @@ -42,3 +50,25 @@ std::size_t GraphicLib::getKeyInput() { } return KEY_NULL; } + +void GraphicLib::drawOBJ(std::string objPath, float posx, float posy, float posz, float scale) +{ + if (_models.find(objPath) == _models.end()) + _models[objPath] = LoadModel(objPath.c_str()); + + Vector3 position = { posx, posy, posz }; + + BeginMode3D(_camera); + DrawModel(_models[objPath], position, scale, WHITE); + EndMode3D(); +} + +void GraphicLib::startDraw() +{ + BeginDrawing(); +} + +void GraphicLib::endDraw() +{ + EndDrawing(); +} diff --git a/GraphicLibrary/Src/GraphicLib.hpp b/GraphicLibrary/Src/GraphicLib.hpp index b662f4d9..c1b673b4 100644 --- a/GraphicLibrary/Src/GraphicLib.hpp +++ b/GraphicLibrary/Src/GraphicLib.hpp @@ -10,6 +10,7 @@ #include "IGraphic.hpp" #include "raylib.h" +#include #include /** @@ -45,7 +46,7 @@ class GraphicLib : public IGraphic { * @brief Check if the window is open. * * @return true The window is open. - * @return false The window is closed. + * @return false The window is closed. / */ bool windowIsOpen(); @@ -61,4 +62,30 @@ class GraphicLib : public IGraphic { * @return KEY_MAP The key pressed. */ std::size_t getKeyInput(); + + /** + * @brief Draw an OBJ model on the screen. + * + * @param objPath Path to the OBJ Model to draw. + */ + void drawOBJ(std::string objPath, float posx, float posy, float posz, float scale); + + /** + * @brief Start to draw on the window. + * Must be call at the begin of the Game loop. + * + */ + void startDraw(); + + /** + * @brief End to draw on the window. + * Must be call at the end of the Game loop. + * + */ + void endDraw(); + + private: + + Camera _camera; //< Player camera. + std::unordered_map _models; //< List of Models loaded. }; diff --git a/README.md b/README.md index 6d6c2603..2d87880c 100644 --- a/README.md +++ b/README.md @@ -1,12 +1,212 @@ -# R-Type -Multi-threaded server and a graphical client for a well-known legacy video game called R-Type, using a game engine of our own design. +![Linux](https://github.com/FppEpitech/R-Type/actions/workflows/Linux.yml/badge.svg) +![Windows](https://github.com/FppEpitech/R-Type/actions/workflows/Windows.yml/badge.svg) -## How to build ? (Linux) -First, download the repository from Github, then compile it with: +# Table of Contents + +- [From Noware: The Team Behind the Madness](#from-noware-the-team-behind-the-madness) + - [Alban PERALTA](#alban-peralta--master-of-visual-sorcery) + - [Mathieu ROBERT](#mathieu-robert--architect-of-reality-or-whats-left-of-it) + - [Thomas BOUÉ](#thomas-boue--warden-of-game-structure-and-balance) + - [Axel FRADET](#axel-fradet--the-phantom-weaver-of-connections) + - [Théophile Jérôme-Rocher](#théophile-jérôme-rocher--the-unseen-arbiter-of-continuous-chaos) +- [Together, We Are From Noware](#together-we-are-from-noware) +- [R-Type Game Presentation](#r-type-game-presentation) + - [Overview](#overview) + - [Game Features](#game-features) + - [Engaging Gameplay](#engaging-gameplay) + - [Unique Mechanics](#unique-mechanics) + - [Stunning Visuals](#stunning-visuals) + - [Sound and Music](#sound-and-music) +- [Technical Details](#technical-details) + - [Development Tools](#development-tools) +- [Building Our Project: Development Mode and Plugin Setup](#building-our-project-development-mode-and-plugin-setup) + - [Prerequisites](#prerequisites) + - [Steps to Build the Project](#steps-to-build-the-project) + - [Clone the Project Repository](#1-clone-the-project-repository) + - [Install Dependencies](#2-install-dependencies) + - [Build the Project](#3-build-the-project) + - [Start Development](#4-start-development) +- [How to PLAY?](#how-to-play-) +- [How to launch tests?](#how-to-launch-tests) +- [Documentation](#documentation) + +--- + +![Team Logo](https://i.imgur.com/DnVU1l5.png) + +# From Noware: The Team Behind the Madness + +**Welcome to the world of From Noware**, where darkness meets code and innovation is forged in the fires of endless development. +We are a team of 5 brave developers, each wielding our own unique abilities to bring forth chaotic order into the realm of game development. +Together, we craft experiences that defy logic, with a dash of the absurd, but always with a deep love for our craft. +Meet the architects of this digital madness: + + +### **[Alban PERALTA](https://github.com/Peralban)** – *Master of Visual Sorcery* +**Role**: Graphics Enchanter and Client Architect +From the darkest depths of the rendering engine, Alban weaves pixels into mesmerizing worlds. +With his arcane knowledge of graphics, he conjures stunning visuals and ensures that every frame is a painting. +On the client side, he stands as the gatekeeper, ensuring all interactions flow as smoothly as a well-timed dodge roll. + + +### **[Mathieu ROBERT](https://github.com/mathieurobert1)** – *Architect of Reality (or What's Left of It)* +**Role**: ECS Overlord and Keeper of Code Structure +Mathieu commands the entity-component-system (ECS) architecture, where chaos and order collide. +He builds the very foundation upon which the universe of our games stands. +Like a dungeon master crafting intricate maps, he designs systems that bend but never break, ensuring that every piece of logic has its place in the abyss of complexity. + + +### **[Thomas BOUÉ](https://github.com/Thomaltarix)** – *Warden of Game Structure and Balance* +**Role**: Game Mechanic Architect +Thomas is the keeper of the sacred scrolls of game design. +He oversees the structure of the worlds we create, balancing gameplay mechanics like a seasoned warrior balances a sword. +Whether it's combat flow, level progression, or difficulty curves that induce just the right amount of suffering, Thomas ensures that the experience is both brutal and rewarding. + + +### **[Axel FRADET](https://github.com/AxelF44)** – *The Phantom Weaver of Connections* +**Role**: Network Architect, Server/Client Whisperer +Axel works in the shadows, unseen, yet his work ties everything together. +He breathes life into the network, ensuring that players can invade, assist, or duel from distant realms. His intricate knowledge of server and client interactions ensures that the multiplayer experience is seamless until the lag strikes, and chaos reigns (by design, of course). + + +### **[Théophile Jérôme-Rocher](https://github.com/theophile-jr)** – *The Unseen Arbiter of Continuous Chaos* +**Role**: Master of Continuous Integration (CI) +Théophile, the unseen force that ensures all runs smoothly behind the scenes, governs the automated realms of CI. Like a benevolent deity, he ensures that every piece of code we push undergoes relentless testing, only allowing the worthy to see the light of production. His role is thankless yet critical he is the watcher of all builds, the breaker of errors. + + +**You have already heard of our team by some of our games, such as:** +- Eldritch Souls: Descent into the Nonsense Realm (2019) +- Sakura: Shadow die instantly (2021) +- BleedMore: Blood Never Enough (2023) +- Elder Sing: Karaoke of the Elden Lords (2024) + +## **Together, We Are From Noware** + +In the twilight between code and chaos, we form the pillars of From Noware, a studio driven by the desire to forge unforgettable, sometimes unforgiving, digital worlds. +Our skills combine to create experiences that challenge, confuse, and occasionally amuse. +We don't just build games we shape universes where the absurd and the epic coexist. + +At From Noware, we embrace the challenge, thrive in the madness, and invite players to face the darkness with us. + +Prepare yourself. + +*** + +# R-Type Game Presentation + +## Overview + +R-Type is a 2D action game that pays homage to classic side-scrolling shooters while introducing innovative gameplay mechanics and visually stunning graphics. +Developed using C++ and Raylib, the game showcases the team's commitment to delivering a thrilling gaming experience filled with intense action and captivating visuals. + +## Game Features + +### Engaging Gameplay +- **Classic Side-Scrolling Action**: Players navigate through beautifully designed levels, battling enemies and overcoming obstacles in a fast-paced environment. +- **Challenging Boss Fights**: Each level culminates in an epic boss battle that tests players' skills and strategies, providing a sense of accomplishment upon victory. + +### Unique Mechanics +- **Power-Up System**: Collect various power-ups to enhance weapons and abilities, allowing players to customize their playstyle and adapt to different challenges. +- **Health and Lives**: Players have a limited number of lives, encouraging strategic play and careful navigation through enemy-infested levels. + +### Stunning Visuals +- **2D Graphics**: The game features vibrant 2D graphics created with Raylib, utilizing a combination of hand-drawn sprites and animations to create an immersive experience. +- **Dynamic Environments**: Each level is uniquely themed, offering diverse settings and atmospheric backgrounds that enhance gameplay. + +### Sound and Music +- **Original Soundtrack**: An engaging soundtrack complements the action, enhancing immersion and keeping players engaged. +- **Sound Effects**: Crisp sound effects provide audio feedback for player actions, adding to the overall experience. + +And much more! R-Type is a labor of love that combines classic gameplay elements with modern design sensibilities, resulting in a game that is both nostalgic and fresh. + +## Technical Details + +### Development Tools +- **Raylib**: R-Type is built using Raylib, a simple and easy-to-use C library for learning game programming. +Raylib provides robust graphics rendering capabilities that allow for the creation of visually appealing 2D games. +- **C++**: The game is developed in C++, leveraging the language's performance and flexibility to create a responsive and efficient gameplay experience. +- **Entity-Component-System (ECS) Architecture**: The game employs an ECS architecture, facilitating the separation of game logic and entities for easier management and scalability. + +*** + +# Building Our Project: Development Mode and Plugin Setup + +Welcome to the development guide for our game! +To get started with building our project in development mode or as a plugin, follow these steps: + +## Prerequisites + +Before diving in, ensure you have the following tools installed on your system: + +- **Git**: For cloning the project repository. +- **CMake**: For building the project. +- **A suitable IDE** (e.g., Visual Studio, VSCode, etc.) for editing the code. + +## Steps to Build the Project + +### 1. Clone the Project Repository + +Begin by cloning our project's repository from GitHub. +Open your terminal or command prompt and run the following command: + +```bash +git clone git@github.com:FppEpitech/R-Type.git +``` +This command will create a local copy of the project on your machine. + +### 2. Install Dependencies + +To install the project dependencies, navigate to the project's root directory and run the following commands: + +```bash +cd R-Type +``` +Run the following command to install the dependencies: + +- For linux: +```bash +chmod +x install.sh # Make the script executable +./install.sh # Run the installation script +``` + +- For Windows: +```powershell +.\install.bat # Run the installation script +``` + +This script will handle all the necessary installations and prepare your environment for building the project. + +### 3. Build the Project + +Once the installation is complete, you can build the project. Execute the build script using one of the following commands: + +- For linux: +```bash +chmod +x build.sh # Make the script executable +./build.sh # Run the build script +``` + +- For Windows: +```powershell +.\build.bat # Run the build script +``` + +The build process will compile the project and generate the necessary files for both development mode and plugin usage. + +### 4. Start Development + +With the build complete, you are now ready to dive into the code! +You can modify the source files, add features, and create your own plugins as needed. +For more information on how add mod and pluggin, please refer to the [SlimWiki](https://slimwiki.com/6fvu0f5pu/getting-started-nqdxve9qg-/welcome). + +--- + +## How to PLAY ? +First, download the repository from GitHub, then compile it with: ``` git clone git@github.com:FppEpitech/R-Type.git -cmake -B build -cmake --build build/ +chmod +x ./tools/build.sh +./tools/build.sh ``` Then to run the server: ``` @@ -20,8 +220,7 @@ And the client: First, download the repository from Github, then compile it with: ``` git clone git@github.com:FppEpitech/R-Type.git -cmake -B build -cmake --build build/ +./tools/build.sh ``` Then, go to the **build/tests/** folder and run: ``` diff --git a/build.sh b/build.sh deleted file mode 100755 index b7a74a52..00000000 --- a/build.sh +++ /dev/null @@ -1 +0,0 @@ -export VCPKG_ROOT=${PWD}/vcpkg-master && rm -rf build/ && cmake . -DCMAKE_TOOLCHAIN_FILE=$VCPKG_ROOT/scripts/buildsystems/vcpkg.cmake -B build \ No newline at end of file diff --git a/tools/build-linux.sh b/tools/build-linux.sh new file mode 100755 index 00000000..89a585a0 --- /dev/null +++ b/tools/build-linux.sh @@ -0,0 +1,17 @@ +#!/bin/bash + +## +## EPITECH PROJECT, 2024 +## R-TYPE +## File description: +## Builds linux r-type project. +## + +VCPKG_ROOT="${PWD}/vcpkg" + +rm -f *.exe +rm -rf build/ + +mkdir build + +cmake . -DCMAKE_TOOLCHAIN_FILE="$VCPKG_ROOT/scripts/buildsystems/vcpkg.cmake" -B build diff --git a/tools/build-windows.bat b/tools/build-windows.bat new file mode 100644 index 00000000..122c657e --- /dev/null +++ b/tools/build-windows.bat @@ -0,0 +1,15 @@ +@REM ## +@REM ## EPITECH PROJECT, 2024 +@REM ## R-TYPE +@REM ## File description: +@REM ## Builds windows r-type project. +@REM ## + +@REM MUST BE EXECUTED IN WINDOWS CMD. + +del /q *.exe +rmdir /s /q build + +mkdir build + +cmake . -DCMAKE_TOOLCHAIN_FILE="%CD%\vcpkg\scripts\buildsystems\vcpkg.cmake" -B build diff --git a/tools/install-linux.sh b/tools/install-linux.sh new file mode 100755 index 00000000..c77cdfb1 --- /dev/null +++ b/tools/install-linux.sh @@ -0,0 +1,34 @@ +#!/bin/bash + +## +## EPITECH PROJECT, 2024 +## R-TYPE +## File description: +## Installs compilers, cmake, and set up the env vars. +## + +. /etc/os-release + +case $ID in + ubuntu) + sudo apt install gcc g++ + sudo apt install cmake + sudo apt install make + ;; + + *) + sudo dnf install gcc gcc-c++ + sudo dnf install cmake + sudo dnf install make + ;; +esac + +git clone https://github.com/microsoft/vcpkg.git + +cd vcpkg + +./bootstrap-vcpkg.sh + +cd .. + +./vcpkg/vcpkg install diff --git a/tools/install-windows.bat b/tools/install-windows.bat new file mode 100755 index 00000000..ee884648 --- /dev/null +++ b/tools/install-windows.bat @@ -0,0 +1,37 @@ +@REM ## +@REM ## EPITECH PROJECT, 2024 +@REM ## R-TYPE +@REM ## File description: +@REM ## Installs compilers, cmake, and set up the env vars. +@REM ## + +@REM MUST BE EXECUTED IN WINDOWS CMD. + +winget install cmake + +winget source update + +curl -O -L https://aka.ms/vs/16/release/vs_buildtools.exe +SET "CURRENT_DIR=%CD%" + + +@REM winget install -e --id Microsoft.VisualStudio.2022.BuildTools --override "--passive --wait --add Microsoft.VisualStudio.Workload.VCTools;includeRecommended" +.\vs_buildtools.exe --quiet --wait --norestart --includeRecommended --add Microsoft.VisualStudio.Workload.VCTools +@REM cd "C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.29.30133\bin\Hostx64\x64" +@REM # setx /M PATH "%PATH%;$(pwd)" +@REM # set PATH="%PATH%;${pwd}" +cd "C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Auxiliary\Build" +call vcvars32.bat + +echo "après pwd" +cd "%CURRENT_DIR%" + + +git clone https://github.com/microsoft/vcpkg.git + +cd vcpkg + +call bootstrap-vcpkg.bat + +cd .. +.\vcpkg\vcpkg install