One game of the server: its GameInstance, the Simulation thread that runs it, the EventTracker of what its clients learnt, and the names of its players.
More...
#include </__w/project-rtype/project-rtype/server/include/rtype/room.hpp>
One game of the server: its GameInstance, the Simulation thread that runs it, the EventTracker of what its clients learnt, and the names of its players.
The game, the tracker and the names belong to the simulation thread: other threads post() to simulation() to use them, or wait until it stopped. The thread starts once the rest of the room is built, and stops first when the room is destroyed. The rooms of a server run side by side, each on its own thread, and its sessions play in the room of their Session::room.
◆ TickHandler
Called on the simulation thread after each tick of the room.
◆ Room() [1/3]
| rtype::Room::Room |
( |
std::uint32_t |
id, |
|
|
std::optional< std::uint64_t > |
seed, |
|
|
aegis2d::ecs::WaveSchedule |
waves, |
|
|
std::uint32_t |
rate, |
|
|
TickHandler |
after_tick, |
|
|
bool |
trace = false, |
|
|
GameRules |
rules = {} |
|
) |
| |
Creates the game and starts its thread.
- Parameters
-
| id | Number of the room in its server, its sessions' Session::room. |
| seed | Seed of the random spawns, or std::nullopt for none (see ServerGame). |
| waves | Waves to play in every game of the room, at their start. |
| rate | Ticks per second. |
| after_tick | Called after each tick, on the simulation thread. |
| trace | true to record the timings of its ticks (Simulation::profiler()). |
| rules | How the games of the room play. |
◆ Room() [2/3]
| rtype::Room::Room |
( |
const Room & |
| ) |
|
|
delete |
◆ Room() [3/3]
| rtype::Room::Room |
( |
Room && |
| ) |
|
|
delete |
◆ ~Room()
Stops the thread, then destroys the game.
◆ events()
What the clients of the room learnt of its entities.
- Returns
- The tracker; use it from the simulation thread.
◆ id()
| std::uint32_t rtype::Room::id |
( |
| ) |
const |
|
noexcept |
Number of the room in its server.
- Returns
- The id given to the constructor.
◆ instance()
The game of the room.
- Returns
- It; use it from the simulation thread, or once simulation() stopped.
◆ names()
Names of the players in the room's game, by number.
- Returns
- An empty slot for a number with no player; use them from the simulation thread.
◆ operator=() [1/2]
| Room & rtype::Room::operator= |
( |
const Room & |
| ) |
|
|
delete |
◆ operator=() [2/2]
| Room & rtype::Room::operator= |
( |
Room && |
| ) |
|
|
delete |
◆ simulation()
The thread running the game.
- Returns
- The simulation.
The documentation for this class was generated from the following file:
- /__w/project-rtype/project-rtype/server/include/rtype/room.hpp