R-Type
Networked shoot'em up built on Aegis2D
Loading...
Searching...
No Matches
rtype::Trail Struct Reference

The latest positions of an entity, oldest first, to draw it between two of them. More...

#include </__w/project-rtype/project-rtype/client/network/include/rtype/client_world.hpp>

Public Member Functions

void push (TrailPoint point) noexcept
 Adds the newest position, dropping the oldest when full.
 

Public Attributes

std::array< TrailPoint, capacity > points {}
 Positions, oldest first; only the first count are set.
 
std::size_t count = 0
 Number of positions set.
 

Static Public Attributes

static constexpr std::size_t capacity = 4
 Number of positions kept.
 

Detailed Description

The latest positions of an entity, oldest first, to draw it between two of them.

The server sends 20 snapshots a second, the client draws 60 frames or more: drawing each entity where the last snapshot put it would make it jump three times a second. ClientWorld keeps here the last positions received, and interpolate() gives the position at any tick between them.

Member Function Documentation

◆ push()

void rtype::Trail::push ( TrailPoint  point)
noexcept

Adds the newest position, dropping the oldest when full.

Parameters
pointPosition of a tick later than the newest one; an older or equal tick is ignored.

Member Data Documentation

◆ capacity

constexpr std::size_t rtype::Trail::capacity = 4
staticconstexpr

Number of positions kept.

◆ count

std::size_t rtype::Trail::count = 0

Number of positions set.

◆ points

std::array<TrailPoint, capacity> rtype::Trail::points {}

Positions, oldest first; only the first count are set.


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