What's the best movement behavior for AI (Several enemies)

  • I'm having a hard time with performance issues (40% of CPU or more) when handling AI's of 40+ enemies. While I'm looking for everything I could improve on my events, I'd like to know from someone that have already done something in this scale what's the best movement behavior to manage several enemies? Is there even any difference between all behaviors regarding to performance? If so would a low level movement behavior consume less cpu? Btw, it's a platform.

    Thanks!

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Sounds like a runaway loop more than a behavior issue. I've had similar problems with large groups of AI because of a For Each loop they were using. Got rid of the loop and they worked just fine. They all used Bullet behavior, but as already said I don't think this is the problem.

  • Kind of to echo what 'sup with that?' I think it matters more on how you event them than the behavior. I'm sure there are differences but I'm not technical enough to know, but the problem is likely arising from you how are event-ing them than the behavior you chose.

    I think it is important to pay attention to your events that run every tick—and that doesn't mean just "on every tick" events, that means any event that doesn't have an arrow next to it. So if you have a ton of those you multiply those by every enemy and that's how many computations run every tick. At least try to package them into one and use the 'else'. That would be my first recommendation.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)