A* Pathfinding Project

Managing "alive" AI


#1

Hi,

I am planning for the startup of a new project and have good experience from trying your free product before, and would now like to try the full one :slight_smile: , I have a few questions before I begin.

  1. Is there a smart way to manage “living” NPCs when the player is not close by? Say I have a village of Wandering NPCs that decide what to do and where to go randomly each day. Is there some smart way I can make sure they still “live their lives” when the player is not in the village? Or would that have to be a completely custom solution where I save/load AI data every time I leave the village?

  2. I want the player to be able to build whatever he wants, wherever he wants. That means he might accidentally block an NPCs way home with a new fence (for example). Is there any way to warn the player that he is blocking off an area or a path? Or does that need to be managed from each NPC? i.e if their path is blocked they deal with it somehow.

  3. Does your solution use its own grid when working in 3d? If so, would you recommend I use that grid when I build or move or is it recommended to leave that grid alone to just deal with A*?


#2

Hi

  1. These are not really tasks for a pathfinding library, it sounds better suited for a behavior tree library for example.

  2. There is, see the bottom of this page: https://arongranberg.com/astar/docs/graphupdates.html#blocking. It works best with grid graphs though.

  3. I’m not sure what you mean by “when working in 3D” in this context? Could you elaborate on this?


#3

Thanks!

By working in 3d I simply mean a 3d game, I assume your solutions for 2d and 3d are different? But maybe Im wrong.


#4

All navigation graphs work for both 2D and 3D. (Though recast might be tricky to set up for a 2D game)
Both Grid and Layered grid graph even have a simple toggle to enable 2D mode.