So I’m currently working on this game in which a player could be encountering upwards of 50 enemies at once. I plan for servers to hold around 6 people so that would equate to about 300 enemies being processed on the server at the same time, which is a lot. I was wondering what methods I could use to lessen the burden on the server and have my game actually function. In case this is important, a player will never be able to see the enemies of another player. Thanks in advance.
A good rule of thumb is that looks and stuff should be managed via the client not the server, so if the enemy has animations dont play them on the server, play them on the client. And if you want to make it even more effecient, find a way where the server only contains some kind of instance thats contains just the state and position of the enemy (and any other values you may need to replicate to clients) and then just completely generate the enemies appearance based off of the values from the said instance on the client. This should make it more efficient, as the server doesnt have to replicate the entire body, animations and all, across every client, instead the client is just loading it itself.
Another thing I’ve seen people mention is steering clear of humanoids. As having lots of them can create lots of lag (Im not sure how true this is, so doing your own research into it is advised!).
Another thing that could also help with performance is making it so every enemy is controlled by a single script, dont know how much more performant this will make it, but I believe it helps.
With that you can also look into threads, and make the enemy control run on its own thread that way it doesnt slow everything else down as much
thats all I can think of off the top of my head, if you have any more questions regarding this feel free to ask!
Hope this helps!
Thanks for the insight, this helps a lot!