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

Get help using Construct 2

Post » Thu Oct 06, 2016 8:12 pm

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!
B
56
S
21
G
3
Posts: 602
Reputation: 6,612

Post » Tue Oct 11, 2016 9:07 am

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.
B
53
S
24
G
18
Posts: 295
Reputation: 13,115

Post » Tue Oct 11, 2016 2:33 pm

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.
ImageImageImage
B
44
S
26
G
11
Posts: 518
Reputation: 10,502


Return to How do I....?

Who is online

Users browsing this forum: John Cutter and 7 guests