Hi,
I’m looking for some advises and ideas from people who have experience for NPC navigation in this context. I’ve found several solutions but for now, I’m not certain what is the best choice.
The context (think Guild Wars 1 for those who knows how the game works) :
-
The game is an RPG, a bit of latency is not an issue
-
The “world” is cut out into not-so-large maps which are individual scene in Unity
-
The player can join a private map (1 to 8 players inside) or public map (with up to 30 players inside). So it is a sort of match-based system.
-
The server (strongly authorative) manage NPCs and sync them between clients.
-
An instance process is created for each map dynamicly when players enter in it and closed when all players left it.
-
The navigables area can be changed during runtime with events like a boulder falling on a road and blocking the way etc.
From my understanding, there are 2 common solutions :
- Having Unity launched server side and use navigation mesh to manage NPCs.
- Using a grid-based solution with pathfinding algorithm like A*.
Solution 1 :
Pros - I will have all the tools for raycasting, do some physics calculation which is not mandatory in my game but can be handy.
Cons - Given the game logic with maps, it means that I will have an instance of Unity running server side for each map openned. Considering there can be potentially 100+ map running with low amount of player, it will obliterate the memory and CPU.
Solution 2 :
Pros - Can easily manage many maps and allow to make some useful game logic for my game (add weight on coordinates, easily change navigable areas etc).
Cons - A lot of work to make more advanced NPC behaviour like playing with line of sight with players etc (I don’t want to make a simple “aggro range” circle.
I’ve already played a bit with both solution. I also have a script to export Unity navmesh as Obj and parse it server side, also made an grid-based A* to work etc …
But I can’t decide which road to follow.
Any advice / idea ? Thank you !