R-Type
Networked shoot'em up built on Aegis2D
Loading...
Searching...
No Matches
lag_compensation.hpp
Go to the documentation of this file.
1
3#pragma once
4#include <aegis2d/ecs/collision.hpp>
5#include <aegis2d/ecs/entity.hpp>
6#include <aegis2d/ecs/registry.hpp>
7
9
10#include <chrono>
11#include <cstdint>
12#include <functional>
13#include <vector>
14
15namespace rtype {
16
26[[nodiscard]] std::uint32_t rewind_ticks(std::chrono::nanoseconds rtt,
27 std::chrono::nanoseconds interpolation) noexcept;
28
42void find_rewound_contacts(aegis2d::ecs::Registry& registry, const PositionHistory& history,
43 std::uint64_t tick,
44 const std::function<std::uint32_t(aegis2d::ecs::Entity)>& rewind_of,
45 std::vector<aegis2d::ecs::Contact>& contacts);
46
47} // namespace rtype
The positions of the enemies over the last tuning::position_history_ticks ticks.
Definition position_history.hpp:25
R-Type game code, built on the Aegis2D engine.
Definition enemy_scripts.hpp:16
void find_rewound_contacts(aegis2d::ecs::Registry &registry, const PositionHistory &history, std::uint64_t tick, const std::function< std::uint32_t(aegis2d::ecs::Entity)> &rewind_of, std::vector< aegis2d::ecs::Contact > &contacts)
Finds the contacts of the player missiles with the enemies as their shooters saw them.
std::uint32_t rewind_ticks(std::chrono::nanoseconds rtt, std::chrono::nanoseconds interpolation) noexcept
How many ticks back a player sees the enemies.
Where the enemies were at each of the last ticks, for lag compensation.