Any tips for optimizing "smart" npcs?

Hello fellow scripters!
I have made a pathfinding script that attacks players, it can handle around 65-70 (unironically) smart npcs with minimal-moderate ping/lag.
Optimizations I have made:

  • Turned off npcs that are far from the player
  • Updating npc to face the player only when they are in range to shoot/attack
  • Skip npcs that cannot see the player

Goals:
I would like to perhaps improve the threshold of “smart” npcs that the server can handle.

Things I have heard that could help:

  • Multithreading

Any tips would be appreciated.
Examples of games with large counts of “smart” npcs that can handle with minimal lag are Guts & Blackpowder, Notoriety, etc. (other examples you can prob think of)

2 Likes

if you aren’t doing custom replication here’s my writeup on it :slightly_smiling_face:

4 Likes