diff --git a/server/server.cpp b/server/server.cpp index b981e90..e7fa469 100644 --- a/server/server.cpp +++ b/server/server.cpp @@ -53,7 +53,7 @@ struct Projectile { uint64_t spawnMs = 0; Eigen::Vector3f pos; Eigen::Vector3f vel; - float lifeMs = 5000.0f; + float lifeMs = PROJECTILE_LIFE; }; struct BoxDestroyedInfo { @@ -564,11 +564,12 @@ void update_world(net::steady_timer& timer, net::io_context& ioc) { } } + + // --- Tick: box-projectile collisions --- { std::lock_guard bm(g_boxes_mutex); - const float projectileHitRadius = 5.0f; - const float boxCollisionRadius = 2.0f; + std::vector> boxProjectileCollisions; @@ -614,9 +615,6 @@ void update_world(net::steady_timer& timer, net::io_context& ioc) { std::lock_guard bm(g_boxes_mutex); std::lock_guard lm(g_sessions_mutex); - const float shipCollisionRadius = 15.0f; - const float boxCollisionRadius = 2.0f; - for (size_t bi = 0; bi < g_serverBoxes.size(); ++bi) { if (g_serverBoxes[bi].destroyed) continue; @@ -705,8 +703,8 @@ std::vector generateServerBoxes(int count) { std::random_device rd; std::mt19937 gen(rd()); - const float MIN_COORD = -100.0f; - const float MAX_COORD = 100.0f; + const float MIN_COORD = -1000.0f; + const float MAX_COORD = 1000.0f; const float MIN_DISTANCE = 3.0f; const float MIN_DISTANCE_SQUARED = MIN_DISTANCE * MIN_DISTANCE; const int MAX_ATTEMPTS = 1000;