How to efficiently simulate hundreds of instances of something at once?

It’s she, by the way.

And yeah, I was going to point out that you don’t need to do an arc cosine since you don’t actually care about the actual value of the angle, only rule it out. And since you’re already doing a dot product check, no need to first check for negative dot products since the cosine check includes the sign check.

You’ll likely want to further condense your algorithm by combining your target selection with the target culling. For instance, I assume you’ll pick a homing target based on things like proximity, angle, etc. Since you’re already dealing with those when filtering candidates, you can do apply your selection heuristic within the filtering loop and end up with only your best candidate instead of a list of candidates.

Yes, FPlatformTime is just the cross platform wrapper around the system clock. It is what the engine uses to update the world time every tick and calculate the DeltaTime as well. See UEngine::UpdateTimeAndHandleMaxTickRate(), which updates FApp times, which in turn is used by UWorlds to update their own values. FApp has a DeltaTime but it is only updated once per tick, so if you want finer grained deltas, you’ll have to compute your own using FPlatformTime requests.

The snippet I grabbed is from our other engine programmer who is much more old fashioned, so it uses cycles, but you can also just get plain old seconds through FPlatformTime::Seconds(). Bear in mind that comparing cycles might be slightly faster since it is an integer rather than a floating point value.