8#ifndef RTYPE_ROOM_SYSTEM_HPP_
9 #define RTYPE_ROOM_SYSTEM_HPP_
18 #include "Systems/NetworkSyncSystem.hpp"
60 void update(
float dt)
override;
75 uint32_t
createRoom(uint32_t sessionId,
const std::string &roomName, uint8_t maxPlayers,
77 uint32_t levelId, uint32_t seed, uint32_t durationMinutes);
129 std::shared_ptr<Room>
getRoom(uint32_t roomId);
133 const std::shared_ptr<Room>& room);
Interface for ECS systems.
Network packet implementation for R-Type protocol.
Abstract base class for all ECS systems.
Network packet with header and serializable body.
System to handle network-related operations on the server side.
System to handle room-related operations on the server side.
void launchReadyRooms(float dt)
Launch all rooms that are ready to start the game.
bool joinLobby(PlayerPtr player)
Join the lobby room.
ServerNetwork & _network
Reference to the server network manager.
uint32_t _nextRoomId
Next available room ID.
void disconnectPlayer(uint32_t sessionId)
Disconnect a player from all rooms.
std::mutex _mutex
Mutex for thread-safe operations.
void despawnPlayerEntity(const PlayerPtr &player, const std::shared_ptr< Room > &room)
std::shared_ptr< Room > getRoom(uint32_t roomId)
Get a room by its ID.
bool joinRoom(PlayerPtr player, uint32_t roomId, bool asSpectator=false)
Join an existing room based on client request.
std::function< void(uint32_t roomId)> RoomStartedCb
Callback type for when a room starts.
void setOnRoomStarted(RoomStartedCb cb)
Set the callback to be invoked when a room starts.
RoomStartedCb _onRoomStarted
Callback for when a room starts.
void update(float dt) override
Update system logic for one frame.
uint32_t _lobbyId
ID of the main lobby room.
uint32_t createRoom(uint32_t sessionId, const std::string &roomName, uint8_t maxPlayers, float difficulty, float speed, Room::RoomType type, uint32_t levelId, uint32_t seed, uint32_t durationMinutes)
Create a new room based on client request.
NetworkSyncSystem & _networkSync
Reference to the network sync system.
std::map< uint32_t, uint32_t > _playerRoomMap
Map of player session ID to room ID.
std::map< uint32_t, std::shared_ptr< Room > > _rooms
Map of room ID to Room instances.
bool leaveRoom(PlayerPtr player)
Leave the current room based on client request.
void listAllRooms(uint32_t sessionId)
List all available rooms based on client request.
void chatInRoom(uint32_t sessionId, const net::Packet &packet)
Handle chat message in the room based on client request.
ecs::Registry & _registry
Reference to the entity registry.
Implementation ASIO du serveur réseau (TCP + UDP)
File : GameManager.hpp License: MIT Author : Elias Josué HAJJAR LLAUQUEN elias-josue....
std::shared_ptr< Player > PlayerPtr
Shared pointer type for Player.