vkmEngine 1.0.15
A C++ game engine · vkmengine.com
Loading...
Searching...
No Matches
Vkm::Engine::NetNames Class Reference

What the server's slots name on this end, so a client can make entities of its own. More...

#include <names.h>

Public Member Functions

void adoptWorld (const Scene &scene)
 The world as it was loaded, before anything ran: every live entity names its slot.
EntityId find (const Scene &scene, uint32_t slot) const
 What the server's slot names here, if this end has it.
bool names (const Scene &scene, EntityId entity) const
 Whether a slot of the server's names entity here: if not, it is this end's own.
EntityId claim (Scene &scene, uint32_t slot)
 What the server's slot names here, made if this end has nothing for it yet.
void forget (Scene &scene, uint32_t slot)
 The server says slot is gone: destroy what it named here, and its subtree.
void endSession ()
 Forget what this session named; the world as loaded is kept for the next.
void sweepEnded (Scene &scene)
 Destroy what the session last ended had made, and their subtrees, if scene is still the world they were made in; a world replaced since keeps nothing of them.
void clear ()
 Forget everything, the world as loaded too: it has been replaced.

Detailed Description

What the server's slots name on this end, so a client can make entities of its own.

A slot is an entity's name on the wire: the server's slot, always. The world both ends loaded is the same entities at the same slots, which adoptWorld records as each naming itself. Whatever the server names that this end has not heard of yet is made where there is room - at that same slot when it is free here, which is the common case and keeps the ends' slot order alike, and anywhere else when an entity of this end's own is standing in it. So an effect, a menu or a marker a client makes for itself is never written over by the server.

Member Function Documentation

◆ adoptWorld()

void Vkm::Engine::NetNames::adoptWorld ( const Scene & scene)

The world as it was loaded, before anything ran: every live entity names its slot.

Parameters
sceneThe world both ends loaded from one file, or built alike.

◆ find()

EntityId Vkm::Engine::NetNames::find ( const Scene & scene,
uint32_t slot ) const

What the server's slot names here, if this end has it.

Parameters
sceneThe world it is in.
slotThe server's slot.
Returns
The entity, or a null id.

◆ claim()

EntityId Vkm::Engine::NetNames::claim ( Scene & scene,
uint32_t slot )

What the server's slot names here, made if this end has nothing for it yet.

Parameters
sceneThe world it goes in.
slotThe server's slot.
Returns
The entity, or a null id for a slot past what a peer may name.

◆ forget()

void Vkm::Engine::NetNames::forget ( Scene & scene,
uint32_t slot )

The server says slot is gone: destroy what it named here, and its subtree.

Parameters
sceneThe world it is in.
slotThe server's slot.

◆ endSession()

void Vkm::Engine::NetNames::endSession ( )

Forget what this session named; the world as loaded is kept for the next.

What the session made is kept for sweepEnded to destroy: a session's entities leave with it, or a client joining again would find them standing in its slots and build the server's a second time beside them.

◆ sweepEnded()

void Vkm::Engine::NetNames::sweepEnded ( Scene & scene)

Destroy what the session last ended had made, and their subtrees, if scene is still the world they were made in; a world replaced since keeps nothing of them.

Parameters
sceneThe world.

The documentation for this class was generated from the following file: