server changes
This commit is contained in:
parent
70a617b688
commit
5fcb1d1234
@ -53,7 +53,7 @@ struct Projectile {
|
|||||||
uint64_t spawnMs = 0;
|
uint64_t spawnMs = 0;
|
||||||
Eigen::Vector3f pos;
|
Eigen::Vector3f pos;
|
||||||
Eigen::Vector3f vel;
|
Eigen::Vector3f vel;
|
||||||
float lifeMs = 5000.0f;
|
float lifeMs = PROJECTILE_LIFE;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct BoxDestroyedInfo {
|
struct BoxDestroyedInfo {
|
||||||
@ -564,11 +564,12 @@ void update_world(net::steady_timer& timer, net::io_context& ioc) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// --- Tick: box-projectile collisions ---
|
// --- Tick: box-projectile collisions ---
|
||||||
{
|
{
|
||||||
std::lock_guard<std::mutex> bm(g_boxes_mutex);
|
std::lock_guard<std::mutex> bm(g_boxes_mutex);
|
||||||
const float projectileHitRadius = 5.0f;
|
|
||||||
const float boxCollisionRadius = 2.0f;
|
|
||||||
|
|
||||||
std::vector<std::pair<size_t, size_t>> boxProjectileCollisions;
|
std::vector<std::pair<size_t, size_t>> boxProjectileCollisions;
|
||||||
|
|
||||||
@ -614,9 +615,6 @@ void update_world(net::steady_timer& timer, net::io_context& ioc) {
|
|||||||
std::lock_guard<std::mutex> bm(g_boxes_mutex);
|
std::lock_guard<std::mutex> bm(g_boxes_mutex);
|
||||||
std::lock_guard<std::mutex> lm(g_sessions_mutex);
|
std::lock_guard<std::mutex> lm(g_sessions_mutex);
|
||||||
|
|
||||||
const float shipCollisionRadius = 15.0f;
|
|
||||||
const float boxCollisionRadius = 2.0f;
|
|
||||||
|
|
||||||
for (size_t bi = 0; bi < g_serverBoxes.size(); ++bi) {
|
for (size_t bi = 0; bi < g_serverBoxes.size(); ++bi) {
|
||||||
if (g_serverBoxes[bi].destroyed) continue;
|
if (g_serverBoxes[bi].destroyed) continue;
|
||||||
|
|
||||||
@ -705,8 +703,8 @@ std::vector<ServerBox> generateServerBoxes(int count) {
|
|||||||
std::random_device rd;
|
std::random_device rd;
|
||||||
std::mt19937 gen(rd());
|
std::mt19937 gen(rd());
|
||||||
|
|
||||||
const float MIN_COORD = -100.0f;
|
const float MIN_COORD = -1000.0f;
|
||||||
const float MAX_COORD = 100.0f;
|
const float MAX_COORD = 1000.0f;
|
||||||
const float MIN_DISTANCE = 3.0f;
|
const float MIN_DISTANCE = 3.0f;
|
||||||
const float MIN_DISTANCE_SQUARED = MIN_DISTANCE * MIN_DISTANCE;
|
const float MIN_DISTANCE_SQUARED = MIN_DISTANCE * MIN_DISTANCE;
|
||||||
const int MAX_ATTEMPTS = 1000;
|
const int MAX_ATTEMPTS = 1000;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user