1#ifndef NANOMMO_CLIENT_PREDICTION_H_
2#define NANOMMO_CLIENT_PREDICTION_H_
8#include "protocol/nanommo.pb.h"
21 void Walk(
const Terrain& terrain, uint32_t sequence,
float direction_x,
22 float direction_z,
bool run,
float seconds);
31 void Settle(
float seconds);
35 float x()
const {
return x_; }
36 float z()
const {
return z_; }
37 float shown_x()
const {
return x_ + error_x_; }
38 float shown_z()
const {
return z_ + error_z_; }
39 bool placed()
const {
return placed_; }
42 std::size_t
pending()
const {
return pending_.size(); }
46 uint32_t sequence = 0;
51 std::deque<Keys> pending_;
54 float error_x_ = 0.0f;
55 float error_z_ = 0.0f;
63protocol::World
Predicted(
const protocol::World& world,
64 const Prediction& prediction,
float direction_x,
65 float direction_z,
bool run);
void Walk(const Terrain &terrain, uint32_t sequence, float direction_x, float direction_z, bool run, float seconds)
std::size_t pending() const
Inputs sent and not yet acked.
void Settle(float seconds)
Fades what the last corrections moved, over the frame's time.
void Correct(const Terrain &terrain, float x, float z, uint32_t acked, float seconds)
protocol::World Predicted(const protocol::World &world, const Prediction &prediction, float direction_x, float direction_z, bool run)