Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Feature/rb 136 other player distroyed when player die #124

Merged
Merged
Show file tree
Hide file tree
Changes from 19 commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
863b4c6
SERVER-GAME/CLIENT-GAME: Upgrade packets of init player and new allies,
romainpanno Oct 20, 2023
52408f4
SERVER-GAME/CLIENT-GAME: Add begin of players death
romainpanno Oct 21, 2023
46fb369
SERVER-NITWORK/CELINT-NITWORK: Fix wrong packet for send death player
romainpanno Oct 21, 2023
a5d3d01
SERVER-GAME/CLIENT-GAME: Fix windows compile
TTENSHII Oct 21, 2023
bfbb186
CLIENT-NETWORK/SERVER-NETWORK: Remove debugs prints
romainpanno Oct 21, 2023
66dace0
Merge branch 'feature/RB-136-other-player-distroyed-when-player-die' …
romainpanno Oct 21, 2023
45d22ed
SERVER-NETWORK: Fix macos compil
romainpanno Oct 21, 2023
e3be4b4
SERVER-NETWORK: Fix macos compil and remove useless vars
romainpanno Oct 21, 2023
8c22e9e
SERVER-NETWORK: FIx compile
romainpanno Oct 21, 2023
46639fa
Merge branch 'dev' into feature/RB-136-other-player-distroyed-when-pl…
romainpanno Oct 23, 2023
9ba62ac
Merge remote-tracking branch 'origin/dev' into feature/RB-136-other-p…
romainpanno Oct 23, 2023
dd7aa4e
SERVER-GAME/CLIENT-GAME: Fix missing & (reference) for deadList in
romainpanno Oct 23, 2023
4cac3f4
CLIENT-GAME/SERVER-GAME: Remove useless prints
romainpanno Oct 23, 2023
671e332
NITWORK: Add RFC for PLAYER_DEATH and Upgrade of NEW_ALLIE to NEW_PLAYER
romainpanno Oct 23, 2023
8a396bd
FORMAT-AUTO: automatic format on pull request #124
github-actions[bot] Oct 23, 2023
32028c6
CLIENT-NETWORK: Add receiveEnemyDeath removing entity when struct
romainpanno Oct 23, 2023
8aca603
Merge branch 'feature/RB-136-other-player-distroyed-when-player-die' …
romainpanno Oct 23, 2023
118f478
RFC: Upgrade RFC for PLAYER_DEATH and NEW_PLAYER
romainpanno Oct 23, 2023
e4f8faf
NITWORK: Fix Zstd missing if consexpr
romainpanno Oct 23, 2023
1a06f45
NITWORK: Fix windows compilation
romainpanno Oct 23, 2023
342426a
NITWORK: Fix windows compil
romainpanno Oct 23, 2023
358f489
FORMAT-AUTO: automatic format on pull request #124
github-actions[bot] Oct 23, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
166 changes: 141 additions & 25 deletions docs/network/rfc/RFC.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,9 @@ Table of Contents
2.2.2.1.2. Server
2.2.2.1.2.1. Magick
2.2.2.1.2.2. Player ID
2.2.2.1.2.3. Position
2.2.2.1.2.4. Life
2.2.2.1.2.5. Is Other Player
2.2.2.2. READY
2.2.2.2.1. Client
2.2.2.2.1.1. Magick
Expand Down Expand Up @@ -98,14 +101,13 @@ Table of Contents
2.2.2.9.1.2.3.1. X
2.2.2.9.1.2.3.2. Y
2.2.2.9.1.2.4. Enemy Type
2.2.2.10. NEW_ALLIE
2.2.2.10. NEW_PLAYER
2.2.2.10.1. Server
2.2.2.10.1.1. Magick
2.2.2.10.1.2. Allie
2.2.2.10.1.2.1. ID
2.2.2.10.1.2.2. Position
2.2.2.10.1.2.2.1. X
2.2.2.10.1.2.2.2. Y
2.2.2.10.1.2. Player ID
2.2.2.10.1.3. Position
2.2.2.10.1.4. Life
2.2.2.10.1.5. Is Other Player
2.2.2.11. POSITION_RELATIVE_BROADCAST
2.2.2.11.1. Server
2.2.2.11.1.1. Magick
Expand All @@ -120,6 +122,13 @@ Table of Contents
2.2.2.12.1.2.1. X
2.2.2.12.1.2.2. Y
2.2.2.12.1.3. Player ID
2.2.2.13 PLAYER_DEATH
2.2.2.13.1. Client
2.2.2.13.1.1. Magick
2.2.2.13.1.2. Player ID
2.2.2.13.2. Server
2.2.2.13.2.1. Magick
2.2.2.13.2.2. Player ID
3. References
3.1. R-Bus
3.2. RFC
Expand Down Expand Up @@ -248,9 +257,10 @@ Table of Contents
- POSITION_ABSOLUTE = 8,
- NEW_BULLET = 9,
- NEW_ENEMY = 10,
- NEW_ALLIE = 11,
- NEW_PLAYER = 11,
- POSITION_RELATIVE_BROADCAST = 12,
- POSITION_ABSOLUTE_BROADCAST = 13,
- PLAYER_DEATH = 14,

2.2.2. Action Body

Expand All @@ -277,6 +287,9 @@ Table of Contents
The Server action contains the following fields:
- `magick`
- `player_id`
- `pos`
- `life`
- `isOtherPlayer`

2.2.2.1.2.1. Magick

Expand All @@ -294,6 +307,42 @@ Table of Contents
This field is unsigned (so starting from 0 to 2^32)
This field is unique for each client

2.2.2.1.2.3. Position

This field correspond to the position of the client and contains the
following fields:
- `x`
- `y`

2.2.2.1.2.3.1. X

This field must be of size 4 byte.
This field is signed (so starting from -((2^32)/2) to +(((2^32)/2)-1))

2.2.2.1.2.3.2. Y

This field must be of size 4 byte.
This field is signed (so starting from -((2^32)/2) to +(((2^32)/2)-1))

2.2.2.1.2.4. Life

This field correspond to the life of the client and contains the following
fields:
- `hp` This field must be of size 4 byte. This field is signed (so starting
from -((2^32)/2) to +(((2^32)/2)-1))

2.2.2.1.2.5. Is Other Player

This field correspond to the fact that the client is an other player or not.
It is used to know if it concern the client player himself or an other
player.

This field must be of size 1 byte.
This field is unsigned (so starting from 0 to 2^8)
This field must be equal to one of these value:
- TRUE = 1,
- FALSE = 0,

2.2.2.2. READY

The Client must send a ready action to enter/start the game.
Expand Down Expand Up @@ -664,7 +713,7 @@ Table of Contents
This field must be equal to one of these value:
- CLASSIC_ENEMY = 0

2.2.2.10. NEW_ALLIE
2.2.2.10. NEW_PLAYER

The Server must send a new allie action when a new player enter in the
game.
Expand All @@ -673,46 +722,65 @@ Table of Contents

The Server action contains the following fields:
- `magick`
- `allie`
- `playerId`
- `pos`
- `life`
- `isOtherPlayer`

2.2.2.10.1.1. Magick
2.2.2.10.1.1. Magick

This field help to know the packet is realy a new allie action.

This field must be of size 1 byte.
This field is unsigned (so starting from 0 to 2^8)
This field must be equal to the ascii `\x0a`

2.2.2.10.1.2. Allie
2.2.2.10.1.2. Player ID

This field correspond to the new allie and contains the following fields:
- `id`
- `position`

2.2.2.10.1.2.1. ID

This field correspond to the ID of the new allie.
This field correspond to the ID of the client.

This field must be of size 4 bytes.
This field is unsigned (so starting from 0 to 2^32)
This field is unique for each client

2.2.2.10.1.2.2. Position
2.2.2.10.1.3. Position

This field correspond to the absolute position of the new allie and
contains the following fields:
- `x`
- `y`
This field correspond to the position of the client and contains the
following fields:
- `x` This field must be of size 4 byte. This field is signed (so starting
from -((2^32)/2) to +(((2^32)/2)-1))
- `y` This field must be of size 4 byte. This field is signed (so starting
from -((2^32)/2) to +(((2^32)/2)-1))

2.2.2.10.1.2.2.1. X
2.2.2.10.1.3.1. X

This field must be of size 4 byte.
This field is signed (so starting from -((2^32)/2) to +(((2^32)/2)-1))

2.2.2.10.1.2.2.2. Y
2.2.2.10.1.3.2. Y

This field must be of size 4 byte.
This field is signed (so starting from -((2^32)/2) to +(((2^32)/2)-1))

2.2.2.10.1.4. Life

This field correspond to the life of the client and contains the following
fields:
- `hp` This field must be of size 4 byte. This field is signed (so starting
from -((2^32)/2) to +(((2^32)/2)-1))

2.2.2.10.1.5. Is Other Player

This field correspond to the fact that the client is an other player or not.
It is used to know if it concern the client player himself or an other
player.

This field must be of size 1 byte.
This field is unsigned (so starting from 0 to 2^8)
This field must be equal to one of these value:
- TRUE = 1,
- FALSE = 0,

2.2.2.11. POSITION_RELATIVE_BROADCAST

The Server can send a position relative broadcast to all the players when a
Expand Down Expand Up @@ -801,6 +869,54 @@ Table of Contents
This field correspond to the ID of the player that has its position
modified.

2.2.2.13. PLAYER_DEATH

The Client must send a player death action when he die. Or any other player
The Server must send a player death action when a player die. And check if
a player is dead when he receive a PLAYER_DEATH action from a client.

2.2.2.13.1. Client

The Client action contains the following fields:
- `magick`
- `player_id`

2.2.2.13.1.1. Magick

This field help to know the packet is realy a player death action.

This field must be of size 1 byte.
This field is unsigned (so starting from 0 to 2^8)
This field must be equal to the ascii `\x11`

2.2.2.13.1.2. Player ID

This field correspond to the ID of the player that has died.

This field must be of size 4 bytes.
This field is unsigned (so starting from 0 to 2^32)

2.2.2.13.2. Server

The Server action contains the following fields:
- `magick`
- `player_id`

2.2.2.13.2.1. Magick

This field help to know the packet is realy a player death action.

This field must be of size 1 byte.
This field is unsigned (so starting from 0 to 2^8)
This field must be equal to the ascii `\x11`

2.2.2.13.2.2. Player ID

This field correspond to the ID of the player that has died.

This field must be of size 4 bytes.
This field is unsigned (so starting from 0 to 2^32)

3. References

Link to some mentioned word
Expand Down
86 changes: 0 additions & 86 deletions docs/network/rfc/client.md

This file was deleted.

6 changes: 4 additions & 2 deletions src/Client/Systems/Graphic/DeathSystems.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@

namespace Systems {

const std::function<void(std::size_t)> setPlayerAnimRectDeath = [](std::size_t id) {
void setPlayerAnimRectDeath(std::size_t id)
{
Registry::components<Types::AnimRect> arrAnimRect =
Registry::getInstance().getComponents<Types::AnimRect>();

Expand All @@ -25,7 +26,8 @@ namespace Systems {

// MAP FOR DEATH FUNCTIONS FOR EACH ENTITY
const std::unordered_map<std::type_index, std::function<void(std::size_t)>> deathFunctions = {
{std::type_index(typeid(Types::Player)), setPlayerAnimRectDeath},
{std::type_index(typeid(Types::Player)), setPlayerAnimRectDeath},
{std::type_index(typeid(Types::OtherPlayer)), setPlayerAnimRectDeath}
};

void DeathSystems::setEntityDeathFunction(std::size_t /*unused*/, std::size_t /*unused*/)
Expand Down
Loading
Loading