Skip to content

Commit

Permalink
Merge pull request #26 from MasterLaplace/58-implement-a-complete-pay…
Browse files Browse the repository at this point in the history
…load-for-flakkari-protocol

58 implement a complete payload for flakkari protocol
  • Loading branch information
MasterLaplace authored Jan 14, 2024
2 parents 2e5eb29 + 5cc41ee commit 347987d
Show file tree
Hide file tree
Showing 67 changed files with 3,016 additions and 782 deletions.
3 changes: 1 addition & 2 deletions .github/workflows/build_checker_macos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ on:
- '*'

jobs:
verify-commit-name:
build_checker_macos:
runs-on: macos-latest

steps:
Expand All @@ -21,7 +21,6 @@ jobs:
brew install cmake
brew install ninja
- name: Build
run: |
mkdir build
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/build_checker_ubuntu.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ on:
- '*'

jobs:
verify-commit-name:
build_checker_ubuntu:
runs-on: ubuntu-latest

steps:
Expand Down
24 changes: 24 additions & 0 deletions .github/workflows/build_checker_windows.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: Build Checker Windows

on:
push:
branches:
- '*'
pull_request:
branches:
- '*'

jobs:
build:
runs-on: windows-latest
steps:
- uses: actions/checkout@v4

- name: Install CMake
run: |
choco install cmake -y
- name: Configure and Build
run: |
mkdir build && cd build
cmake .. && cmake --build .
24 changes: 24 additions & 0 deletions .github/workflows/create_release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: Create Release on Tag

on:
push:
tags:
- 'v*.*.0'

jobs:
build:
name: Create Release
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: Flakkari ${{ github.ref }}
draft: false
prerelease: false
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -574,3 +574,4 @@ docs/Flakkari/
build/
.Test/
poc/
Experimental/
34 changes: 32 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,44 +6,67 @@ project(R-Type_Server)
# Add all your source and headers files:
set(SOURCES
Flakkari/core.cpp

Flakkari/Logger/Logger.cpp

Flakkari/Network/Address.cpp
Flakkari/Network/Buffer.cpp
Flakkari/Network/Socket.cpp
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/Game/ResourceManager.cpp

Flakkari/Server/Internals/CommandManager.cpp
)

set(HEADERS
Flakkari/Logger/Logger.hpp

Flakkari/Network/Packed.hpp
Flakkari/Network/Address.hpp
Flakkari/Network/Buffer.hpp
Flakkari/Network/Socket.hpp
Flakkari/Network/Serializer.hpp
Flakkari/Network/PacketQueue.hpp
Flakkari/Network/IOMultiplexer.hpp

Flakkari/Protocol/Commands.hpp
Flakkari/Protocol/Components.hpp
Flakkari/Protocol/Events.hpp
Flakkari/Protocol/Header.hpp
Flakkari/Protocol/Packet.hpp
Flakkari/Protocol/PacketFactory.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/Engine/EntityComponentSystem/EntityFactory.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/Game/ResourceManager.hpp

Flakkari/Server/Internals/CommandManager.hpp
)

Expand All @@ -52,15 +75,22 @@ set(HEADER_LIB_LOGGER
)

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

set(HEADER_LIB_PROTOCOL
Flakkari/Protocol/Commands.hpp
Flakkari/Protocol/Components.hpp
Flakkari/Protocol/Events.hpp
Flakkari/Protocol/Header.hpp
Flakkari/Protocol/Packet.hpp
Flakkari/Protocol/PacketFactory.hpp
)

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

#ifndef COLLIDER_HPP_
#define COLLIDER_HPP_

#include <string>
#include "../../../Math/Vector.hpp"

#include "Network/Packed.hpp"

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

/**
* @brief Collider 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 Collider {
Math::Vector2f _size;

Collider() : _size() {}
Collider(Math::Vector2f nsize) : _size(nsize) {}
Collider(const Collider &other) : _size(other._size) {}

std::size_t size() const {
return sizeof(_size);
}
};

PACKED_END
} // namespace Flakkari::Engine::ECS::Components::_2D

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

#ifndef FLAKKARI_CONTROL_HPP_
#define FLAKKARI_CONTROL_HPP_

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

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

/**
* @brief Control component for 2D entities (player, enemies, etc...)
*
* @details
* up: move up (give access to the move up)
* down: move down (give access to the move down)
* left: move left (give access to the move left)
* right: move right (give access to the move right)
* shoot: shoot (give access to the shoot)
*/
struct Control {
bool up;
bool down;
bool left;
bool right;
bool shoot;

Control() : up(false), down(false), left(false), right(false), shoot(false) {};
Control(bool up, bool down, bool left, bool right, bool shoot)
: up(up), down(down), left(left), right(right), shoot(shoot) {};
Control(const Control &other)
: up(other.up), down(other.down), left(other.left), right(other.right), shoot(other.shoot) {};

std::size_t size() const {
return sizeof(*this);
}
};

PACKED_END
} // namespace Flakkari::Engine::ECS::Components::_2D

#endif /* !FLAKKARI_CONTROL_HPP_ */
22 changes: 14 additions & 8 deletions Flakkari/Engine/EntityComponentSystem/Components/2D/Movable.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,24 +7,30 @@
** Movable
*/

#ifndef MOVABLE_HPP_
#define MOVABLE_HPP_
#ifndef FLAKKARI_MOVABLE_HPP_
#define FLAKKARI_MOVABLE_HPP_

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

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

struct Movable {
Math::Vector2d velocity; // pixels / second
double angularVelocity; // degrees / second
Math::Vector2d acceleration; // pixels / second^2
double angularAcceleration; // degrees / second^2
Math::Vector2f velocity; // pixels / second
float angularVelocity; // degrees / second
Math::Vector2f acceleration; // pixels / second^2
float 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 Math::Vector2f &velocity, const Math::Vector2f &acceleration) : velocity(velocity), acceleration(acceleration) {};
Movable(const Movable &other) : velocity(other.velocity), acceleration(other.acceleration) {};

std::size_t size() const {
return sizeof(*this);
}
};

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

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

#ifndef RIGIDBODY_HPP_
#define RIGIDBODY_HPP_

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

#include "Network/Packed.hpp"

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

/**
* @brief RigidBody represent the physical properties of a rigid body in a game engine
*
*/
struct RigidBody {
float mass;
float restitution;
float friction;
float gravityScale;
bool isGravityAffected = true;
bool isKinematic = false;

RigidBody() : mass(0), restitution(0), friction(0), gravityScale(0), isGravityAffected(false), isKinematic(false) {};
RigidBody(const RigidBody &other) : mass(other.mass), restitution(other.restitution), friction(other.friction), gravityScale(other.gravityScale), isGravityAffected(other.isGravityAffected), isKinematic(other.isKinematic) {};
RigidBody(float mass, float restitution, float friction, float gravityScale) : mass(mass), restitution(restitution), friction(friction), gravityScale(gravityScale), isGravityAffected(true), isKinematic(false) {};

std::size_t size() const {
return sizeof(*this);
}
};

PACKED_END
} // namespace Flakkari::Engine::ECS::Components::_2D

#endif /* !RIGIDBODY_HPP_ */
20 changes: 13 additions & 7 deletions Flakkari/Engine/EntityComponentSystem/Components/2D/Transform.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,23 +7,29 @@
** Transform
*/

#ifndef TRANSFORM_HPP_
#define TRANSFORM_HPP_
#ifndef FLAKKARI_TRANSFORM_HPP_
#define FLAKKARI_TRANSFORM_HPP_

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

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

struct Transform {
Math::Vector2d position;
Math::Vector2d scale;
double rotation;
Math::Vector2f position;
Math::Vector2f scale;
float 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 Math::Vector2f &position, const Math::Vector2f &scale, float rotation) : position(position), scale(scale), rotation(rotation) {};
Transform(const Transform &other) : position(other.position), scale(other.scale), rotation(other.rotation) {};

std::size_t size() const {
return sizeof(*this);
}
};

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

#endif /* !TRANSFORM_HPP_ */
#endif /* !FLAKKARI_TRANSFORM_HPP_ */
Loading

0 comments on commit 347987d

Please sign in to comment.