nanoMMO 0.97.8
Building an MMO: The Engineering Series
Loading...
Searching...
No Matches
nanommo::Prediction Class Reference

#include <prediction.h>

Public Member Functions

void Walk (const Terrain &terrain, uint32_t sequence, float direction_x, float direction_z, bool run, float seconds)
void Correct (const Terrain &terrain, float x, float z, uint32_t acked, float seconds)
void Settle (float seconds)
 Fades what the last corrections moved, over the frame's time.
float x () const
float z () const
float shown_x () const
float shown_z () const
bool placed () const
std::size_t pending () const
 Inputs sent and not yet acked.

Detailed Description

Where you are before the server says so. Each tick's keys walk you at once, as the server will when they reach it, and each world from the server puts you where it has you, after the last input it applied, and walks you again through the ones it hasn't yet.

Definition at line 17 of file prediction.h.

Member Function Documentation

◆ Correct()

void nanommo::Prediction::Correct ( const Terrain & terrain,
float x,
float z,
uint32_t acked,
float seconds )

Where the server has you, after the input it acked, and how long each of its ticks is. A small difference from where we had you goes away over a moment, and a large one, such as going through a gate, at once.

Definition at line 37 of file prediction.cc.

◆ pending()

std::size_t nanommo::Prediction::pending ( ) const
inline

Inputs sent and not yet acked.

Definition at line 42 of file prediction.h.

◆ placed()

bool nanommo::Prediction::placed ( ) const
inline

Definition at line 39 of file prediction.h.

◆ Settle()

void nanommo::Prediction::Settle ( float seconds)

Fades what the last corrections moved, over the frame's time.

Definition at line 91 of file prediction.cc.

◆ shown_x()

float nanommo::Prediction::shown_x ( ) const
inline

Definition at line 37 of file prediction.h.

◆ shown_z()

float nanommo::Prediction::shown_z ( ) const
inline

Definition at line 38 of file prediction.h.

◆ Walk()

void nanommo::Prediction::Walk ( const Terrain & terrain,
uint32_t sequence,
float direction_x,
float direction_z,
bool run,
float seconds )

A tick of the keys sent with the sequence: a direction, which is zero for standing still, and whether you run.

Definition at line 25 of file prediction.cc.

◆ x()

float nanommo::Prediction::x ( ) const
inline

Where we have you, and where to draw you, with what's left of a correction still to fade.

Definition at line 35 of file prediction.h.

◆ z()

float nanommo::Prediction::z ( ) const
inline

Definition at line 36 of file prediction.h.


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