vkmEngine 1.0.0
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.
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 (EntityId entity) const
 Whether this end decides entity: its own, or one it leases.
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.
bool isPlaying () const
 From the Welcome until the session ends.

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: