![]() |
vkmEngine 1.0.0
A C++ game engine · vkmengine.com
|
The authority's half of a NetSession: seats, the join handshake, commands in and snapshots out. More...
#include <net_server.h>
Public Types | |
| using | SpawnPlayer = std::function<EntityId(Scene&, ResourceManager&, PlayerId)> |
| What a joining player is given, decided by the game. | |
| using | DespawnPlayer = std::function<void(Scene&, ResourceManager&, PlayerId, EntityId)> |
| Undo what SpawnPlayer did. | |
Public Member Functions | |
| void | open (uint32_t maxPlayers) |
Start taking up to maxPlayers players, under a fresh join key. | |
| void | close () |
| Tell every player goodbye and forget them. | |
| void | receive (Scene &scene, ResourceManager &resources) |
| Take every datagram that has arrived, then give back the seats that are going. | |
| void | beginTick (uint32_t tick) |
| Hand every player the command its entity runs this tick. | |
| void | endTick (const Scene &scene, uint32_t tick) |
| Remember where every player is, for judging a shot later. | |
| void | send (Scene &scene, uint32_t tick) |
| Send every player who has answered its snapshot of this tick. | |
| const InputCommand * | commandFor (EntityId entity) const |
The command entity's player sent for this tick. | |
| void | rewind (Scene &scene, EntityId shooter) |
Put every player but shooter where shooter saw them. | |
| void | restore (Scene &scene) |
| Put back exactly what rewind moved. | |
| void | forgetWorld () |
| Drop everything naming an entity; see NetSession::forgetWorld. | |
The authority's half of a NetSession: seats, the join handshake, commands in and snapshots out.
Holds nothing outside a server's session; NetSession decides when it is asked.
| using Vkm::Engine::NetServer::SpawnPlayer = std::function<EntityId(Scene&, ResourceManager&, PlayerId)> |
What a joining player is given, decided by the game.
Returns the entity that player owns; a null entity refuses the connection.
| using Vkm::Engine::NetServer::DespawnPlayer = std::function<void(Scene&, ResourceManager&, PlayerId, EntityId)> |
Undo what SpawnPlayer did.
Called when a player leaves, times out, or the session closes.
| const InputCommand * Vkm::Engine::NetServer::commandFor | ( | EntityId | entity | ) | const |
The command entity's player sent for this tick.
| entity | The entity about to be driven. |
entity. Put every player but shooter where shooter saw them.
| scene | The world to rewind. |
| shooter | Whose moment is restored; a shooter no player drives is judged against the present. |