I’d like some clarification on how parallel luau can provide the best performance gains for maintaining large amounts of npc AIs. I’ve read up
as much as I can on the topic but still have some situation specific questions.
Previously, for a zombie game using large amounts of npcs with pathfinding logic AI, it was best to manage their movement with a single script rather than a script for each npc. With the addition of parallel luau, I have some npc approaches whose efficiency I’m unsure of. If you could explain the downside or upside of each situation I’d appreciate it.
- Creating an actor for each npc, with each npc containing a script.
I saw in a post that creating excess actors isn’t an issue because it allows for the work to be distributed well, but since we are still reusing the same code and just multithreading a bunch of times, does it really make it much better compared to serial execution?
- Create 4 actors to divide npc management up into small sections, with each actor containing one script to manage a quarter of the npcs.
If we divide up npc management and run each process parallel to each other, would that be more efficient than using one single script?
- Use a single script to manage all npcs, but run certain tasks within that script parallel.
This would prevent us from running the same code in different scripts, but we do have a lot more npcs to manage at once. Does running tasks parallel in this one script make up for the large amount of npcs we have to account for?