Skip to content

Commit

Permalink
Merge pull request #23 from MasterLaplace/dev
Browse files Browse the repository at this point in the history
Dev 0.2.0
  • Loading branch information
MasterLaplace authored Jan 9, 2024
2 parents 0c55282 + 2a3dbc5 commit 50b6159
Show file tree
Hide file tree
Showing 55 changed files with 3,273 additions and 254 deletions.
4 changes: 2 additions & 2 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@

## Additional information

**Area Dino Client requesting: (if applicable)**
**Flakkari Client requesting: (if applicable)**

- [ ] Contributor has read Area Dino's [GitHub code of conduct](https://MasterLaplace/Flakkari/blob/main/.github/CODE_OF_CONDUCT.md)
- [ ] Contributor has read Flakkari's [GitHub code of conduct](https://MasterLaplace/Flakkari/blob/main/.github/CODE_OF_CONDUCT.md)
- [ ] Contributor would like to be mentioned in the release notes as: (fill in this blank)
- [ ] Contributor agrees to the license terms of this repository.
2 changes: 1 addition & 1 deletion .github/workflows/commit_norm_check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
- name: Commit Norm Checker
run: |
commit_msg=$(git log --format=%B -n 1 ${{ github.sha }})
keyword_regex="^([a-z]+\([A-Za-z_.-]+\)|^[a-z]+): "
keyword_regex="^([a-z]+\([0-9A-Za-z_.-]+\)|^[a-z]+): "
if [[ ! $commit_msg =~ $keyword_regex ]]; then
if [[ $commit_msg =~ ^Merge\ .* ]]; then
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/cpp_norm_checker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,4 @@ jobs:

- name: Check C++ norm by Laplace Linter
run: |
python3 Scripts/cpp_norm_checker.py
python3 Scripts/cpp_norm_checker.py
4 changes: 2 additions & 2 deletions .github/workflows/deploy_doxygen_page.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ jobs:

- name: Set up Git
run: |
git config --global user.email "[email protected]"
git config --global user.name "Your Name"
git config --global user.email "[email protected]"
git config --global user.name "MasterLaplace"
- name: Install Doxygen
run: |
Expand Down
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -574,4 +574,3 @@ docs/Flakkari/
build/
.Test/
poc/
Game/
95 changes: 91 additions & 4 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,15 @@ set(SOURCES
Flakkari/Network/IOMultiplexer.cpp
Flakkari/Protocol/Header.cpp
Flakkari/Protocol/Packet.cpp
Flakkari/Engine/Math/Vector.cpp
Flakkari/Engine/EntityComponentSystem/Systems/Systems.cpp
Flakkari/Engine/EntityComponentSystem/Registry.cpp
Flakkari/Server/UDPServer.cpp
Flakkari/Server/Client/Client.cpp
Flakkari/Server/Client/ClientManager.cpp
Flakkari/Server/Game/Game.cpp
Flakkari/Server/Game/GameManager.cpp
Flakkari/Server/Internals/CommandManager.cpp
)

set(HEADERS
Expand All @@ -26,11 +32,48 @@ set(HEADERS
Flakkari/Network/IOMultiplexer.hpp
Flakkari/Protocol/Header.hpp
Flakkari/Protocol/Packet.hpp
Flakkari/Engine/Math/Vector.hpp
Flakkari/Engine/EntityComponentSystem/Components/Components2D.hpp
Flakkari/Engine/EntityComponentSystem/Components/ComponentsCommon.hpp
Flakkari/Engine/EntityComponentSystem/Systems/Systems.hpp
Flakkari/Engine/EntityComponentSystem/Entity.hpp
Flakkari/Engine/EntityComponentSystem/SparseArrays.hpp
Flakkari/Engine/EntityComponentSystem/Registry.hpp
Flakkari/Server/UDPServer.hpp
Flakkari/Server/Client/Client.hpp
Flakkari/Server/Client/ClientManager.hpp
Flakkari/Server/Game/Game.hpp
Flakkari/Server/Game/GameManager.hpp
Flakkari/Server/Internals/CommandManager.hpp
)

set(HEADER_LIB_LOGGER
Flakkari/Logger/Logger.hpp
)

set(HEADER_LIB_NETWORK
Flakkari/Network/Address.hpp
Flakkari/Network/Buffer.hpp
Flakkari/Network/Socket.hpp
Flakkari/Network/IOMultiplexer.hpp
)

set(HEADER_LIB_PROTOCOL
Flakkari/Protocol/Header.hpp
Flakkari/Protocol/Packet.hpp
)

# CMake Modules:
INCLUDE(FetchContent)

FetchContent_Declare(
nlohmann_json
GIT_REPOSITORY https://github.com/nlohmann/json.git
GIT_TAG v3.11.3
)

FetchContent_MakeAvailable(nlohmann_json)

# Separate Build Artifacts:
set(CMAKE_BINARY_DIR ${CMAKE_SOURCE_DIR}/build)
set(EXECUTABLE_OUTPUT_PATH ${CMAKE_BINARY_DIR})
Expand All @@ -55,23 +98,67 @@ add_executable(r-type_server ${SOURCES} ${HEADERS})
# Include Directories:
target_include_directories(r-type_server PRIVATE ${CMAKE_SOURCE_DIR}/Flakkari)

# Link Libraries:
target_link_libraries(r-type_server PRIVATE nlohmann_json::nlohmann_json)

# Documentation: sudo apt-get install graphviz
find_package(Doxygen)
if(DOXYGEN_FOUND)
add_custom_target(doc
COMMAND ${DOXYGEN_EXECUTABLE} ${CMAKE_SOURCE_DIR}/Doxyfile.cfg
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
COMMENT "Generating API documentation with Doxygen"
VERBATIM)
VERBATIM
)
endif()

# Versioning:
set(PROJECT_VERSION_MAJOR 0)
set(PROJECT_VERSION_MINOR 1)
set(PROJECT_VERSION_MINOR 2)
set(PROJECT_VERSION_PATCH 0)

configure_file(${CMAKE_SOURCE_DIR}/config.h.in ${CMAKE_BINARY_DIR}/Flakkari/config.h)
configure_file(${CMAKE_SOURCE_DIR}/Flakkari/config.h.in ${CMAKE_BINARY_DIR}/config.h)

# Install Targets:
install(TARGETS r-type_server DESTINATION bin)
install(FILES ${CMAKE_BINARY_DIR}/Flakkari/config.h DESTINATION include)
install(FILES ${CMAKE_BINARY_DIR}/config.h DESTINATION include/Flakkari)
install(FILES ${HEADER_LIB_LOGGER} DESTINATION include/Flakkari/Logger)
install(FILES ${HEADER_LIB_NETWORK} DESTINATION include/Flakkari/Network)
install(FILES ${HEADER_LIB_PROTOCOL} DESTINATION include/Flakkari/Protocol)

# Packaging:
set(CPACK_PACKAGE_NAME "r-type_server")
set(CPACK_PACKAGE_VENDOR "R-Type")
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "R-Type Server")
set(CPACK_PACKAGE_VERSION_MAJOR ${PROJECT_VERSION_MAJOR})
set(CPACK_PACKAGE_VERSION_MINOR ${PROJECT_VERSION_MINOR})
set(CPACK_PACKAGE_VERSION_PATCH ${PROJECT_VERSION_PATCH})
set(CPACK_RESOURCE_FILE_README "${CMAKE_SOURCE_DIR}/README.md")
set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_SOURCE_DIR}/LICENSE")

set(CPACK_GENERATOR "DEB")
set(CPACK_DEBIAN_PACKAGE_MAINTAINER "R-Type Team")
set(CPACK_DEBIAN_PACKAGE_DEPENDS "nlohmann-json3-dev (>= 3.9.1)" "doxygen (>= 1.8.17)" "graphviz (>= 2.40.1)")
set(CPACK_DEBIAN_PACKAGE_ARCHITECTURE "amd64")

include(CPack)

# Create a dynamic library for the Network components
set(SOURCES_LIB_NETWORK
Flakkari/Logger/Logger.cpp
Flakkari/Network/Address.cpp
Flakkari/Network/Buffer.cpp
Flakkari/Network/Socket.cpp
Flakkari/Network/IOMultiplexer.cpp
)
add_library(r-type_server_network SHARED ${SOURCES_LIB_NETWORK} ${HEADER_LIB_NETWORK} ${HEADER_LIB_LOGGER})

# Include Directories:
target_include_directories(r-type_server_network PRIVATE ${CMAKE_SOURCE_DIR}/Flakkari)

# Link Libraries:
target_link_libraries(r-type_server_network PRIVATE nlohmann_json::nlohmann_json)

# Install dynamic library:
install(TARGETS r-type_server_network DESTINATION lib)
install(FILES ${HEADER_LIB_NETWORK} DESTINATION include/Flakkari/Network)
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ See the [Table of Contents](#table-of-contents) for different ways to help and d

Here, you can provide a brief overview of what the Flakkari project is about and why contributions are important.

v0.1.6 of the project is currently under development. You can find the latest release [here](https://github.com/MasterLaplace/Flakkari/releases/latest/) and the changelog [here](CHANGELOG.md).
v0.2.0 of the project is currently under development. You can find the latest release [here](https://github.com/MasterLaplace/Flakkari/releases/latest/) and the changelog [here](CHANGELOG.md).

----

Expand Down
30 changes: 30 additions & 0 deletions Flakkari/Engine/EntityComponentSystem/Components/2D/Movable.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
/*
** EPITECH PROJECT, 2024
** Title: Flakkari
** Author: MasterLaplace
** Created: 2023-01-06
** File description:
** Movable
*/

#ifndef MOVABLE_HPP_
#define MOVABLE_HPP_

#include "../../../Math/Vector.hpp"

namespace Flakkari::Engine::ECS::Components::_2D {

struct Movable {
Math::Vector2d velocity; // pixels / second
double angularVelocity; // degrees / second
Math::Vector2d acceleration; // pixels / second^2
double angularAcceleration; // degrees / second^2

Movable() : velocity(0, 0), acceleration(0, 0) {};
Movable(const Math::Vector2d &velocity, const Math::Vector2d &acceleration) : velocity(velocity), acceleration(acceleration) {};
Movable(const Movable &other) : velocity(other.velocity), acceleration(other.acceleration) {};
};

} // namespace Game::ECS::Components::_2D

#endif /* !MOVABLE_HPP_ */
29 changes: 29 additions & 0 deletions Flakkari/Engine/EntityComponentSystem/Components/2D/Transform.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
/*
** EPITECH PROJECT, 2024
** Title: Flakkari
** Author: MasterLaplace
** Created: 2023-01-06
** File description:
** Transform
*/

#ifndef TRANSFORM_HPP_
#define TRANSFORM_HPP_

#include "../../../Math/Vector.hpp"

namespace Flakkari::Engine::ECS::Components::_2D {

struct Transform {
Math::Vector2d position;
Math::Vector2d scale;
double rotation;

Transform() : position(0, 0), scale(1, 1), rotation(0) {};
Transform(const Math::Vector2d &position, const Math::Vector2d &scale, double rotation) : position(position), scale(scale), rotation(rotation) {};
Transform(const Transform &other) : position(other.position), scale(other.scale), rotation(other.rotation) {};
};

} // namespace Game::ECS::Components::_2D

#endif /* !TRANSFORM_HPP_ */
33 changes: 33 additions & 0 deletions Flakkari/Engine/EntityComponentSystem/Components/Common/Child.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
/*
** EPITECH PROJECT, 2024
** Title: Flakkari
** Author: MasterLaplace
** Created: 2023-01-06
** File description:
** Child
*/

#ifndef CHILD_HPP_
#define CHILD_HPP_

#include <string>

namespace Flakkari::Engine::ECS::Components::Common {

/**
* @brief Child component for ECS entities that have a child entity attached to them
*
* @details This component is used to create a child entity based on a prefab
* and attach it to the entity that has this component
*/
struct Child {
std::string name;

Child() : name("") {}
Child(const std::string &name) : name(name) {}
Child(const Child &other) : name(other.name) {}
};

} // namespace Flakkari::Engine::ECS::Components::Common

#endif /* !CHILD_HPP_ */
32 changes: 32 additions & 0 deletions Flakkari/Engine/EntityComponentSystem/Components/Common/Parent.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
/*
** EPITECH PROJECT, 2024
** Title: Flakkari
** Author: MasterLaplace
** Created: 2023-01-06
** File description:
** Parent
*/

#ifndef PARENT_HPP_
#define PARENT_HPP_

#include <string>

namespace Flakkari::Engine::ECS::Components::Common {

/**
* @brief Parent component for ECS entities that have a parent entity attached to them
*
* @details This component is used to store the parent entity of an entity in the ECS
*/
struct Parent {
std::size_t entity;

Parent() : entity(0) {}
Parent(const std::size_t &entity) : entity(entity) {}
Parent(const Parent &other) : entity(other.entity) {}
};

} // namespace Flakkari::Engine::ECS::Components::Common

#endif /* !PARENT_HPP_ */
32 changes: 32 additions & 0 deletions Flakkari/Engine/EntityComponentSystem/Components/Common/Tag.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
/*
** EPITECH PROJECT, 2024
** Title: Flakkari
** Author: MasterLaplace
** Created: 2023-01-06
** File description:
** Tag
*/

#ifndef TAG_HPP_
#define TAG_HPP_

#include <string>

namespace Flakkari::Engine::ECS::Components::Common {

/**
* @brief Tag component for ECS entities that have a script attached to them
*
* @details This component is used to store the path to the script that will be executed
*/
struct Tag {
std::string tag;

Tag() : tag("") {}
Tag(const std::string &tag) : tag(tag) {}
Tag(const Tag &other) : tag(other.tag) {}
};

} // namespace Game::ECS::Components::Common

#endif /* !TAG_HPP_ */
22 changes: 22 additions & 0 deletions Flakkari/Engine/EntityComponentSystem/Components/Components2D.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
/**************************************************************************
* Flakkari Engine Library v0.2.0
*
* Flakkari Library is a C++ Library for Network.
* @file Components2D.hpp
* @brief Components2D header. Contains all 2D components.
* (Collider, Movable, RigidBody, Transform)
*
* Flakkari Library is under MIT License.
* https://opensource.org/licenses/MIT
* © 2023 @MasterLaplace
* @version 0.2.0
* @date 2023-01-06
**************************************************************************/

#ifndef COMPONENTS2D_HPP_
#define COMPONENTS2D_HPP_

#include "2D/Movable.hpp" // Movable component (velocity, angularVelocity, acceleration, angularAcceleration)
#include "2D/Transform.hpp" // Transform component (position, rotation, scale)

#endif /* !COMPONENTS2D_HPP_ */
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
/**************************************************************************
* Flakkari Engine Library v0.2.0
*
* Flakkari Library is a C++ Library for Network.
* @file ComponentsCommon.hpp
* @brief ComponentsCommon header. Contains all common components.
* (Parent, Tag)
*
* Flakkari Library is under MIT License.
* https://opensource.org/licenses/MIT
* © 2023 @MasterLaplace
* @version 0.2.0
* @date 2023-01-06
**************************************************************************/

#ifndef COMPONENTSCOMMON_HPP_
#define COMPONENTSCOMMON_HPP_

#include "Common/Parent.hpp" // Parent component (entity)
#include "Common/Tag.hpp" // Tag component (tag)

#endif /* !COMPONENTSCOMMON_HPP_ */
Loading

0 comments on commit 50b6159

Please sign in to comment.