#1 - ClientWorldController refactoring
This commit is contained in:
@@ -19,8 +19,6 @@ ZoneManager::ZoneManager(im::AreaBounds zone_bounds)
|
||||
))
|
||||
{}
|
||||
|
||||
// ── ZoneProxy interface ───────────────────────────────────────────────────────
|
||||
|
||||
im::AreaBounds ZoneManager::area() const {
|
||||
return {
|
||||
{ (float)m_spatial_backend->world_min_x(), (float)m_spatial_backend->world_min_z() },
|
||||
@@ -33,8 +31,6 @@ void ZoneManager::transfer_entity(EntityInfo&& info) {
|
||||
spawn_entity(std::move(info));
|
||||
}
|
||||
|
||||
// ── Zone management ───────────────────────────────────────────────────────────
|
||||
|
||||
entt::entity ZoneManager::spawn_entity(EntityInfo&& info) {
|
||||
entt::entity entity = m_world->registry().create();
|
||||
|
||||
@@ -104,8 +100,6 @@ uint32_t ZoneManager::acked_input_frame(im::InterestId interest_id) const {
|
||||
return it != m_session_acked_frame.end() ? it->second : 0;
|
||||
}
|
||||
|
||||
// ── Private helpers ───────────────────────────────────────────────────────────
|
||||
|
||||
void ZoneManager::check_neighbor_transfers() {
|
||||
ZoneScopedN("ZoneManager::check_neighbor_transfers");
|
||||
|
||||
@@ -161,9 +155,7 @@ void ZoneManager::check_neighbor_transfers() {
|
||||
}
|
||||
}
|
||||
|
||||
// ── Tick ──────────────────────────────────────────────────────────────────────
|
||||
|
||||
void ZoneManager::tick(uint32_t frame_idx, float delta_time) {
|
||||
void ZoneManager::update(uint32_t frame_idx, float delta_time) {
|
||||
ZoneScopedN("ZoneManager::tick");
|
||||
|
||||
FrameMarkStart("Interest System");
|
||||
@@ -176,21 +168,7 @@ 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");
|
||||
// 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");
|
||||
|
||||
|
||||
Reference in New Issue
Block a user