Optimization tips on NPCs (Managed to get 1500 NPCs, 300-500+ Ping, About 3-5% Script Activity but Rate is over 20-30k)

  1. What do you want to achieve? Keep it simple and clear!
    Fix the very slow walking and keeping it performance-friendly.

  2. What is the issue? Include screenshots / videos if possible!
    Very slow walking and would like to have ideas how to achieve more than 1500 NPCs, After I reach 1500 NPCs I get over 400-500 ping.

  3. What solutions have you tried so far? Did you look for solutions on the Developer Hub?
    Still finding more solutions to have more NPCs and performance-friendly. Would like some ideas to achieve more than 1500+ NPCs without lag.

8 Likes

well, obviously there would be lag with 1500 NPCs
you can’t really do much when it comes to optimising npcs

2 Likes

I can’t really say much since I don’t know exactly what optimizations you’re preforming so I’ll just give a general consensus on what I remember:

Basic animation optimization
Culling on the animation/characters (if not in view, stop focusing energy/performance on them)
Optimizing mesh/parts of the character, make further npcs less detailed/use less performance heavy meshes
Basic collision optimizations, with enough parts, even the most basic of parts can become laggy when multiple collisions occur.
Shadow performance, often overlooked but if the characters are far enough, disable shadows on them
Don’t know how you handle movement but try to make the movement part “client” based with the server handling verification checks (checking where the npc should be).
Client = effects, server = verification

3 Likes

https://gyazo.com/1eeac2045bb1a3af9d535dc9bc1dfdb5



I think it is possible. I’ve seen it like this the NPCs are basically meshes but their appearance maybe client-sided. They managed to get 3k NPCs.

2 Likes

I’ve been interested on this idea for a while when I played Zombie Survivors - Roblox and planning to make one. Here’s some handful resource that I got upon researching.

5 Likes

Nothing you can do except: Making one script to control each one of the npcs. Don’t put individual scripts in each of the npcs. Make it one giant long script that controls every such npc.

3 Likes

I’m actually working on a game with my friend
we have an automated citizen script spawning and deleting npcs
all it does is clone a disabled script, clone a citizen and put the script in the citizen

though, this may not help but I have tested it with 100 npcs once and performance wise, not much of a difference when comparing with performance

game: The Golden West: Frontier | RPG - Roblox

2 Likes

That is what I did, One script to control them all.

2 Likes

So did it solve it or not?

2 Likes

can I see the script?

(remove30characterrule)

2 Likes

Right now, It can only take 1500 NPCs but at the cost of ping having 400+. So maybe it’s solved?

2 Likes

I used CollectionService for it, I used this video but made my own similar to it. Something like that.

3 Likes

you can probably use streaming enabled

I cant give a direct link but suphi kaner has a great tutorial for it

2 Likes

I’ll look into it. Thanks for answering

2 Likes

Thank you for this, this made it much more better. StreamingEnabled really helped the performance. I get 100-200 ping from 700-900 NPCs and 200-300 from 1000 NPCs. Although the NPCs are very slow.

2 Likes