Mass Humanoids question

I’m currently in the process of brainstorming how to create a game I have in mind.

It will involve the usage of mass NPCs, no pathfinding required. Simply use of the humanoid.MoveToFinished event. Essentially the idea is players can buy NPC’s that will attack the other team. The game would consist of 3v3

I was hoping to in theory have a total of 200 max possible Humanoid NPC’s on the battle field at a given time. The map is very simple with not a lot going on. The game’s focus will be on the NPCs battling.

My question is, what do I need to read up on for maximum performance regarding using Humanoids. I want the best efficiency I can get and maximize performance. Any tips or information would be greatly appreciated. And in this scenario, likely what is my maximum amount of Humanoids I could possibly use if well optimized overall before I start seeing noticeable lag? Thank you.

1 Like

Humanoids (and the npc) do not need to exist on the server. (since its visual)
It is probably fine if you disabled every state you dont use, even with 200 of them.

I tested on an empty baseplate with 512 drooling zombie (no script inside) without disabling any state and there is no frame drop.
Although the ping went up 20 ms.

What happens if you ordered them all to walk to a point? I was reading, body mover is better to use? I’m not really sure what that even is. I’m an old developer so it’s been years since I was working with this stuff.

I’m fairly sure R6 is much better then R15 if you want to use many NPCs at the same time. Less parts = less physics.

Also; I’m fairly sure you can have over 200 small ones.

you could use ray marching basically it loads things only when you close to them lets say i have a ray of 250 studs i can only see that part if im 250 studs close at min
How you do this is you use a ray with raycasting then say if ray touch then add a humanoid into the object with this script then do the opposite thing for the else.

I’m going to be using an RTS style camera for this. It’s also going to be a somewhat small battle field. Big enough that you need to scroll across it to see everything, but a full scroll could be done in around 3-4 seconds (depending on sensitivity)

In my case with this camera, how would that work? Or would it be best to not use this.

And when you say pop a humanoid into it. Are you saying that instead of Humanoids I use a single part with velocity moving. And then send a ray towards that part, and then change the part into a humanoid? Or am I not understanding this?

Yes exactly that
However one thing I think you should also do is maybe use animation controllers.

What if the player looks away from the part? Do I turn him back into a block, how do you detect that? Do I have a script constantly sending out ray trace every 0.02 seconds?

Yes you make turn it back into a part
you can do that with a wait so that way if the rays not touching then it turns back.

What I don’t understand is, how do I know if the camera is viewing the object? I’ve never used raytracing, but if you’re just sending a point to an object, how do you know if the point is in the camera view?

Or are you sending the point from the camera itself?

No rays are sort of like a region3 they are areas the script can detect in a ray shape.