INNER CODE UNIT · C++

itr

trillek-team/tec · client/client-game-state-queue.cpp:48

			auto itr = this->predictions.find(this->command_id);
			if (itr != this->predictions.end()) {
				this->base_state.positions[this->client_id] = itr->second.positions[this->client_id];
				this->base_state.orientations[this->client_id] = itr->second.orientations[this->client_id];
				this->base_state.velocities[this->client_id] = itr->second.velocities[this->client_id];
				this->interpolated_state.positions[this->client_id] = itr->second.positions[this->client_id];
				this->interpolated_state.orientations[this->client_id] = itr->second.orientations[this->client_id];
				this->interpolated_state.velocities[this->client_id] = itr->second.velocities[this->client_id];
			}
		}

		// when too many states, discard the rest! what could possibly go wrong!?
		// we just interpolate between them anyways
		while (!this->server_states.empty() && interpolation_accumulator >= INTERPOLATION_RATE) {
			interpolation_accumulator -= INTERPOLATION_RATE;
			this->base_state.state_id = to_state.state_id;
			this->server_states.pop();
		}

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…