I need a lot more understanding on enemy NPCs. I have read tons of forums on it and it is just making my head spin. I literally feel like I’ve stumbled upon a brick wall that I won’t be able to get past for a while.
Organizing NPCs:
I know about module scripts and stuff like that but is it really worth learning if you wanna make NPCs? If so, what do I put inside those module scripts, like do I put everything, the npc movement, damage, animations on module scripts. Where do I put the scripts in?
Humanoid or no Humanoid?:
I have been looking on forums and I’ve been seeing that humanoids is bad because of lag? How do you use the MoveTo() if you don’t have a humanoid in the npc.
OOP: Also I’ve been seeing that if you wanna learn to actually NPCs you need to learn something called “OOP” it seems extremely daunting and I have no idea how I am going to use it for NPCs.
Anyways to move NPC besides Pathfinding:
I know how to move them, only using Pathfinding, and I’ve been hearing it’s pretty laggy. If there are any other ways to move the NPCs that you’ll like to tell me I will gladly appreciate it.
Organizing NPCs : there’s really lots of ways to do this. personally i use modules to store some functions that will be used by all the NPCs such as finding target and stuff.
Humanoid or no Humanoid : Usually i just use humanoid and to decrease lag i disable some humanoid states. it seems to work for me even with 20 - 30 NPCs at once wont cause lags.
OOP : You dont have to use it, i personally don’t use it and i can still make NPCs that are kinda complex.
Move NPC besides Pathfinding :
you can try neural network for that
if you want to use humanoids then i suggest you learn humanoids properties.
if you dont want to use humanoids then learn how to make your own humanoid.
after that, you can start by making a simple npc that finds the nearest target and chase the target, maybe adds some extra stuff like attacking the target when in certain distance.
then you can start learning pathfinding, and make another AI with pathfinding.
if you do the pathfinding correctly it will not lag.
oh and also if you want it to be realistic so they must see you to follow you, you can make
a raycast between the npc and the nearest humanoid and check if there is an obstruction if there is then ignore the player else attack and follow the humanoid.