#how should I make pathfinding for my game?

1 messages · Page 1 of 1 (latest)

vale nexus
#

I have been trying to use roblox's pathfinding system to make the enemies in my game walk towards the player smoothly (my game is a bullet hell meaning there'll be around 100 at a time).

the only issue? anytime i try and do it myself there's some random bug and i get stuck, anytime i try and rewire some free model to do it, it's like 8 scripts for a single zombie. should I keep trying to make it or do I use something from the devforum resources category?

keep in mind that I currently do not need very advanced ai, no vision cones or anything. all I need is an ai that can successfully walk around a wall and through a door to get to a player.

crystal laurel
#

If you're handling 100+ enemies, don't use a unique script for each one—that's what's causing your lag and complexity.
I'd recommend using a single Controller Script and a module like SimplePath from the DevForum. It handles the 'stuck' bugs for you. For performance, only use pathfinding when a Raycast shows a wall is in the way; otherwise, just have them move toward the player's position directly."
Would you like me to draft a quick example of what that 'Controller Script

vale nexus
# crystal laurel If you're handling 100+ enemies, don't use a unique script for each one—that's w...

thanks for the explanation but I have a few questions: firstly, wouldn't a raycast every second or so for each enemy cause some issues regarding fps? secondly, my core issue was that I am not very educated when it comes to pathfinding in roblox which means I keep failing to make one that works as intended, you suggested devforum modules but do you think I should use them or keep trying to make something custom that works?

crystal laurel
#

I didn't realize raycasting was that much cheaper than pathfinding. I think I’ll take your advice and use a module like SimplePath since it handles the 'stuck' logic I’ve been struggling with.
To make sure I don't lag with 100 enemies, could you show me how that Controller Script would look? Specifically, how do I structure the loop so it only runs the raycast/pathfinding check every second or so without all 100 enemies doing it at the exact same millisecond?"