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

A guest's half of a NetSession: joining, predicting what it owns, being corrected, and drawing the rest late. More...

#include <net_client.h>

Public Member Functions

void open (const NetAddress &server)
 Start talking to server. Nothing is sent until the first tick has run.
void close ()
 Tell the server goodbye and forget everything this session held but what it made.
void endSession ()
 Mark what this session made to go at the next sweepEnded: the session is over.
bool receive (Scene &scene, ResourceManager &resources)
 Take what has arrived, one datagram at a time, then build what was spawned.
void send ()
 Send a Hello until welcomed, then the commands the server has not heard.
bool simulates (const Scene &scene, EntityId entity) const
 See NetSession::simulates.
void lease (const std::vector< EntityId > &entities)
 See NetSession::lease.
void ageLeases ()
 Count every lease down a tick, outside a replay, and hand back the lapsed.
void beginTick (const InputCommand &command)
 Keep command until the server says it ran it.
void endTick (const Scene &scene, uint32_t tick)
 Record where this end's own entity ended tick.
void endReplay (const Scene &scene)
 Finish the replay and measure what the picture owes for it.
void applyDrawCorrection (Scene &scene, float deltaTime)
 Work a little of every outstanding correction off, and apply the rest.
void removeDrawCorrection (Scene &scene)
 Take back what applyDrawCorrection applied.
void forgetWorld ()
 Drop everything naming an entity; see NetSession::forgetWorld.
EntityId entityFor (const Scene &scene, uint32_t slot) const
 See NetSession::entityFor.
void adoptWorld (const Scene &scene)
 The world as loaded; see NetSession::setWorld.
void sweepEnded (Scene &scene)
 Destroy what the session last closed had made (NetNames::sweepEnded).
bool sendMessage (const uint8_t *bytes, size_t size)
 See NetSession::sendMessage.
bool isPlaying () const
 From the Welcome until the session ends.
bool drawingServerTicks () const
 Whether a snapshot has arrived, so drawnTick() is the server's.

Detailed Description

A guest's half of a NetSession: joining, predicting what it owns, being corrected, and drawing the rest late.

Holds nothing outside a client's session; NetSession decides when it is asked.

Member Function Documentation

◆ receive()

bool Vkm::Engine::NetClient::receive ( Scene & scene,
ResourceManager & resources )

Take what has arrived, one datagram at a time, then build what was spawned.

Parameters
sceneThe world a Welcome or a snapshot is applied to.
resourcesBuilds the prefabs the server spawned.
Returns
False when the session has ended: refused, told goodbye, or timed out. What is still on the socket belongs to a session that is over.

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