Hi.

I have an optimization question.

I have a game featuring a soldier squad up to 5, and about 25 enemies in a level.

Regularly (about once per second), they each soldier line trace each enemy and vice versa to see if they can see each other, make rotation calculations, distance calculations based on several parameters and so forth.

These are made with for loops where one soldier/enemy performs all own calculations in one loop. These individual loops are spread out with random float delays such that every character/enemy has their own frame to make these calculations in.

But i imagine that when one soldier makes his own calculations, it still stresses the system a fair amount.

Since loops doesn’t support delays within the loop itself, is there a way to spread out the calculations over a period, or am i worrying too much because the computer can to handle those calculation and many, many more in one instance?

Thank you in advance