INNER CODE UNIT · C++
to_state
trillek-team/tec · client/client-game-state-queue.cpp:25
const GameState& to_state = this->server_states.front();
stats.last_state_time = to_state.timestamp;
// the interpolation_accumulator could be thought of as where we are between two states
// if the incoming states are timestamped, it would probably be better to use that
// instead of guessing like this
if (interpolation_accumulator >= INTERPOLATION_RATE) {
// remove a state from the queue and make it the base state
// also initialize the interpolated state with it
for (auto position : to_state.positions) {
this->base_state.positions[position.first] = position.second;
this->interpolated_state.positions[position.first] = position.second;
}
for (auto velocity : to_state.velocities) {
this->base_state.velocities[velocity.first] = velocity.second;
this->interpolated_state.velocities[velocity.first] = velocity.second;
}
for (auto orientation : to_state.orientations) {