#1 - quicr module

This commit is contained in:
Martin Slachta
2026-07-22 17:34:44 +02:00
parent a04f0dc262
commit f4174eb0c7
177 changed files with 5309 additions and 2265 deletions
+24 -1
View File
@@ -68,6 +68,8 @@ void ZoneManager::on_player_move(SessionId session_id, mmo::PlayerMoveMessage&&
entt::entity entity = client_entity(session_id);
if (entity == entt::null) return;
m_session_input_frame[session_id] = message.frame_idx();
auto* controller = m_world->registry().try_get<CharacterController>(entity);
if (controller) {
controller->set_input(
@@ -97,6 +99,11 @@ const im::Interest* ZoneManager::get_interest(im::InterestId id) const {
return m_interest_system->get_interest(id);
}
uint32_t ZoneManager::acked_input_frame(im::InterestId interest_id) const {
auto it = m_session_acked_frame.find(interest_id);
return it != m_session_acked_frame.end() ? it->second : 0;
}
// ── Private helpers ───────────────────────────────────────────────────────────
void ZoneManager::check_neighbor_transfers() {
@@ -169,9 +176,25 @@ void ZoneManager::tick(uint32_t frame_idx, float delta_time) {
m_world->step(delta_time);
FrameMarkEnd("World step");
// Re-stamp each client entity's newest input onto the server's frame index.
// The input ring is keyed by client frame numbers (independent counter),
// but physics lookup uses the server's frame counter. By re-stamping onto
// the server frame, input(server_frame_idx) resolves by exact match rather
// than fallback, ensuring deterministic and correct input consumption.
for (const auto& [interest_id, entity] : m_client_entities) {
auto* controller = m_world->registry().try_get<CharacterController>(entity);
if (!controller) continue;
controller->set_input(frame_idx, controller->input());
}
FrameMarkStart("Physics step");
m_physics_world.step(frame_idx, delta_time);
// Fixed step, not the measured interval: the simulation has to advance by the
// same amount every frame for a replay of the same inputs to land in the same
// place.
m_physics_world.step(frame_idx, JoltPhysicsWorld::FIXED_DELTA_TIME);
FrameMarkEnd("Physics step");
m_session_acked_frame = m_session_input_frame;
}
} // namespace tw::net