Performance Questions

In my game I have multiple NPCs (enemies) that each all have a server-sided script inside of them. This works really well for being able to fully customize the NPCs, although I’ve got a feeling that it might cause lag if there’s lots of NPCs.

The server scripts are slightly different, but all of them contain this:

I use the loop to detect players within the NPC’s sight and it works fine. Again, my concern is that too many NPCs will cause the game to lag. I tested this theory, and from what I saw it does increase lag dramatically.

I’m not sure what to do, because server sided scripts inside each NPC is a lot easier for me to work with. Any thoughts?

1 Like

You can have any vision checks run in a separate thread using an Actor, which shouldn’t require any changes if the check you’re using only needs to read (not write)

1 Like