diff --git a/game/client b/game/client index 44a59f9..aa0316e 100755 Binary files a/game/client and b/game/client differ diff --git a/game/client.c b/game/client.c index 055f10e..9d38b78 100644 --- a/game/client.c +++ b/game/client.c @@ -176,9 +176,9 @@ static float fbm_noise(float x, float y, int octaves) { } float get_terrain_height(float x, float z) { - float height = fbm_noise(x * 0.03f, z * 0.03f, 4); + float height = fbm_noise(x * 0.05f, z * 0.05f, 2); height += fbm_noise(x * 0.01f, z * 0.01f, 2) * 1.5f; - return height * 6.0f + 2.0f; + return height * 4.0f + 2.0f; } #define TERRAIN_SIZE 256 diff --git a/game/server b/game/server index 1bf5606..8a2b689 100755 Binary files a/game/server and b/game/server differ diff --git a/game/server.c b/game/server.c index 324b25b..28bceea 100644 --- a/game/server.c +++ b/game/server.c @@ -2,6 +2,7 @@ #include #include #include +#include #include #include @@ -142,9 +143,9 @@ static float fbm_noise(float x, float y, int octaves) { } float get_terrain_height(float x, float z) { - float height = fbm_noise(x * 0.03f, z * 0.03f, 4); + float height = fbm_noise(x * 0.05f, z * 0.05f, 2); height += fbm_noise(x * 0.01f, z * 0.01f, 2) * 1.5f; - return height * 5.0f + 2.0f; + return height * 4.0f + 2.0f; } #define TERRAIN_SIZE 256 @@ -550,6 +551,8 @@ int main(void) { WSAStartup(MAKEWORD(2, 2), &wsa); #endif + srand((unsigned)time(NULL)); + ode_init_world(); int sock = (int)socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP); @@ -571,7 +574,7 @@ int main(void) { } Player players[MAX_PLAYERS] = {0}; - uint32_t serverTick = 0, itemsTickDiv = 0; + uint32_t serverTick = 0, itemsTickDiv = 0, spawnCounter = 0; printf("Server listening UDP %d\n", SERVER_PORT); double nextTick = now_seconds(); @@ -791,6 +794,7 @@ int main(void) { if (t >= nextTick) { nextTick += DT; serverTick++; + spawnCounter++; dSpaceCollide(gSpace, 0, &nearCallback); dWorldQuickStep(gWorld, DT); @@ -825,6 +829,29 @@ int main(void) { } } + // Spawn random items every 30 seconds (900 ticks at 30Hz) + if (spawnCounter >= 900) { + spawnCounter = 0; + for (int i = 0; i < 2; i++) { + int type_idx = rand() % 3; + uint8_t type; + int qty; + if (type_idx == 0) { + type = ITEM_MEDKIT; + qty = 1; + } else if (type_idx == 1) { + type = ITEM_AMMO_PISTOL; + qty = 10 + (rand() % 6); + } else { + type = ITEM_AMMO_RIFLE; + qty = 20 + (rand() % 11); + } + float x = (float)(rand() % 200 - 100); + float z = (float)(rand() % 200 - 100); + item_spawn(type, qty, x, z); + } + } + for (int i = 0; i < MAX_PLAYERS; i++) { Player *p = &players[i]; if (!p->inUse || !p->alive)