Forum rules - please read before posting.

NPC.FixedUpdate() uses 60% of total CPU

edited September 2014 in Technical Q&A
Hi guys, Ive been using the profiler all day reducing bottlenecks and now my largest one is NPC.FixedUpdate(), from AC. I have lots of people walking around and I see some relatively complex maths in the methods that it relies on, but should this really need 60% of the cpu? Or is something going weird, seems like its a bit overkill. 

The code seems fairly optimised really, so I am just wondering if there is a way I can reduce this significantly without affecting gameplay too much. Or maybe Ive done something wrong that causes this to happen.. Maybe if you guys check your profiler you will see this too..

Comments

  • I would suggest removing Rigidbodys, but going by your other post it seems you've already done that.  Are you using a single Character: Move along Path Action per NPC to get each moving?

    The NPC script likely isn't the cause of it - but instead the _FixedUpdate function of it's base Char script that it calls within it.

    Try commenting out each of the functions that Char.cs' _FixedUpdate function calls, and see which one (assuming it's due to only one) is causing the slowdown. 
  • Thanks Chris! Yes I have removed the rigidbodies, makes it so much faster (but now my people walk right through each other, no way to fix this right?).... Yes I am using a single character/move along path, per NPC.
  • No - Rigidbodys are needed for collision.  You could just be really careful with how the Paths are laid out, I suppose.
  • Yes thats what Im doing now, once in a while they might go through each other but it will be rare.
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Welcome to the official forum for Adventure Creator.