refactor(ecs): move entity physics to tick-based systems

Update PhysicalSystem and SpeedSystem to operate on entt::registry
instead of individual components. Add TickVelocity for server creatures
so movement is calculated per tick without frame delta time. LocalPlayer
now implements its own client-side physics with collision detection.
This commit is contained in:
2026-07-31 20:39:40 +08:00
parent 412f88565a
commit c5ce91e653
8 changed files with 276 additions and 121 deletions

View File

@@ -1,18 +1,16 @@
#pragma once
#include "Cubed/gameplay/ecs/movement.hpp"
#include "Cubed/gameplay/ecs/state.hpp"
#include "Cubed/gameplay/ecs/transform.hpp"
#include "Cubed/gameplay/world.hpp"
namespace Cubed {
#include <entt/entt.hpp>
namespace Cubed {
class ServerWorld;
class PhysicalSystem {
public:
static glm::vec3 get_move_distance(float dt, const Direction& d,
const Velocity& v);
static glm::vec3 get_move_distance(const Direction& d,
const TickVelocity& v);
static std::tuple<bool, bool, bool>
update(float dt, World& world, glm::vec3& moved_pos, Velocity& v,
Direction& direction, MoveState& move_state, HitboxID hitbox);
static void update(ServerWorld& world, entt::registry& registry);
private:
};