I saw the different ways to move a NPC but i wonder if it is better to use
Waypoints OR
A* Pathing.
A* Pathing is really nice but it calculates too much things and if there are like 30 NPCs in the same time, i don't even want to think how it would be :p
Then, IMO i must use
Waypoints, in this way : (A lot of waypoints)
Here is the method i thought about :
If the player is visible to the NPC
(nothing is between them) then i won't care about the waypoints and the NPC will directly follow the player in straight line, otherwise i'll have to find and create the best path with the waypoints and then check
(let's say each seconds) if the player is visible to the NPC.
But i don't know if i should put explicit links between waypoints, i.e : "Waypoint X links to waypoints Y & Z". This should improve the way to find path between NPC & player (
Faster & Easier btw IMO).
To find the path i think i've to do these steps :
Find the
"starter" waypoint which need to be the nearest waypoint with the NPC
AND that a traceline wouldn't find any entity between the waypoint and the player.
Afterwards, once the "starter" waypoint is found, i will take a look at his links and take the waypoint link which is the nearest of the NPC, and so on ...
Then finally we'll have a list of Waypoints to follow, i.e : Player --> X --> Y --> B --> A --> NPC.
The "small" problem is when the player will move, i think i'll check each seconds if the "starter" waypoints isn't the same, if it's not then we'll calculate a new path, otherwise we'll keep the same path.
What do you think about it ? Do you have any other ideas ?
Anyway,
if the execution time is fast and the method is reliable, let's say it's a good solution :-)
Thanks anyway,
CHOMP.
(Sorry for my english if you didn't understand some parts)
__________________