C4 Engine
C4 Engine API Documentation

class SnapshotSender

Defined in:  C4Messages.h
The base class for objects that need to send snapshot data.
Definition

class SnapshotSender : public ListElement<SnapshotSender>

Member Functions
SnapshotSender::SendSnapshot Called when the Message Manager sends a snapshot.
SnapshotSender::GetSnapshotPeriod Returns the snapshot period.
SnapshotSender::SetSnapshotPeriod Sets the snapshot period.
SnapshotSender::ExpediteSnapshot Causes a snapshot to be sent as soon as possible.
Constructor

SnapshotSender();

Description
The SnapshotSender class is the base class that objects should inherit from if they need to send snapshot data to client machines in a multiplayer game. Snapshots are sent at regular intervals by the Message Manager. When a snapshot is sent, the SnapshotSender::SendSnapshot function is called for each snapshot sender that is currently registered. (A subclass of SnapshotSender must override this function.) A snapshot sender is registered by calling the MessageMgr::AddSnapshotSender function.

The Message Manager regularly schedules opportunities to send a snapshot at the interval set by the MessageMgr::SetSnapshotInterval function. A snapshot sender may send a snapshot at each opportunity, or it may send a snapshot only at each n-th opportunity, where n is a period set by the SnapshotSender::SetSnapshotPeriod function. By default, the snapshot period is 1, meaning that a snapshot is sent at every opportunity scheduled by the Message Manager.
Base Classes
ListElement<SnapshotSender> Used internally by the Message Manager.
See Also

MessageMgr::AddSnapshotSender

MessageMgr::RemoveSnapshotSender

MessageMgr::GetSnapshotInterval

MessageMgr::GetSnapshotFrequency

MessageMgr::SetSnapshotInterval