summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorAldrik Ramaekers <aldrikboy@gmail.com>2024-05-16 20:33:22 +0200
committerAldrik Ramaekers <aldrikboy@gmail.com>2024-05-16 20:33:22 +0200
commit250361975fc81ca01d96f615ed1226641887c305 (patch)
treee11c9cf7ad6cf7d5d363286fc462de02c9a8e9d2 /include
parent544f338b8e9ea010eccedbfa24bee5c97b7d3621 (diff)
improve pathfinding
Diffstat (limited to 'include')
-rw-r--r--include/game.h6
-rw-r--r--include/objects.h1
-rw-r--r--include/pathfinding.h2
-rw-r--r--include/zombies.h1
4 files changed, 8 insertions, 2 deletions
diff --git a/include/game.h b/include/game.h
index 20a7437..333f076 100644
--- a/include/game.h
+++ b/include/game.h
@@ -9,7 +9,9 @@
#define SERVER_TICK_RATE (1.0f/60.0f)
#define SERVER_MAX_PLAYERS (5)
-#define SERVER_PATHFINDING_INTERVAL (0.25f)
+#define SERVER_CLOSE_PATHFINDING_INTERVAL (0.25f)
+#define SERVER_FAR_PATHFINDING_INTERVAL (1.0f)
+#define SERVER_PATHFINDING_THREADS 3
typedef enum t_game_state {
GAMESTATE_IDLE,
@@ -37,6 +39,8 @@ typedef struct t_game {
scene_state global_scene_state = SCENE_MAIN_MENU;
game global_state = {GAMESTATE_IDLE,DISCONNECTED,0,0};
+pathfinding_request active_requests[SERVER_PATHFINDING_THREADS] = {0};
+
void init_game();
void start_solo_game();
bool connect_to_game(char* ip, char* port);
diff --git a/include/objects.h b/include/objects.h
index cb42a04..a8baf3c 100644
--- a/include/objects.h
+++ b/include/objects.h
@@ -112,7 +112,6 @@ typedef struct t_box {
vec2f br_u;
} box;
-// @NEWOBJECT
object object_dict[OBJECT_END];
// decoration objects laying on floor.
diff --git a/include/pathfinding.h b/include/pathfinding.h
index e648f2c..4eace4c 100644
--- a/include/pathfinding.h
+++ b/include/pathfinding.h
@@ -8,6 +8,8 @@
#include "objects.h"
#include "list.h"
+//#define DEBUG_PATHFINDING
+
typedef struct t_pathfinding_request
{
vec2f start;
diff --git a/include/zombies.h b/include/zombies.h
index bb74d23..36d4ede 100644
--- a/include/zombies.h
+++ b/include/zombies.h
@@ -29,6 +29,7 @@ typedef struct t_zombie {
float sec_since_last_attack;
array next_path;
float time_since_last_path;
+ float time_since_last_successfull_req;
pathfinding_request request;
vec2f next2tiles[2];
zombie_type type;