feat: Nav mesh generation

This commit is contained in:
2025-10-06 18:23:47 +01:00
parent c4cf8f532b
commit d9957eead1
5 changed files with 52 additions and 35022 deletions

View File

@@ -24,7 +24,6 @@
#include "game/impl/world.c"
#include "game/impl/npc.c"
#include "game/impl/bandit.c"
#include "game/testnavmesh.h"
int main(int argc, char **argv)
{
@@ -99,18 +98,18 @@ int main(int argc, char **argv)
//LoadWorld(arena, world);
game->world = world;
world->arena = arena;
world->navMesh = &TestNavMesh;
//world->navMesh = &TestNavMesh;
world->random = Random_Seed(29237489723847);
world->npcCount = 2;
world->npcCount = 127;
for(U32 i = 0; i < world->npcCount; i++) {
NPC *npc1 = &world->npcs[i];
npc1->collision.pos.x = 15;
npc1->collision.pos.y = 15;
NPC *npc1 = &world->npcs[i];
npc1->collision.pos.x = 0;
npc1->collision.pos.y = 0;
npc1->collision.size.x = 1;
npc1->collision.size.y = 2;
npc1->name = S("Matt");
npc1->mode = NPC_ACTION_WAITING;
npc1->currentArea = i;
npc1->currentArea = WORLD_AREA_OUTSIDE;
npc1->waitTime = 0;
npc1->maxWaitTime = 5;
npc1->currentNavNode = 0;
@@ -218,6 +217,7 @@ int main(int argc, char **argv)
world->propCount = 0;
world->props = M_ArenaPush(arena, World_Prop, .count=WORLD_PROP_MAX);
world->hitboxes = M_ArenaPush(arena, AABB, .count=WORLD_HITBOX_MAX);
GenerateNavMesh(arena, world);
}
game->editor.enabled = false;
game->editor.mode = G_EDITOR_MODE_TILE;
@@ -232,8 +232,6 @@ int main(int argc, char **argv)
bool running = true;
printf("%zu size in bytes\n", sizeof(TestNavMesh));
const int width = 1280;
const int height = 720;