BunyaPineTree / LethalCompany_ModelReplacementAPI

MIT License
55 stars 19 forks source link

MoreCompany + ModelReplacementAPI + Miku = Constant 10 FPS #20

Open TeruDN opened 11 months ago

TeruDN commented 11 months ago

So, with ModelReplacementAPI at any version above 2.1.0 (I've tested it with every subsequent version since, only managing to find a non-laggy version within this combination by downgrading), the game permanently runs at a low framerate, whether I'm in the ship or whether I'm on a vanilla/modded moon. I've found that it ONLY does this if MoreCompany is also enabled, and otherwise does not have this issue at ALL. At the time of writing, the latest versions of these mods are:

ModelReplacementAPI 2.2.1 MikuModelReplacement 1.4.1 MoreCompany 1.7.2

BunyaPineTree commented 11 months ago

Some of my practices have not been very performant, but this is actually a good thing, as it means improving performance should be quite easy. I have an idea of why MoreCompany would be causing performance issues and will get on that. In the meantime could you tell me how performance changes when you use a model replacement that isn't heavy on physics, like Miku is?

TeruDN commented 11 months ago

Thanks for responding! I've just tested it with "KnacklesModelReplacement" and "ReisenModelReplacement" seen here:

https://thunderstore.io/c/lethal-company/p/Bojeu/KnacklesModelReplacement/

https://thunderstore.io/c/lethal-company/p/Franzyd/ReisenModelReplacement/

There was no lag at all when I tested it with the Knackles one. However, the Reisen one gave me around 27 FPS consistently.

BunyaPineTree commented 11 months ago

Got it, thanks for the info.

It seems to me that the issue is an increasing overhead on my calls to update as more things are supported. MoreCompany requires me to set cosmetic position and rotations each update due to reparenting causing an enormous amount of issues, and it's obvious why physics would increase overhead. I'll start caching most things that can be cached in their own managers, and hopefully that will improve your situation.

As for physics, UnityJigglePhysics doesn't currently support changing update rates, but I happen to be looking into that, so in the future we may be able to reduce the physics overhead as well.

Edouard127 commented 10 months ago

On my side, I have 3 models for a total of 240mb and I can run the game with minimal frame drops, is still still relevant ?

BunyaPineTree commented 10 months ago

Performance issues still exist. This will stay up in case anyone else wishes to comment on it. Also the performance problem is related to heavy scripts like unityjigglephysics and the increasing size of update methods, not necessarily model size.