The premise is simple, I’m making a basic PvE game that utilizes humanoids so that the controls between an NPC and a Player isn’t so different, I have only one issue so far, and that being humanoid lag
In the previous post, my game could not withstand 50 humanoids, I’ve maximized the optimizations to a totality and made sure it runs properly, this time it can survive about 100 (which is still alot on most cases), however after crossing about 110-115 npcs/humanoids, the game starts to lag in the form of humanoid having a very difficult time to move
I’ve made sure my code is optimized, and before the “use custom humanoids instead”, that solution isn’t really viable because I’ve already wrote thousands of lines of code basing it on humanoids, and it’ll take months if not years to make a custom controller, and then integrate it to my current system
Solutions Tried:
Collision Groups (Helps FPS by a lot, but still, very laggy/unimpactful at a high humanoid count)
Disabling States (I’ve disabled all unnecessary states, about 90% of them since i only needed walking for the most part)
Evidence of humanoid lag:
What can I do in this situation? is this a dead end for me??
Most games that use a lot of NPCs simulate them as tables and don’t use humanoids, other solution which is a lot more simplier is to use body movers and animation controllers, lerping is also possible solution
Again, while ideal, all of my core script still utilizes and relies on humanoid and it’s methods and properties to run properly (current humanoid states, moveto, character physics + easy controls, and so much more). Had I known what a mess humanoids are, I would’ve opted for animation controllers.
Are there any better alternatives to fix or atleast optimize humanoids even further instead of replacing it?
It’s pretty much normal to refactor entire scripts, my friend refactored their tower defense game from ground up 5 times or so, which was a lot of work, but it was worth it
Humanoids are heavy, and any further optimizations may end up failing, only thing you can really do is try to reduce calculations you perform, other than that, you can disable collisions for each part and use hitboxes maybe
Alright, after careful reconsideration this is indeed the best solution so far, Will start working on it in a few months since I don’t have time atm
Although i did add a “bandaid” fix to the slowdown issue, albeit they still move weirdly/bouncy like but for the most part they keep their avg velocity.