Each cube has a humanoid in it, which moves through a series of waypoints then gets destroyed, and I was wondering If I should even use Humanoids at all for this, since there are too many, I already disabled every state except “None”, and don’t knwo what else to do.
The game runs but with a noticeable lag spike.
If the cubes aren’t being animated, you should tween the movement of the blocks without Humanoids. Unless you’re doing something entirely different (in which case, what are you doing?)
if you dont need physics then dont use humanoids
if you need animation then
is faster then humanoids
tweening is not the fastest method
its better to position them in
here is a demo i made
500_enemys_running_at_60_fps.rbxl (36.2 KB)
I see, gonna check that out, should proably be a bit easier for me since I don’t have animations, heh.
How would you do turning with this? (I think i’ve got it, I will edit with code in a bit)
I started doing this on the server, and was very laggy, then tried doing the same on the client and It was jsut as laggy, maybe I should use body movers?
Body movers seem to lag the game the least
I ended up using BulkMoveTo() and iterating through some very large tables, which seems to be the msot efficient solution so far, pretty similar to what you did here.
Body movers are deprecated
Here are the new body movers
Having the parts on server side will use a lot of network bandwidth
While having them on client side will have no network usage
This video might give you a idea on how to control npcs that are on the client side
here are some demo projects that might help you
SpawnEnemys.rbxl (36.7 KB)
Server_keeping_track_of_enemy_positions.rbxl (33.9 KB)
spawn_enemys_without_a_loop.rbxl (35.0 KB)
500_enemys_running_at_60_fps.rbxl (36.2 KB)
FollowPath.rbxl (42.9 KB)
I just realised I hadnt marked solution
Hey, just wanna say thanks for the example places. I’ve enjoyed playing around with these for an idea for a new game we have. It will also help on another game where mobile players started to lag when I placed too many NPC visitors in to a zoo. Much appreciated.
Have you done a Community Tutorial on this as I think a lot more people would be able to use it.
I hope to do YouTube tutorials of this topic
How would you make a system like this but on the server? Like how would you replicate this to every player without a big drop in performance like 300 of them at most? It is easy to do it all on the client but what about the server.
ideally you would have a table on the server that represents the NPC and you only replicate the information that’s absolutely necessary this can be different from one game to the next
for instance if your making a RPG style game you might only need to replicate where the NPC is standing and who the NPC is attacking
or for a tower defence style game you might not need to replicate any information about the NPC as the client is able to workout what NPC spawns without the help of the server based on when the game started
I have a video coming soon that will show you how to make a tower defence game that has 1000+ NPCs that has zero replication but is still able to stay in sync with the server