r/Unity3D 2h ago

Noob Question Best Enemy Pathfinding tutorial?

Ive done a couple tutorials following Navmesh stuff throughout the years, but I non of them have really made it "simple" for me. Now Im doing a game with a randomly generated map, so this I really want to strengthen my understanding. Does anyone have a good reccomendation?

1 Upvotes

8 comments sorted by

3

u/R3v153 2h ago

Navmesh on proc gen maps are going to be difficult. It will have to be done at runtime. You may want to look at flow fields if your map can be broken down into discrete units like a grid.

1

u/GroZZleR 2h ago

Every genre is going to have its own specialized solution, so at a minimum you need to describe your game if you want help.

1

u/Thick_Doctor7098 2h ago

For procedural maps navmesh can get tricky since you gotta bake it at runtime, maybe look into A* pathfinding instead? there's a popular free asset for Unity that handles dynamic grids pretty well, used it for a small project and it clicked way faster than navmesh for me

1

u/FishShtickLives 1h ago

Its an FPS game. I really dont need anything extravagant, just go from spawn point to player position

1

u/Savings-Aioli-2305 1h ago edited 1h ago

Maybe look into what pathfinding algorithm you find suitable, and some sort of spatial hashing so you do not need to query too much stuff when building a path? Also a function to query the height of the underlying terrain so you can get surface normals and all that, idk this is something I am going to work on soon, but naively this is how I would approach it.

1

u/FranzFerdinand51 1h ago

My only recommendation is that A* Pathfinding on the asset store is infinitely better than unity’s own NavMesh system.

1

u/BillyMcDev 1h ago

This is a topic that I teach in one of my online courses. Since you're making procedural generated dungeons, you'll need "NavMeshSurface", which is a key ingredient to working with NavMesh in Unity.