From 1e834316079da78dd72d111a3fe1c8dfaf12afe9 Mon Sep 17 00:00:00 2001 From: PerAlban Date: Tue, 17 Sep 2024 19:10:50 +0200 Subject: [PATCH 01/30] docs(readme): Put the team logo in the readme It's the first step of the readme issue. --- README.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/README.md b/README.md index c7eef39b..0e850cf7 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,5 @@ # R-Type + +![R-Type Game](https://i.imgur.com/DnVU1l5.png) + 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. From 337568ff9257afaf8bc2f1e4619ba317d565ca66 Mon Sep 17 00:00:00 2001 From: PerAlban Date: Mon, 23 Sep 2024 15:54:25 +0200 Subject: [PATCH 02/30] refactor(cmake): Split cmake.yml into 2 file With that we will be able to have a readme check --- .github/workflows/{cmake.yml => cmake-linux.yml} | 11 ++--------- .github/workflows/cmake-windows.yml | 10 ++++++++++ 2 files changed, 12 insertions(+), 9 deletions(-) rename .github/workflows/{cmake.yml => cmake-linux.yml} (56%) create mode 100644 .github/workflows/cmake-windows.yml diff --git a/.github/workflows/cmake.yml b/.github/workflows/cmake-linux.yml similarity index 56% rename from .github/workflows/cmake.yml rename to .github/workflows/cmake-linux.yml index c3e6ca70..6a2b9d10 100644 --- a/.github/workflows/cmake.yml +++ b/.github/workflows/cmake-linux.yml @@ -1,17 +1,10 @@ -name: cmake +name: cmake-linux on: [check_run, pull_request] jobs: cmake-build: - runs-on: ${{ matrix.os }} - - strategy: - fail-fast: false - matrix: - os: [ubuntu-latest, windows-latest, macos-latest] - + runs-on: ubuntu-latest steps: - name: checkout project uses: actions/checkout@v4 - - name: build project uses: threeal/cmake-action@v2.0.0 diff --git a/.github/workflows/cmake-windows.yml b/.github/workflows/cmake-windows.yml new file mode 100644 index 00000000..609d0ceb --- /dev/null +++ b/.github/workflows/cmake-windows.yml @@ -0,0 +1,10 @@ +name: cmake-linux +on: [check_run, pull_request] +jobs: + cmake-build: + runs-on: windows-latest + steps: + - name: checkout project + uses: actions/checkout@v4 + - name: build project + uses: threeal/cmake-action@v2.0.0 From cefc1a6e15f4de5e6cc846fb7432b6bd479a9833 Mon Sep 17 00:00:00 2001 From: PerAlban Date: Mon, 23 Sep 2024 15:57:41 +0200 Subject: [PATCH 03/30] feat(readme): Add a badge to check compilation on windows and linux For that i split the old cmake.yml --- README.md | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index bbb8cb2e..cf54dfaa 100644 --- a/README.md +++ b/README.md @@ -2,10 +2,14 @@ ![R-Type Game](https://i.imgur.com/DnVU1l5.png) -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/cmake-linux.yml/badge.svg) +![Windows](https://github.com/FppEpitech/R-Type/actions/workflows/cmake-windows.yml/badge.svg) + + +Multithreaded server and a graphical client for a well-known legacy video game called R-Type, using a game engine of our own design. ## How to build ? (Linux) -First, download the repository from Github, then compile it with: +First, download the repository from GitHub, then compile it with: ``` git clone git@github.com:FppEpitech/R-Type.git cmake -B build From cb173267fd4a9970b58fcb18a2991b4368927c2e Mon Sep 17 00:00:00 2001 From: PerAlban Date: Mon, 23 Sep 2024 16:15:03 +0200 Subject: [PATCH 04/30] refactor(cmake_*): Change the name of my actions The two action has the same name, little error. --- .github/workflows/cmake-linux.yml | 2 +- .github/workflows/cmake-windows.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/cmake-linux.yml b/.github/workflows/cmake-linux.yml index 6a2b9d10..aa234618 100644 --- a/.github/workflows/cmake-linux.yml +++ b/.github/workflows/cmake-linux.yml @@ -1,4 +1,4 @@ -name: cmake-linux +name: linux on: [check_run, pull_request] jobs: cmake-build: diff --git a/.github/workflows/cmake-windows.yml b/.github/workflows/cmake-windows.yml index 609d0ceb..d05a338c 100644 --- a/.github/workflows/cmake-windows.yml +++ b/.github/workflows/cmake-windows.yml @@ -1,4 +1,4 @@ -name: cmake-linux +name: windows on: [check_run, pull_request] jobs: cmake-build: From b54dd85b25ac0697a6c6cac999e291300feb24a9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Th=C3=A9ophile=20JR?= Date: Fri, 27 Sep 2024 17:53:22 +0200 Subject: [PATCH 05/30] refactor(Scripts): put all scripts in tools/ folder --- build.sh => tools/build.sh | 0 install.bat => tools/install.bat | 0 install.sh => tools/install.sh | 0 3 files changed, 0 insertions(+), 0 deletions(-) rename build.sh => tools/build.sh (100%) rename install.bat => tools/install.bat (100%) rename install.sh => tools/install.sh (100%) diff --git a/build.sh b/tools/build.sh similarity index 100% rename from build.sh rename to tools/build.sh diff --git a/install.bat b/tools/install.bat similarity index 100% rename from install.bat rename to tools/install.bat diff --git a/install.sh b/tools/install.sh similarity index 100% rename from install.sh rename to tools/install.sh From 245d82e07e527f19410fcdc7f449f950b2493772 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Th=C3=A9ophile=20JR?= Date: Fri, 27 Sep 2024 18:48:44 +0200 Subject: [PATCH 06/30] feat: install-linux.sh handles fedora + ubuntu --- README.md | 7 +++---- tools/build.sh | 24 +++++++++++++++++++++++- tools/install-linux.sh | 34 ++++++++++++++++++++++++++++++++++ tools/install-windows.bat | 25 +++++++++++++++++++++++++ tools/install.bat | 30 ------------------------------ tools/install.sh | 29 ----------------------------- 6 files changed, 85 insertions(+), 64 deletions(-) create mode 100755 tools/install-linux.sh create mode 100755 tools/install-windows.bat delete mode 100755 tools/install.bat delete mode 100755 tools/install.sh diff --git a/README.md b/README.md index 6d6c2603..c95ed79b 100644 --- a/README.md +++ b/README.md @@ -5,8 +5,8 @@ Multi-threaded server and a graphical client for a well-known legacy video game 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 +20,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/tools/build.sh b/tools/build.sh index b7a74a52..f896fe21 100755 --- a/tools/build.sh +++ b/tools/build.sh @@ -1 +1,23 @@ -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 +#!/bin/bash + +## +## EPITECH PROJECT, 2024 +## R-TYPE +## File description: +## Builds linux & windows r-type project. +## + +VCPKG_ROOT="${PWD}/vcpkg" + +if [ -d "build" ]; then + rm -rf build/ +fi +if [[ "$OSTYPE" == "msys" || "$OSTYPE" == "mingw"* ]]; then + del /q *.exe +else + rm -f *.exe +fi + +mkdir build + +cmake . -DCMAKE_TOOLCHAIN_FILE="$VCPKG_ROOT/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..23dcb266 --- /dev/null +++ b/tools/install-windows.bat @@ -0,0 +1,25 @@ +@REM ## +@REM ## EPITECH PROJECT, 2024 +@REM ## R-TYPE +@REM ## File description: +@REM ## Installs compilers, cmake, and set up the env vars. +@REM ## + + +winget install cmake + +curl https://aka.ms/vs/16/release/vs_buildtools.exe -o .\vs_buildtools.exe && .\vs_buildtools.exe --quiet --wait --norestart --includeRecommended --add Microsoft.VisualStudio.Workload.VCTools +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" +.\vcvars32.bat amd64 + +git clone https://github.com/microsoft/vcpkg.git + +cd vcpkg + +./bootstrap-vcpkg.bat + +cd .. +.\vcpkg\vcpkg.exe install diff --git a/tools/install.bat b/tools/install.bat deleted file mode 100755 index 914b1d47..00000000 --- a/tools/install.bat +++ /dev/null @@ -1,30 +0,0 @@ -@REM ## -@REM ## EPITECH PROJECT, 2024 -@REM ## R-TYPE -@REM ## File description: -@REM ## Install compilers, cmake, and set up the env vars. -@REM ## - - -@REM winget install cmake - -@REM curl https://aka.ms/vs/16/release/vs_buildtools.exe -o .\vs_buildtools.exe && .\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}" -@REM cd "C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Auxiliary\Build" -@REM .\vcvars32.bat amd64 - -curl https://github.com/microsoft/vcpkg/archive/refs/heads/master.zip -o vcpkg.zip - -tar -xf vcpkg.zip - -cd vcpkg-master - -./bootstrap-vcpkg.bat - -@REM setx /M PATH "%PATH%;$(pwd)" -@REM set PATH="%PATH%;${pwd}" - -cd .. -.\vcpkg\vcpkg.exe install diff --git a/tools/install.sh b/tools/install.sh deleted file mode 100755 index 939b12bf..00000000 --- a/tools/install.sh +++ /dev/null @@ -1,29 +0,0 @@ -## -## EPITECH PROJECT, 2024 -## R-TYPE -## File description: -## Install compilers, cmake, and set up the env vars. -## - -sudo dnf update - -sudo dnf install gcc gcc-c++ -sudo dnf install cmake -sudo dnf install make - -curl -L https://github.com/microsoft/vcpkg/archive/refs/heads/master.zip -o vcpkg.zip -unzip vcpkg.zip -rm vcpkg.zip -cd vcpkg-master - -./bootstrap-vcpkg.sh - -# if ! grep -q 'export PATH=.*vcpkg' ~/.bashrc; then -# echo 'export PATH="$PATH:'$(pwd)'"' >> ~/.bashrc -# fi - -# source ~/.bashrc - -cd .. - -./vcpkg-master/vcpkg install From d8c7b36a78452a9418effd9c7186f1cd79b473f9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Th=C3=A9ophile=20JR?= Date: Fri, 27 Sep 2024 19:02:21 +0200 Subject: [PATCH 07/30] refactor(install.bat): turn it into a .sh file Trying to make it work on windows, with all the files --- tools/build.sh | 6 +++--- ...install-windows.bat => install-windows.sh} | 20 ++++++++++--------- 2 files changed, 14 insertions(+), 12 deletions(-) rename tools/{install-windows.bat => install-windows.sh} (68%) diff --git a/tools/build.sh b/tools/build.sh index f896fe21..52ecc825 100755 --- a/tools/build.sh +++ b/tools/build.sh @@ -9,13 +9,13 @@ VCPKG_ROOT="${PWD}/vcpkg" -if [ -d "build" ]; then - rm -rf build/ -fi + if [[ "$OSTYPE" == "msys" || "$OSTYPE" == "mingw"* ]]; then del /q *.exe + rmdir /s /q build else rm -f *.exe + rm -rf build/ fi mkdir build diff --git a/tools/install-windows.bat b/tools/install-windows.sh similarity index 68% rename from tools/install-windows.bat rename to tools/install-windows.sh index 23dcb266..43d72b58 100755 --- a/tools/install-windows.bat +++ b/tools/install-windows.sh @@ -1,17 +1,19 @@ -@REM ## -@REM ## EPITECH PROJECT, 2024 -@REM ## R-TYPE -@REM ## File description: -@REM ## Installs compilers, cmake, and set up the env vars. -@REM ## +#!/bin/bash +## +## EPITECH PROJECT, 2024 +## R-TYPE +## File description: +## Installs compilers, cmake, and set up the env vars. +## + winget install cmake curl https://aka.ms/vs/16/release/vs_buildtools.exe -o .\vs_buildtools.exe && .\vs_buildtools.exe --quiet --wait --norestart --includeRecommended --add Microsoft.VisualStudio.Workload.VCTools 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}" +# setx /M PATH "%PATH%;$(pwd)" +# set PATH="%PATH%;${pwd}" cd "C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Auxiliary\Build" .\vcvars32.bat amd64 @@ -22,4 +24,4 @@ cd vcpkg ./bootstrap-vcpkg.bat cd .. -.\vcpkg\vcpkg.exe install +.\vcpkg\vcpkg install From 44f241e007f8eb07f682157130fbfa5886df962a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Th=C3=A9ophile=20JR?= Date: Fri, 27 Sep 2024 20:10:38 +0200 Subject: [PATCH 08/30] refactor(Scripts): using .bat for windows After a few tests, looks like the best solution. Sh must be ran with git bash on windows, and powershell is turned off by default on windows --- tools/{build.sh => build-linux.sh} | 12 +++--------- tools/build-windows.bat | 15 +++++++++++++++ tools/install-windows.bat | 28 ++++++++++++++++++++++++++++ tools/install-windows.sh | 27 --------------------------- 4 files changed, 46 insertions(+), 36 deletions(-) rename tools/{build.sh => build-linux.sh} (52%) create mode 100644 tools/build-windows.bat create mode 100755 tools/install-windows.bat delete mode 100755 tools/install-windows.sh diff --git a/tools/build.sh b/tools/build-linux.sh similarity index 52% rename from tools/build.sh rename to tools/build-linux.sh index 52ecc825..89a585a0 100755 --- a/tools/build.sh +++ b/tools/build-linux.sh @@ -4,19 +4,13 @@ ## EPITECH PROJECT, 2024 ## R-TYPE ## File description: -## Builds linux & windows r-type project. +## Builds linux r-type project. ## VCPKG_ROOT="${PWD}/vcpkg" - -if [[ "$OSTYPE" == "msys" || "$OSTYPE" == "mingw"* ]]; then - del /q *.exe - rmdir /s /q build -else - rm -f *.exe - rm -rf build/ -fi +rm -f *.exe +rm -rf build/ mkdir build diff --git a/tools/build-windows.bat b/tools/build-windows.bat new file mode 100644 index 00000000..15b0f5fc --- /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 ## + +VCPKG_ROOT="${PWD}/vcpkg" + +del /q *.exe +rmdir /s /q build + +mkdir build + +cmake . -DCMAKE_TOOLCHAIN_FILE="$VCPKG_ROOT/scripts/buildsystems/vcpkg.cmake" -B build diff --git a/tools/install-windows.bat b/tools/install-windows.bat new file mode 100755 index 00000000..b0f9ee18 --- /dev/null +++ b/tools/install-windows.bat @@ -0,0 +1,28 @@ +@REM ## +@REM ## EPITECH PROJECT, 2024 +@REM ## R-TYPE +@REM ## File description: +@REM ## Installs compilers, cmake, and set up the env vars. +@REM ## + +winget install cmake + +wget --content-disposition --no-check-certificate https://aka.ms/vs/16/release/vs_buildtools.exe +.\vs_buildtools.exe --quiet --wait --norestart --includeRecommended --add Microsoft.VisualStudio.Workload.VCTools +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" +.\vcvars32.bat amd64 + + +cd - + +git clone https://github.com/microsoft/vcpkg.git + +cd vcpkg + +./bootstrap-vcpkg.bat + +cd .. +.\vcpkg\vcpkg install diff --git a/tools/install-windows.sh b/tools/install-windows.sh deleted file mode 100755 index 43d72b58..00000000 --- a/tools/install-windows.sh +++ /dev/null @@ -1,27 +0,0 @@ -#!/bin/bash - - -## -## EPITECH PROJECT, 2024 -## R-TYPE -## File description: -## Installs compilers, cmake, and set up the env vars. -## - -winget install cmake - -curl https://aka.ms/vs/16/release/vs_buildtools.exe -o .\vs_buildtools.exe && .\vs_buildtools.exe --quiet --wait --norestart --includeRecommended --add Microsoft.VisualStudio.Workload.VCTools -cd "C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.29.30133\bin\Hostx64\x64" -# setx /M PATH "%PATH%;$(pwd)" -# set PATH="%PATH%;${pwd}" -cd "C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Auxiliary\Build" -.\vcvars32.bat amd64 - -git clone https://github.com/microsoft/vcpkg.git - -cd vcpkg - -./bootstrap-vcpkg.bat - -cd .. -.\vcpkg\vcpkg install From adf4e91ae8d19b550e403a8ce0cfa3a0458aa725 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Th=C3=A9ophile=20JR?= Date: Fri, 27 Sep 2024 21:09:12 +0200 Subject: [PATCH 09/30] refactor(Windows scripts): the scripts are now perfectly working on windows Tested on a clear environment, must be ran on a windows CMD. --- tools/build-windows.bat | 4 ++-- tools/install-windows.bat | 16 +++++++++++----- 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/tools/build-windows.bat b/tools/build-windows.bat index 15b0f5fc..122c657e 100644 --- a/tools/build-windows.bat +++ b/tools/build-windows.bat @@ -5,11 +5,11 @@ @REM ## Builds windows r-type project. @REM ## -VCPKG_ROOT="${PWD}/vcpkg" +@REM MUST BE EXECUTED IN WINDOWS CMD. del /q *.exe rmdir /s /q build mkdir build -cmake . -DCMAKE_TOOLCHAIN_FILE="$VCPKG_ROOT/scripts/buildsystems/vcpkg.cmake" -B build +cmake . -DCMAKE_TOOLCHAIN_FILE="%CD%\vcpkg\scripts\buildsystems\vcpkg.cmake" -B build diff --git a/tools/install-windows.bat b/tools/install-windows.bat index b0f9ee18..08d03b38 100755 --- a/tools/install-windows.bat +++ b/tools/install-windows.bat @@ -5,24 +5,30 @@ @REM ## Installs compilers, cmake, and set up the env vars. @REM ## +@REM MUST BE EXECUTED IN WINDOWS CMD. + winget install cmake +winget install wget + +wget --content-disposition --no-check-certificate https://aka.ms/vs/16/release/vs_buildtools.exe -O vs_buildtools.exe +SET "CURRENT_DIR=%CD%" -wget --content-disposition --no-check-certificate https://aka.ms/vs/16/release/vs_buildtools.exe .\vs_buildtools.exe --quiet --wait --norestart --includeRecommended --add Microsoft.VisualStudio.Workload.VCTools -cd "C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.29.30133\bin\Hostx64\x64" +@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" -.\vcvars32.bat amd64 +call vcvars32.bat +echo "après pwd" +cd "%CURRENT_DIR%" -cd - git clone https://github.com/microsoft/vcpkg.git cd vcpkg -./bootstrap-vcpkg.bat +call bootstrap-vcpkg.bat cd .. .\vcpkg\vcpkg install From 1bce2166bfa52af857f13bce30bdf42aba8a9304 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Th=C3=A9ophile=20JR?= Date: Fri, 27 Sep 2024 22:42:14 +0200 Subject: [PATCH 10/30] feat: update winget source after install windows Trying to improve env refresh after winget install --- tools/install-windows.bat | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tools/install-windows.bat b/tools/install-windows.bat index 08d03b38..cde31565 100755 --- a/tools/install-windows.bat +++ b/tools/install-windows.bat @@ -10,9 +10,13 @@ winget install cmake winget install wget +winget source update + wget --content-disposition --no-check-certificate https://aka.ms/vs/16/release/vs_buildtools.exe -O 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)" From e9b5560d7a1f318c77946158f745339a3bae36ae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Th=C3=A9ophile=20JR?= Date: Sat, 28 Sep 2024 00:20:19 +0200 Subject: [PATCH 11/30] refactor(Scripts): use curl instead of wget As we use the CMD the -L is available, allowing to download from aka.ms --- tools/install-windows.bat | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/tools/install-windows.bat b/tools/install-windows.bat index cde31565..ee884648 100755 --- a/tools/install-windows.bat +++ b/tools/install-windows.bat @@ -8,11 +8,10 @@ @REM MUST BE EXECUTED IN WINDOWS CMD. winget install cmake -winget install wget winget source update -wget --content-disposition --no-check-certificate https://aka.ms/vs/16/release/vs_buildtools.exe -O vs_buildtools.exe +curl -O -L https://aka.ms/vs/16/release/vs_buildtools.exe SET "CURRENT_DIR=%CD%" From 344555c3990b75216d0716bb63f8af90cd8cdfcc Mon Sep 17 00:00:00 2001 From: PerAlban Date: Mon, 30 Sep 2024 15:39:01 +0200 Subject: [PATCH 12/30] docs(readme): Add the team presentation Description of all of members and of the studio --- README.md | 59 +++++++++++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 55 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 01c90625..0d51e9e8 100644 --- a/README.md +++ b/README.md @@ -1,9 +1,60 @@ -# R-Type - ![R-Type Game](https://i.imgur.com/DnVU1l5.png) -![Linux](https://github.com/FppEpitech/R-Type/actions/workflows/cmake-linux.yml/badge.svg) -![Windows](https://github.com/FppEpitech/R-Type/actions/workflows/cmake-windows.yml/badge.svg) +![Linux](https://github.com/FppEpitech/R-Type/actions/workflows/checks.yml/badge.svg?branch=main&event=push&label=Linux&os=ubuntu-latest) +![Windows](https://github.com/FppEpitech/R-Type/actions/workflows/checks.yml/badge.svg?branch=main&event=push&label=Windows&os=windows-latest) + +# 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: + +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) + +--- + +### **[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. + +--- + +## **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. + + +*** Multithreaded server and a graphical client for a well-known legacy video game called R-Type, using a game engine of our own design. From e203cd13b135d207cd5ff3f29eeeb1002b1cf0a3 Mon Sep 17 00:00:00 2001 From: PerAlban Date: Mon, 30 Sep 2024 15:56:33 +0200 Subject: [PATCH 13/30] docs(readme): Add Text to describe build the project Its more for the developers, for exemple to add a mod or a pluggin --- README.md | 89 +++++++++++++++++++++++++++++++++++++++++++++---------- 1 file changed, 74 insertions(+), 15 deletions(-) diff --git a/README.md b/README.md index 0d51e9e8..aaff821c 100644 --- a/README.md +++ b/README.md @@ -7,43 +7,37 @@ **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: -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) - ---- ### **[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** @@ -53,13 +47,78 @@ At From Noware, we embrace the challenge, thrive in the madness, and invite play Prepare yourself. - *** +# 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 -Multithreaded server and a graphical client for a well-known legacy video game called R-Type, using a game engine of our own design. +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 build ? (Linux) +## How to PLAY ? First, download the repository from GitHub, then compile it with: ``` git clone git@github.com:FppEpitech/R-Type.git From 7f448c1226df3b1d985b893f32ff1e539fb56a23 Mon Sep 17 00:00:00 2001 From: PerAlban Date: Mon, 30 Sep 2024 16:08:58 +0200 Subject: [PATCH 14/30] docs(readme): Add table of content, and game presentation The table of content is link to all the title, its more user friendly --- README.md | 70 +++++++++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 68 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index aaff821c..ce27813c 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,39 @@ -![R-Type Game](https://i.imgur.com/DnVU1l5.png) - ![Linux](https://github.com/FppEpitech/R-Type/actions/workflows/checks.yml/badge.svg?branch=main&event=push&label=Linux&os=ubuntu-latest) ![Windows](https://github.com/FppEpitech/R-Type/actions/workflows/checks.yml/badge.svg?branch=main&event=push&label=Windows&os=windows-latest) +# 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: @@ -49,6 +80,41 @@ 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: From 2fe65fcf89ba194e30f9467d7bee10be82bbae76 Mon Sep 17 00:00:00 2001 From: PerAlban Date: Mon, 30 Sep 2024 16:17:05 +0200 Subject: [PATCH 15/30] fix(workflows): Remove old CI Those files was old building cmake, without all the dependencies. --- .github/workflows/cmake-linux.yml | 10 ---------- .github/workflows/cmake-windows.yml | 10 ---------- 2 files changed, 20 deletions(-) delete mode 100644 .github/workflows/cmake-linux.yml delete mode 100644 .github/workflows/cmake-windows.yml diff --git a/.github/workflows/cmake-linux.yml b/.github/workflows/cmake-linux.yml deleted file mode 100644 index aa234618..00000000 --- a/.github/workflows/cmake-linux.yml +++ /dev/null @@ -1,10 +0,0 @@ -name: linux -on: [check_run, pull_request] -jobs: - cmake-build: - runs-on: ubuntu-latest - steps: - - name: checkout project - uses: actions/checkout@v4 - - name: build project - uses: threeal/cmake-action@v2.0.0 diff --git a/.github/workflows/cmake-windows.yml b/.github/workflows/cmake-windows.yml deleted file mode 100644 index d05a338c..00000000 --- a/.github/workflows/cmake-windows.yml +++ /dev/null @@ -1,10 +0,0 @@ -name: windows -on: [check_run, pull_request] -jobs: - cmake-build: - runs-on: windows-latest - steps: - - name: checkout project - uses: actions/checkout@v4 - - name: build project - uses: threeal/cmake-action@v2.0.0 From 4c696db16bc3a2e5a241b89c59a8a7ab03956d1f Mon Sep 17 00:00:00 2001 From: PerAlban Date: Mon, 30 Sep 2024 16:17:59 +0200 Subject: [PATCH 16/30] docs(readme): Make some changes, now the readme is more readable in IDE Add break line --- README.md | 39 ++++++++++++++++++++++++++++----------- 1 file changed, 28 insertions(+), 11 deletions(-) diff --git a/README.md b/README.md index ce27813c..c48f6c29 100644 --- a/README.md +++ b/README.md @@ -36,27 +36,37 @@ # 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: +**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. +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. +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. +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). +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* @@ -72,7 +82,9 @@ Théophile, the unseen force that ensures all runs smoothly behind the scenes, g ## **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. +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. @@ -84,7 +96,8 @@ Prepare yourself. ## 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. +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 @@ -109,7 +122,8 @@ And much more! R-Type is a labor of love that combines classic gameplay elements ## 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. +- **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. @@ -117,7 +131,8 @@ And much more! R-Type is a labor of love that combines classic gameplay elements # 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: +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 @@ -131,7 +146,8 @@ Before diving in, ensure you have the following tools installed on your system: ### 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: +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 @@ -179,7 +195,8 @@ The build process will compile the project and generate the necessary files for ### 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. +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). --- From 892a544ccfbd31cf307784cf8c883e698cfb5b32 Mon Sep 17 00:00:00 2001 From: PerAlban Date: Mon, 30 Sep 2024 16:48:59 +0200 Subject: [PATCH 17/30] refactor(readme): Try some action modification To know if at least one badge work --- .github/workflows/Linux.yml | 42 +++++++++++++++++++++++++++ .github/workflows/Windows.yml | 39 ++++++++++++++++++++++++++ .github/workflows/checks.yml | 53 ++++++++++++++++++++++++++--------- README.md | 6 ++-- 4 files changed, 124 insertions(+), 16 deletions(-) create mode 100644 .github/workflows/Linux.yml create mode 100644 .github/workflows/Windows.yml diff --git a/.github/workflows/Linux.yml b/.github/workflows/Linux.yml new file mode 100644 index 00000000..b2b74968 --- /dev/null +++ b/.github/workflows/Linux.yml @@ -0,0 +1,42 @@ +name: cmake +on: [check_run, pull_request] +jobs: + cmake-build-linux: + runs-on: ${{ matrix.os }} + + strategy: + fail-fast: false + matrix: + os: [ubuntu-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: Apt install for Ubuntu + run: | + sudo apt install libxinerama-dev libxcursor-dev xorg-dev libglu1-mesa-dev pkg-config + + - name: Install dependencies on Ubuntu (vcpkg) + run: | + if [ ! -d "vcpkg" ]; then + git clone https://github.com/microsoft/vcpkg.git + ./vcpkg/bootstrap-vcpkg.sh + fi + ./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/.github/workflows/Windows.yml b/.github/workflows/Windows.yml new file mode 100644 index 00000000..c2c81cc3 --- /dev/null +++ b/.github/workflows/Windows.yml @@ -0,0 +1,39 @@ +name: cmake +on: [check_run, pull_request] +jobs: + cmake-build-windows: + runs-on: ${{ matrix.os }} + + strategy: + fail-fast: false + matrix: + os: [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/.github/workflows/checks.yml b/.github/workflows/checks.yml index 3b566100..fa9b177e 100644 --- a/.github/workflows/checks.yml +++ b/.github/workflows/checks.yml @@ -1,13 +1,13 @@ name: cmake on: [check_run, pull_request] jobs: - cmake-build: + cmake-build-linux: runs-on: ${{ matrix.os }} strategy: fail-fast: false matrix: - os: [ubuntu-latest, windows-latest] + os: [ubuntu-latest] steps: - name: Checkout project @@ -20,12 +20,46 @@ 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 Ubuntu (vcpkg) + run: | + if [ ! -d "vcpkg" ]; then + git clone https://github.com/microsoft/vcpkg.git + ./vcpkg/bootstrap-vcpkg.sh + fi + ./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 + + cmake-build-windows: + runs-on: ${{ matrix.os }} + + strategy: + fail-fast: false + matrix: + os: [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) - if: matrix.os == 'windows-latest' shell: pwsh run: | if (-Not (Test-Path "vcpkg")) { @@ -34,16 +68,7 @@ jobs: } .\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 - ./vcpkg/bootstrap-vcpkg.sh - 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/README.md b/README.md index c48f6c29..a86f261d 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,7 @@ -![Linux](https://github.com/FppEpitech/R-Type/actions/workflows/checks.yml/badge.svg?branch=main&event=push&label=Linux&os=ubuntu-latest) -![Windows](https://github.com/FppEpitech/R-Type/actions/workflows/checks.yml/badge.svg?branch=main&event=push&label=Windows&os=windows-latest) +![Linux](https://github.com/FppEpitech/R-Type/actions/workflows/checks.yml/badge.svg?event=push&job=cmake-build-linux) +![Windows](https://github.com/FppEpitech/R-Type/actions/workflows/checks.yml/badge.svg?event=push&job=cmake-build-windows) +![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) # Table of Contents From 9e53fc7eebf84524b22674af987aa41deddda3a2 Mon Sep 17 00:00:00 2001 From: PerAlban Date: Mon, 30 Sep 2024 16:52:01 +0200 Subject: [PATCH 18/30] refactor(worflow): Change name of yml action file Because there have all the same name --- .github/workflows/Linux.yml | 2 +- .github/workflows/Windows.yml | 2 +- .github/workflows/checks.yml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/Linux.yml b/.github/workflows/Linux.yml index b2b74968..a6ec2d7d 100644 --- a/.github/workflows/Linux.yml +++ b/.github/workflows/Linux.yml @@ -1,4 +1,4 @@ -name: cmake +name: Linux on: [check_run, pull_request] jobs: cmake-build-linux: diff --git a/.github/workflows/Windows.yml b/.github/workflows/Windows.yml index c2c81cc3..cd6555d3 100644 --- a/.github/workflows/Windows.yml +++ b/.github/workflows/Windows.yml @@ -1,4 +1,4 @@ -name: cmake +name: Windows on: [check_run, pull_request] jobs: cmake-build-windows: diff --git a/.github/workflows/checks.yml b/.github/workflows/checks.yml index fa9b177e..19f0e91e 100644 --- a/.github/workflows/checks.yml +++ b/.github/workflows/checks.yml @@ -1,4 +1,4 @@ -name: cmake +name: check on: [check_run, pull_request] jobs: cmake-build-linux: From b13d83d86069e0bac582b7c56aafcfe499af7d69 Mon Sep 17 00:00:00 2001 From: PerAlban Date: Mon, 30 Sep 2024 16:55:22 +0200 Subject: [PATCH 19/30] fix(workflow): Split the job to have access to svg badges For each os, we have his badge on our readme --- .github/workflows/checks.yml | 79 ------------------------------------ README.md | 2 - 2 files changed, 81 deletions(-) delete mode 100644 .github/workflows/checks.yml diff --git a/.github/workflows/checks.yml b/.github/workflows/checks.yml deleted file mode 100644 index 19f0e91e..00000000 --- a/.github/workflows/checks.yml +++ /dev/null @@ -1,79 +0,0 @@ -name: check -on: [check_run, pull_request] -jobs: - cmake-build-linux: - runs-on: ${{ matrix.os }} - - strategy: - fail-fast: false - matrix: - os: [ubuntu-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: Apt install for Ubuntu - run: | - sudo apt install libxinerama-dev libxcursor-dev xorg-dev libglu1-mesa-dev pkg-config - - - name: Install dependencies on Ubuntu (vcpkg) - run: | - if [ ! -d "vcpkg" ]; then - git clone https://github.com/microsoft/vcpkg.git - ./vcpkg/bootstrap-vcpkg.sh - fi - ./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 - - cmake-build-windows: - runs-on: ${{ matrix.os }} - - strategy: - fail-fast: false - matrix: - os: [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/README.md b/README.md index a86f261d..c9e0b0bd 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,3 @@ -![Linux](https://github.com/FppEpitech/R-Type/actions/workflows/checks.yml/badge.svg?event=push&job=cmake-build-linux) -![Windows](https://github.com/FppEpitech/R-Type/actions/workflows/checks.yml/badge.svg?event=push&job=cmake-build-windows) ![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) From 9f42a2fb51d4f6f2363717cb6194752aac1b8aa6 Mon Sep 17 00:00:00 2001 From: PerAlban Date: Mon, 30 Sep 2024 17:38:26 +0200 Subject: [PATCH 20/30] refactor(workflow): Remove matrix dependencies Because I separated the to build, so one by jobs, and I used a matrix for 1 os, so its useless --- .github/workflows/Linux.yml | 7 +------ .github/workflows/Windows.yml | 7 +------ 2 files changed, 2 insertions(+), 12 deletions(-) diff --git a/.github/workflows/Linux.yml b/.github/workflows/Linux.yml index a6ec2d7d..39da3a4d 100644 --- a/.github/workflows/Linux.yml +++ b/.github/workflows/Linux.yml @@ -2,12 +2,7 @@ name: Linux on: [check_run, pull_request] jobs: cmake-build-linux: - runs-on: ${{ matrix.os }} - - strategy: - fail-fast: false - matrix: - os: [ubuntu-latest] + runs-on: ubuntu-latest steps: - name: Checkout project diff --git a/.github/workflows/Windows.yml b/.github/workflows/Windows.yml index cd6555d3..11ca51ed 100644 --- a/.github/workflows/Windows.yml +++ b/.github/workflows/Windows.yml @@ -2,12 +2,7 @@ name: Windows on: [check_run, pull_request] jobs: cmake-build-windows: - runs-on: ${{ matrix.os }} - - strategy: - fail-fast: false - matrix: - os: [windows-latest] + runs-on: windows-latest steps: - name: Checkout project From 83d1409facf03395c8eed4a07ba418c750812b78 Mon Sep 17 00:00:00 2001 From: thomaltarix Date: Tue, 1 Oct 2024 19:52:40 +0200 Subject: [PATCH 21/30] feat(ECS): Add clone method in the registry class Since I can't clone components by components (because I can't get the types of the components I need to clone), I need to clone all the arrays. --- Engine/Shared/Ecs/Src/Registry.cpp | 11 +++++++++++ Engine/Shared/Ecs/Src/Registry.hpp | 18 +++++++++++++++++- 2 files changed, 28 insertions(+), 1 deletion(-) diff --git a/Engine/Shared/Ecs/Src/Registry.cpp b/Engine/Shared/Ecs/Src/Registry.cpp index b991a878..fcee94dc 100644 --- a/Engine/Shared/Ecs/Src/Registry.cpp +++ b/Engine/Shared/Ecs/Src/Registry.cpp @@ -41,4 +41,15 @@ void Registry::run_systems(int idxPacketEntities) { system(*this, idxPacketEntities); } +void Registry::cloneComponentsArray(ECS::Registry ®istry) +{ + registry.setComponentsArrays(_components_arrays, _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..6f41bf69 100644 --- a/Engine/Shared/Ecs/Src/Registry.hpp +++ b/Engine/Shared/Ecs/Src/Registry.hpp @@ -111,7 +111,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 +121,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 +167,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 From 4fbdcf9ce1be2ba7ca98868b9c4bc59ed8ca1f1d Mon Sep 17 00:00:00 2001 From: thomaltarix Date: Tue, 1 Oct 2024 19:54:52 +0200 Subject: [PATCH 22/30] refactor(Scene Manager): Refactor the way to set default components Copying component by component was not possible so i refactored it. Now, right after each registry creation, I'm cloning the default one (with default components) in the new one --- Engine/Shared/SceneManager/ASceneManager.cpp | 24 +++++++-- Engine/Shared/SceneManager/ASceneManager.hpp | 52 +++----------------- 2 files changed, 28 insertions(+), 48 deletions(-) diff --git a/Engine/Shared/SceneManager/ASceneManager.cpp b/Engine/Shared/SceneManager/ASceneManager.cpp index 4bfbe97a..8a21b5f7 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(index).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(); }; } From 354c71a5052ba772c64c552e98df27678cea5acf Mon Sep 17 00:00:00 2001 From: Mathieu Robert Date: Tue, 1 Oct 2024 21:12:44 +0200 Subject: [PATCH 23/30] feat(ECS): add method to get entities in registry I added a method in the Registry class to get Entities --- Engine/Shared/Ecs/Src/Registry.cpp | 5 +++++ Engine/Shared/Ecs/Src/Registry.hpp | 6 ++++++ 2 files changed, 11 insertions(+) diff --git a/Engine/Shared/Ecs/Src/Registry.cpp b/Engine/Shared/Ecs/Src/Registry.cpp index b991a878..42b39350 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]; diff --git a/Engine/Shared/Ecs/Src/Registry.hpp b/Engine/Shared/Ecs/Src/Registry.hpp index c5ec405e..568aba00 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 From 23a91be6a0188aa613359b92b643e3ab7b1ee122 Mon Sep 17 00:00:00 2001 From: Mathieu Robert Date: Tue, 1 Oct 2024 21:14:28 +0200 Subject: [PATCH 24/30] feat(Graphic System): created the DrawOBJ System I created the DrawOBJ system to the client to draw OBJ models --- Engine/Client/CMakeLists.txt | 4 ++ .../Src/Systems/DrawOBJ/DrawOBJSystem.cpp | 34 ++++++++++++++ .../Src/Systems/DrawOBJ/DrawOBJSystem.hpp | 47 +++++++++++++++++++ 3 files changed, 85 insertions(+) create mode 100644 Engine/Client/Src/Systems/DrawOBJ/DrawOBJSystem.cpp create mode 100644 Engine/Client/Src/Systems/DrawOBJ/DrawOBJSystem.hpp diff --git a/Engine/Client/CMakeLists.txt b/Engine/Client/CMakeLists.txt index 8f2ccbb4..ab72ae51 100644 --- a/Engine/Client/CMakeLists.txt +++ b/Engine/Client/CMakeLists.txt @@ -12,6 +12,7 @@ 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 @@ -29,6 +30,8 @@ set(SRC_EXE ../Shared/Component/SoundPathComponent.cpp ../Shared/Component/SoundPitchComponent.cpp ../Shared/Component/SoundVolumeComponent.cpp + + Src/Systems/DrawOBJ/DrawOBJSystem.cpp ) include_directories( @@ -37,6 +40,7 @@ include_directories( Src/ClientSceneManager Src/GraphicalLibrary Src/Errors + Src/Systems ../Shared/GraphicalLoad ../Shared/Component ../Shared/Ecs/Src diff --git a/Engine/Client/Src/Systems/DrawOBJ/DrawOBJSystem.cpp b/Engine/Client/Src/Systems/DrawOBJ/DrawOBJSystem.cpp new file mode 100644 index 00000000..1c7abdb6 --- /dev/null +++ b/Engine/Client/Src/Systems/DrawOBJ/DrawOBJSystem.cpp @@ -0,0 +1,34 @@ +/* +** EPITECH PROJECT, 2024 +** DrawOBJSystem +** File description: +** DrawOBJSystem +*/ + +#include "DrawOBJSystem.hpp" +#include "ObjPathComponent.hpp" +#include "GetGraphicalLibrary.hpp" +#include "SparseArray.hpp" + +DrawOBJSystem::DrawOBJSystem() : + ASystem("DrawOBJSystem") +{ +} + +void DrawOBJSystem::_drawOBJ(ECS::Registry& reg, int idxPacketEntities) +{ + std::shared_ptr libGraphic = getGraphicalLibrary(); + + ECS::SparseArray objPathComponents = reg.get_components("ObjPathComponent"); + + for (auto entity : reg.getEntities()) { + std::shared_ptr obj = std::dynamic_pointer_cast(objPathComponents[entity]); + if (obj) + libGraphic->drawOBJ(obj->path, entity * 2, 0, 0, 1); + } +} + +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..c240190a --- /dev/null +++ b/Engine/Client/Src/Systems/DrawOBJ/DrawOBJSystem.hpp @@ -0,0 +1,47 @@ +/* +** EPITECH PROJECT, 2024 +** DrawOBJSystem +** File description: +** DrawOBJSystem +*/ + +#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. +}; From a45c576f2997983b8e837de7e67c9397fc0ec5e0 Mon Sep 17 00:00:00 2001 From: Mathieu Robert Date: Tue, 1 Oct 2024 21:16:19 +0200 Subject: [PATCH 25/30] feat(Graphic lib): added the method drawOBJ to the IGraphic class I added the method drawOBJ to the IGraphic class to draw Models --- Engine/Shared/Interface/IGraphic.hpp | 21 +++++++++++++++++++ GraphicLibrary/Src/GraphicLib.cpp | 30 ++++++++++++++++++++++++++-- GraphicLibrary/Src/GraphicLib.hpp | 29 ++++++++++++++++++++++++++- 3 files changed, 77 insertions(+), 3 deletions(-) diff --git a/Engine/Shared/Interface/IGraphic.hpp b/Engine/Shared/Interface/IGraphic.hpp index 51ef8a3f..f5f5313b 100644 --- a/Engine/Shared/Interface/IGraphic.hpp +++ b/Engine/Shared/Interface/IGraphic.hpp @@ -50,4 +50,25 @@ 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. + */ + 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/GraphicLibrary/Src/GraphicLib.cpp b/GraphicLibrary/Src/GraphicLib.cpp index 4b4c161f..a29b4e11 100644 --- a/GraphicLibrary/Src/GraphicLib.cpp +++ b/GraphicLibrary/Src/GraphicLib.cpp @@ -21,6 +21,12 @@ void GraphicLib::init(const std::string &windowName) { InitWindow(1920, 1080, windowName.c_str()); SetTargetFPS(140); + + _camera.position = (Vector3){ 0.0f, 0.0f, -10.0f }; // Camera position + _camera.target = (Vector3){ 0.0f, 0.0f, 0.0f }; // Camera looking at point + _camera.up = (Vector3){ 0.0f, 1.0f, 0.0f }; // 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 +36,7 @@ bool GraphicLib::windowIsOpen() void GraphicLib::clear() { - BeginDrawing(); ClearBackground(BLACK); - EndDrawing(); } std::size_t GraphicLib::getKeyInput() { @@ -42,3 +46,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. }; From 4d7b9901cb98690408f0e265bfc9747f0af50418 Mon Sep 17 00:00:00 2001 From: Mathieu Robert Date: Tue, 1 Oct 2024 21:23:58 +0200 Subject: [PATCH 26/30] feat(Client App): start and end draw I added the call of start and end draw methods in Client Application to draw on the screen --- Engine/Client/Src/Application/Application.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Engine/Client/Src/Application/Application.cpp b/Engine/Client/Src/Application/Application.cpp index 2a4d1295..aae71537 100644 --- a/Engine/Client/Src/Application/Application.cpp +++ b/Engine/Client/Src/Application/Application.cpp @@ -35,7 +35,9 @@ void Application::run() libGraphic->init(WINDOW_TITLE); while (libGraphic->windowIsOpen()) { + libGraphic->startDraw(); libGraphic->clear(); _registries->at(SceneManager::RegisterIndex::CURRENT).run_systems(-1); + libGraphic->endDraw(); } } From 55f887bd695f6bab4287349318b66f27a51953db Mon Sep 17 00:00:00 2001 From: Mathieu Robert Date: Tue, 1 Oct 2024 22:32:06 +0200 Subject: [PATCH 27/30] feat(Default systems): add default systems in Client Application I added the first default system in the Client application to draw OBJ Models --- Engine/Client/Src/Application/Application.cpp | 10 ++++++++++ Engine/Client/Src/Application/Application.hpp | 8 ++++++++ .../Src/ClientSceneManager/ClientSceneManager.cpp | 9 ++++++--- Engine/Client/Src/Systems/DrawOBJ/DrawOBJSystem.hpp | 2 ++ 4 files changed, 26 insertions(+), 3 deletions(-) diff --git a/Engine/Client/Src/Application/Application.cpp b/Engine/Client/Src/Application/Application.cpp index aae71537..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(); @@ -38,6 +46,8 @@ void Application::run() 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 #include "ISystem.hpp" From 051b42fc0f842a5dec9c65d5d50313a4800110cb Mon Sep 17 00:00:00 2001 From: Mathieu Robert Date: Tue, 1 Oct 2024 23:09:25 +0200 Subject: [PATCH 28/30] fix(GraphicLib): Vector3 cast fail in Windows On Windows, the cast of Vector3 didn't work, so I init values before --- GraphicLibrary/Src/GraphicLib.cpp | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/GraphicLibrary/Src/GraphicLib.cpp b/GraphicLibrary/Src/GraphicLib.cpp index a29b4e11..e85a0259 100644 --- a/GraphicLibrary/Src/GraphicLib.cpp +++ b/GraphicLibrary/Src/GraphicLib.cpp @@ -22,11 +22,15 @@ void GraphicLib::init(const std::string &windowName) InitWindow(1920, 1080, windowName.c_str()); SetTargetFPS(140); - _camera.position = (Vector3){ 0.0f, 0.0f, -10.0f }; // Camera position - _camera.target = (Vector3){ 0.0f, 0.0f, 0.0f }; // Camera looking at point - _camera.up = (Vector3){ 0.0f, 1.0f, 0.0f }; // Camera up vector (rotation towards target) - _camera.fovy = 45.0f; // Camera field-of-view Y - _camera.projection = CAMERA_PERSPECTIVE; // Camera projection type + 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() From b1f06b866ce733657e7725b63837b3bc63d0be1b Mon Sep 17 00:00:00 2001 From: Mathieu Robert Date: Wed, 2 Oct 2024 00:21:42 +0200 Subject: [PATCH 29/30] fix(SceneManager): error in clone of registries I fixed the clone of registries because their were cloning themselves --- .../Src/Systems/DrawOBJ/DrawOBJSystem.cpp | 26 +++++++++++-- Engine/Shared/Ecs/Src/Registry.cpp | 2 +- Engine/Shared/Ecs/Src/Registry.hpp | 2 +- Engine/Shared/Interface/IGraphic.hpp | 10 +++++ Engine/Shared/SceneManager/ASceneManager.cpp | 38 ++++++++++--------- 5 files changed, 56 insertions(+), 22 deletions(-) diff --git a/Engine/Client/Src/Systems/DrawOBJ/DrawOBJSystem.cpp b/Engine/Client/Src/Systems/DrawOBJ/DrawOBJSystem.cpp index 1c7abdb6..78937829 100644 --- a/Engine/Client/Src/Systems/DrawOBJ/DrawOBJSystem.cpp +++ b/Engine/Client/Src/Systems/DrawOBJ/DrawOBJSystem.cpp @@ -7,9 +7,13 @@ #include "DrawOBJSystem.hpp" #include "ObjPathComponent.hpp" +#include "Position3DComponent.hpp" +#include "ScaleComponent.hpp" #include "GetGraphicalLibrary.hpp" #include "SparseArray.hpp" +#include + DrawOBJSystem::DrawOBJSystem() : ASystem("DrawOBJSystem") { @@ -20,11 +24,27 @@ 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 (auto entity : reg.getEntities()) { + for (ECS::entity_t entity = 0; objPathComponents.size() >= entity + 1; entity++) { std::shared_ptr obj = std::dynamic_pointer_cast(objPathComponents[entity]); - if (obj) - libGraphic->drawOBJ(obj->path, entity * 2, 0, 0, 1); + + 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); } } diff --git a/Engine/Shared/Ecs/Src/Registry.cpp b/Engine/Shared/Ecs/Src/Registry.cpp index c19fac85..609b08eb 100644 --- a/Engine/Shared/Ecs/Src/Registry.cpp +++ b/Engine/Shared/Ecs/Src/Registry.cpp @@ -48,7 +48,7 @@ void Registry::run_systems(int idxPacketEntities) { void Registry::cloneComponentsArray(ECS::Registry ®istry) { - registry.setComponentsArrays(_components_arrays, _remove_functions); + setComponentsArrays(registry._components_arrays, registry._remove_functions); } void Registry::setComponentsArrays(std::unordered_map componentsArrays, std::unordered_map removeFunctions) diff --git a/Engine/Shared/Ecs/Src/Registry.hpp b/Engine/Shared/Ecs/Src/Registry.hpp index ad9c732f..b5619545 100644 --- a/Engine/Shared/Ecs/Src/Registry.hpp +++ b/Engine/Shared/Ecs/Src/Registry.hpp @@ -188,10 +188,10 @@ class Registry { */ void setComponentsArrays(std::unordered_map componentsArrays, std::unordered_map removeFunctions); + std::unordered_map _components_arrays; // Array of components. private: //Arrays - std::unordered_map _components_arrays; // Array of components. std::unordered_map _remove_functions; // Array of functions to remove components. // Entities diff --git a/Engine/Shared/Interface/IGraphic.hpp b/Engine/Shared/Interface/IGraphic.hpp index f5f5313b..979cc13a 100644 --- a/Engine/Shared/Interface/IGraphic.hpp +++ b/Engine/Shared/Interface/IGraphic.hpp @@ -56,6 +56,16 @@ class IGraphic { * * @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; /** diff --git a/Engine/Shared/SceneManager/ASceneManager.cpp b/Engine/Shared/SceneManager/ASceneManager.cpp index 8a21b5f7..ae249fb0 100644 --- a/Engine/Shared/SceneManager/ASceneManager.cpp +++ b/Engine/Shared/SceneManager/ASceneManager.cpp @@ -17,6 +17,7 @@ SceneManager::ASceneManager::ASceneManager(std::shared_ptrpush_back(ECS::Registry()); _registries->at(i).cloneComponentsArray(_defaultRegistry); @@ -47,8 +48,11 @@ 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); _loadSceneEntities(root, index); + std::cout << _registries->at(SceneManager::RegisterIndex::CURRENT)._components_arrays.size() << std::endl; _loadSceneSystems(root, index); + std::cout << _registries->at(SceneManager::RegisterIndex::CURRENT)._components_arrays.size() << std::endl; _loadSceneKeys(root, index); + std::cout << _registries->at(SceneManager::RegisterIndex::CURRENT)._components_arrays.size() << std::endl; } void SceneManager::ASceneManager::_loadNextScenes(const std::string &path, std::size_t index) @@ -110,7 +114,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(index).cloneComponentsArray(_defaultRegistry); + _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); @@ -152,20 +156,20 @@ void SceneManager::ASceneManager::_changeScene(std::pair(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()); + _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()); } From 3a664388d976440266404ee2bcc088e7b35a7217 Mon Sep 17 00:00:00 2001 From: Mathieu Robert Date: Wed, 2 Oct 2024 08:56:12 +0200 Subject: [PATCH 30/30] refactor(debug): remove useless debug I removed useless debug in Registry.hpp and ASceneManager --- Engine/Shared/Ecs/Src/Registry.hpp | 2 +- Engine/Shared/SceneManager/ASceneManager.cpp | 4 ---- 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/Engine/Shared/Ecs/Src/Registry.hpp b/Engine/Shared/Ecs/Src/Registry.hpp index b5619545..ad9c732f 100644 --- a/Engine/Shared/Ecs/Src/Registry.hpp +++ b/Engine/Shared/Ecs/Src/Registry.hpp @@ -188,10 +188,10 @@ class Registry { */ void setComponentsArrays(std::unordered_map componentsArrays, std::unordered_map removeFunctions); - std::unordered_map _components_arrays; // Array of components. private: //Arrays + std::unordered_map _components_arrays; // Array of components. std::unordered_map _remove_functions; // Array of functions to remove components. // Entities diff --git a/Engine/Shared/SceneManager/ASceneManager.cpp b/Engine/Shared/SceneManager/ASceneManager.cpp index ae249fb0..d6347e6a 100644 --- a/Engine/Shared/SceneManager/ASceneManager.cpp +++ b/Engine/Shared/SceneManager/ASceneManager.cpp @@ -17,7 +17,6 @@ SceneManager::ASceneManager::ASceneManager(std::shared_ptrpush_back(ECS::Registry()); _registries->at(i).cloneComponentsArray(_defaultRegistry); @@ -48,11 +47,8 @@ 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); _loadSceneEntities(root, index); - std::cout << _registries->at(SceneManager::RegisterIndex::CURRENT)._components_arrays.size() << std::endl; _loadSceneSystems(root, index); - std::cout << _registries->at(SceneManager::RegisterIndex::CURRENT)._components_arrays.size() << std::endl; _loadSceneKeys(root, index); - std::cout << _registries->at(SceneManager::RegisterIndex::CURRENT)._components_arrays.size() << std::endl; } void SceneManager::ASceneManager::_loadNextScenes(const std::string &path, std::size_t index)